x7f0ebae1a2d30adf.cs
上传用户:xlxx0122
上传日期:2015-04-24
资源大小:3904k
文件大小:9k
源码类别:

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Drawing;
  6.     using System.Drawing.Imaging;
  7.     using System.IO;
  8.     using System.Runtime.InteropServices;
  9.     internal class x7f0ebae1a2d30adf
  10.     {
  11.         private string x2de0dddab0e399a9;
  12.         private Hashtable x5e15c490aec0e408;
  13.         private bool x6c7711ed04d2ac90;
  14.         private Stream x6d84580748d50f45;
  15.         private string x9fc8c6f4ce2be206;
  16.         private Hashtable xb41dc438649d784b;
  17.         private Hashtable xc41ca09fad45f9ee;
  18.         public x7f0ebae1a2d30adf()
  19.         {
  20.             this.xc41ca09fad45f9ee = new Hashtable();
  21.             this.x5e15c490aec0e408 = new Hashtable();
  22.             this.xb41dc438649d784b = new Hashtable();
  23.         }
  24.         public x7f0ebae1a2d30adf(Stream stream)
  25.         {
  26.             this.xc41ca09fad45f9ee = new Hashtable();
  27.             this.x5e15c490aec0e408 = new Hashtable();
  28.             this.xb41dc438649d784b = new Hashtable();
  29.             this.SkinStream = stream;
  30.         }
  31.         public x7f0ebae1a2d30adf(string skin)
  32.         {
  33.             this.xc41ca09fad45f9ee = new Hashtable();
  34.             this.x5e15c490aec0e408 = new Hashtable();
  35.             this.xb41dc438649d784b = new Hashtable();
  36.             this.SkinFile = skin;
  37.         }
  38.         public Bitmap GetBitmap(string key)
  39.         {
  40.             if (this.Ready && this.xc41ca09fad45f9ee.Contains(key))
  41.             {
  42.                 return (Bitmap) Image.FromStream((Stream) this.xc41ca09fad45f9ee[key]);
  43.             }
  44.             return null;
  45.         }
  46.         public Bitmap GetBitmap(string key, int spitCount, int spitIndex)
  47.         {
  48.             if (this.Ready && this.xc41ca09fad45f9ee.Contains(key))
  49.             {
  50.                 return x448fd9ab43628c71.SplitBitmap(this.GetBitmap(key), spitCount, spitIndex);
  51.             }
  52.             return null;
  53.         }
  54.         public bool GetBool(string key)
  55.         {
  56.             if (!this.x6c7711ed04d2ac90)
  57.             {
  58.                 return false;
  59.             }
  60.             if (!this.xb41dc438649d784b.ContainsKey(key))
  61.             {
  62.                 return false;
  63.             }
  64.             return (((int) this.xb41dc438649d784b[key]) == 1);
  65.         }
  66.         public Color GetColor(string key)
  67.         {
  68.             Color color = Color.FromArgb(0xff, 0xff, 0xff);
  69.             if (!this.x6c7711ed04d2ac90)
  70.             {
  71.                 return color;
  72.             }
  73.             if (!this.x5e15c490aec0e408.ContainsKey(key))
  74.             {
  75.                 return color;
  76.             }
  77.             int sysColor = (int) this.x5e15c490aec0e408[key];
  78.             if ((sysColor & 0xff000000L) == 0xff000000L)
  79.             {
  80.                 sysColor = x61467fe65a98f20c.GetSysColor(sysColor & 0xff);
  81.             }
  82.             return Color.FromArgb(sysColor & 0xff, (sysColor & 0xff00) >> 8, (sysColor & 0xff0000) >> 0x10);
  83.         }
  84.         public int GetInt(string key)
  85.         {
  86.             if (this.x5e15c490aec0e408.ContainsKey(key))
  87.             {
  88.                 return (int) this.x5e15c490aec0e408[key];
  89.             }
  90.             return 0;
  91.         }
  92.         protected virtual void OnSkinFileChanged(string fileName)
  93.         {
  94.             this.x2fd0a49330761d63(fileName);
  95.             this.x9fc8c6f4ce2be206 = fileName;
  96.         }
  97.         protected virtual void OnSkinStreamChanged(Stream stream)
  98.         {
  99.             this.x2fd0a49330761d63(stream);
  100.             this.x6d84580748d50f45 = stream;
  101.         }
  102.         public void SetBitmap(string key, Bitmap buf)
  103.         {
  104.             if (this.x6c7711ed04d2ac90)
  105.             {
  106.                 MemoryStream stream = new MemoryStream();
  107.                 buf.Save(stream, ImageFormat.Bmp);
  108.                 this.xc41ca09fad45f9ee[key] = stream;
  109.             }
  110.         }
  111.         public void SetBool(string key, bool b)
  112.         {
  113.             if (this.x6c7711ed04d2ac90)
  114.             {
  115.                 if (b)
  116.                 {
  117.                     this.xb41dc438649d784b[key] = 1;
  118.                 }
  119.                 else
  120.                 {
  121.                     this.xb41dc438649d784b[key] = 0;
  122.                 }
  123.             }
  124.         }
  125.         public void SetColor(string key, Color color)
  126.         {
  127.             if (this.x6c7711ed04d2ac90)
  128.             {
  129.                 this.x5e15c490aec0e408[key] = color.ToArgb();
  130.             }
  131.         }
  132.         protected virtual void SkinPasswordChanged()
  133.         {
  134.             this.x2fd0a49330761d63(this.x6d84580748d50f45);
  135.         }
  136.         private void x0c4b0fbba1d27e4d()
  137.         {
  138.             this.xc41ca09fad45f9ee.Clear();
  139.             this.x5e15c490aec0e408.Clear();
  140.             this.xb41dc438649d784b.Clear();
  141.         }
  142.         private void x2fd0a49330761d63(Stream x23cda4cfdf81f2cf)
  143.         {
  144.             this.x6c7711ed04d2ac90 = false;
  145.             this.x0c4b0fbba1d27e4d();
  146.             Stream writeStream = new MemoryStream();
  147.             if (x2b13dab2573bcd5e.Unzip(x23cda4cfdf81f2cf, "SKINDATA.SK2", writeStream, this.x2de0dddab0e399a9) == xfba9214ce91902fb.Success)
  148.             {
  149.                 BinaryReader reader = new BinaryReader(writeStream);
  150.                 writeStream.Seek(0L, SeekOrigin.Begin);
  151.                 xe148cfaee7cc82a1 xecfaeecca1 = (xe148cfaee7cc82a1) x49cceb88e1b6126e(reader, typeof(xe148cfaee7cc82a1), Marshal.SizeOf(typeof(xe148cfaee7cc82a1)));
  152.                 writeStream.Seek(0L, SeekOrigin.Begin);
  153.                 x57f24fc7026c57d0 xffccd = (x57f24fc7026c57d0) x49cceb88e1b6126e(reader, typeof(x57f24fc7026c57d0), Marshal.SizeOf(typeof(x57f24fc7026c57d0)));
  154.                 if (xffccd.FirstNode != 0)
  155.                 {
  156.                     writeStream.Seek((long) xffccd.FirstNode, SeekOrigin.Begin);
  157.                     x8632e8b92c54e123 xebce = (x8632e8b92c54e123) x49cceb88e1b6126e(reader, typeof(x8632e8b92c54e123), Marshal.SizeOf(typeof(x8632e8b92c54e123)));
  158.                     do
  159.                     {
  160.                         int num;
  161.                         writeStream.Seek((long) xebce.NodeStart, SeekOrigin.Begin);
  162.                         switch (xebce.Type)
  163.                         {
  164.                             case xab0f0a5b63c83169.Stream:
  165.                             {
  166.                                 MemoryStream stream = new MemoryStream(reader.ReadBytes((int) xebce.NodeSize), 0, (int) xebce.NodeSize);
  167.                                 this.xc41ca09fad45f9ee.Add(xebce.Key, stream);
  168.                                 break;
  169.                             }
  170.                             case xab0f0a5b63c83169.Int:
  171.                                 num = reader.ReadInt32();
  172.                                 this.x5e15c490aec0e408.Add(xebce.Key, num);
  173.                                 break;
  174.                             case xab0f0a5b63c83169.Bool:
  175.                                 num = reader.ReadByte();
  176.                                 this.xb41dc438649d784b.Add(xebce.Key, num);
  177.                                 break;
  178.                         }
  179.                         writeStream.Seek((long) xebce.NextNode, SeekOrigin.Begin);
  180.                         xebce = (x8632e8b92c54e123) x49cceb88e1b6126e(reader, typeof(x8632e8b92c54e123), Marshal.SizeOf(typeof(x8632e8b92c54e123)));
  181.                         num = 0;
  182.                     }
  183.                     while (xebce.NextNode != 0);
  184.                     this.x6c7711ed04d2ac90 = true;
  185.                 }
  186.             }
  187.         }
  188.         private void x2fd0a49330761d63(string xafe2f3653ee64ebc)
  189.         {
  190.             FileStream stream;
  191.             if (File.Exists(xafe2f3653ee64ebc))
  192.             {
  193.                 stream = File.Open(xafe2f3653ee64ebc, FileMode.Open, FileAccess.Read, FileShare.Read);
  194.             }
  195.             else
  196.             {
  197.                 stream = File.Open(Path.GetFileName(xafe2f3653ee64ebc), FileMode.Open, FileAccess.Read, FileShare.Read);
  198.             }
  199.             try
  200.             {
  201.                 this.x2fd0a49330761d63(stream);
  202.             }
  203.             finally
  204.             {
  205.                 stream.Close();
  206.             }
  207.         }
  208.         private static unsafe object x49cceb88e1b6126e(BinaryReader xe134235b3526fa75, Type x43163d22e8cd5a71, int x0ceec69a97f73617)
  209.         {
  210.             object obj2;
  211.             fixed (byte* numRef = xe134235b3526fa75.ReadBytes(x0ceec69a97f73617))
  212.             {
  213.                 obj2 = Marshal.PtrToStructure((IntPtr) numRef, x43163d22e8cd5a71);
  214.             }
  215.             return obj2;
  216.         }
  217.         public bool Ready
  218.         {
  219.             get
  220.             {
  221.                 return this.x6c7711ed04d2ac90;
  222.             }
  223.         }
  224.         public string SkinFile
  225.         {
  226.             get
  227.             {
  228.                 return this.x9fc8c6f4ce2be206;
  229.             }
  230.             set
  231.             {
  232.                 this.OnSkinFileChanged(value);
  233.             }
  234.         }
  235.         public string SkinPassword
  236.         {
  237.             get
  238.             {
  239.                 return this.x2de0dddab0e399a9;
  240.             }
  241.             set
  242.             {
  243.                 if (this.x2de0dddab0e399a9 != value)
  244.                 {
  245.                     this.x2de0dddab0e399a9 = value;
  246.                     this.SkinPasswordChanged();
  247.                 }
  248.             }
  249.         }
  250.         public Stream SkinStream
  251.         {
  252.             get
  253.             {
  254.                 return this.x6d84580748d50f45;
  255.             }
  256.             set
  257.             {
  258.                 this.OnSkinStreamChanged(value);
  259.             }
  260.         }
  261.     }
  262. }