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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using Sunisoft.IrisSkin.Design;
  4.     using Sunisoft.IrisSkin.InternalControls;
  5.     using System;
  6.     using System.Collections;
  7.     using System.ComponentModel;
  8.     using System.ComponentModel.Design.Serialization;
  9.     using System.Drawing;
  10.     using System.Drawing.Design;
  11.     using System.IO;
  12.     using System.Runtime.CompilerServices;
  13.     using System.Security.Cryptography;
  14.     using System.Text;
  15.     using System.Windows.Forms;
  16.     using x293b01486f981425;
  17.     [Serializable, ToolboxBitmap(typeof(SkinEngine), "SkinEngineIcon.bmp"), ToolboxItem(true), DesignerSerializer(typeof(x2f6133cd59233dfd), typeof(CodeDomSerializer))]
  18.     public class SkinEngine : Component
  19.     {
  20.         private string __build;
  21.         private bool active;
  22.         private SkinCollection addtionalBuiltInSkins;
  23.         private IntPtr backColorBrush;
  24.         private Hashtable bitmapList;
  25.         private int bottomBorderHeight;
  26.         private Hashtable brushList;
  27.         private bool builtIn;
  28.         internal static x6161963e817c3cff CbtProc;
  29.         private IntPtr controlBorderBrush;
  30.         private static Hashtable dialogList = new Hashtable();
  31.         private Hashtable disabledForm;
  32.         private int disableTag;
  33.         internal static DSACryptoServiceProvider DSA = new DSACryptoServiceProvider();
  34.         internal static byte[] DSAHash;
  35.         private bool enable3rdControl;
  36.         internal static SkinEngine Engine;
  37.         private int formCaptionPosX;
  38.         private int formCaptionPosY;
  39.         private int formMinWidth;
  40.         internal static IntPtr Hook = IntPtr.Zero;
  41.         private int leftBorderWidth;
  42.         private Font menuFont;
  43.         private int minTextWidth;
  44.         private Component owner;
  45.         private static System.Random ram = new System.Random();
  46.         private static int random = 0;
  47.         private x7f0ebae1a2d30adf reader;
  48.         private bool realActive;
  49.         private Sunisoft.IrisSkin.Res res;
  50.         private string resSysMenuClose;
  51.         private string resSysMenuMax;
  52.         private string resSysMenuMin;
  53.         private int rightBorderWidth;
  54.         private string serialNumber;
  55.         private bool skinAllForm;
  56.         private bool skinDialogs;
  57.         private string skinFile;
  58.         internal static ArrayList SkinHandleList = new ArrayList();
  59.         private string skinPassword;
  60.         private bool skinScrollBar;
  61.         private Stream skinStream;
  62.         private Stream skinStreamMain;
  63.         private Font titleFont;
  64.         private int titleHeight;
  65.         private static Hashtable windowList = new Hashtable();
  66.         public event SkinChanged CurrentSkinChanged;
  67.         static SkinEngine()
  68.         {
  69.             DSA.FromXmlString(string.Intern(x1110bdd110cdcea4._d574bb1a8f3e9cbc("nhjeciafoihfjhofaifghjmgikdhcikhkibicjiiijpifigjlfnjgfekhglkcfclhijlfeammghmpfomnhfngdmnpcdoockobgbpofipifppddgaecnabeebjdlbafccoejckcadnbhdeeodhbfehbmeopcfabkffbbgjphggapgjaghfpmhmbeigokikacjobjjibakkngkmaokioelhollapcmoojmgoanhphncapnbmfoipmoaodpjnkpbpbaimiakmpakkgbonnbmmecknlcjlcddljdlnaeenheeloeflffemmfoidggkkgjkbhaiihblphejgiljnimiejjjljahckhgjknhaljihlikolpffmgjmmdhdnpiknhhbomgioagpofhgpognpjeeadglamecbjejbfeacfdhcdfocodfdjdmdledefdkefgbfdeififpfocggoengafehjdlhoaciaejieeajmahjaeojmbfkbamkdddlmbklhbbmfbimacpmapfnmbnnpaeogalokpbpecjpmnppgngaaonamnebmmlbloccfnjcanadinhdmmodmofeaomemndfgnkfkkbgpnigikpgolghjnnhfneiglliokcjkkjjelaklnhkhmokhmflbnmlkmdmbmkmmjbnekinnkpnhhgohlnoiiepdjlpngcafkjafgabgkhbhjobngfcjimcifddhfkddibeagielgpeahgfeinfkgegpdlgpdchghjhndaibfhilgoiiefjmgmjgfdkhfkkhdblfdillcplaegmecnmhcennclndecocejojaapaahppdopddfamamamadbickbkoacpcicaapcdcgdkomdgodeopkelobfooifhbaggnggoongfbfhfamhcocifmjidpajnmhjgmojdmfkplmkpkdlemklilbmdlimnmpmpkgneonnmmeogllofjcpknjpnmaaoihakmoabmfbljmbgldcllkcambdhjidehpdbhgeogneeiefdklfokcgojjgnjahfghhkfohpjfijjmilidjdhkjmfbkkeikfgpkgfgljfnlodemcilmigcniejnagaocehoofooiefpbemphgdaedkakfbbaeibjcpbmegcebncpdedialdkacecejejeafbehffbofhcfgkdmgcbdhgakhbbbigciidcpigpfjpanjhbekonkkonblgbjlompldpgmjaomoafncamnhncolnjodnapknhpgpopeofadomacndbknkbnmbcekicgopcjkgdgkndckeecjlejlcfljjfgjagbkhgcjogcjfhpimhmidijikigibjfjijiipjfhgkcjnkkheljjllgicmohjmlganighnkfondjfongmoajdpigkpphbamgiapfpagfgbbinbkdeckglcdfcdgfjdadaejgheceoekcfflfmfegdgnfkgndbhdeihnephocgilbniiaejhdljfcckddjkbealcbhlnbolpafmocmmicdnjcknhcbohbioacpoabgplanpmodahokajnbbloibgaacfogclpncnmednlldfncegmjebmaffnhfeoofbofgnnmgeldhnmkhhkbicmiianpipmgjnmnjcnekdklknlclkkjlhjamkjhmnlomaifncmmnhldohhkohibpgjipekppmkgaminaagebgilbihccogjcogadpfhdlfodlefemgmelhdfihkfehbgleiggepghfghlgnhggeimgliodcjhgjjkgakaghkdgokbffllfmlecdmlckmhfbnkbinhbpndbgodanobcepfdlpadcagdjaiaabbdhbedobkcfcncmclbddfckdooaejohejnoeloffhpmfcodgjokgaachbbjhlophdpgilpnibafjooljemck", 0x54204941)));
  70.             DSAHash = Encoding.ASCII.GetBytes("IrisSkin is good !!!");
  71.         }
  72.         public SkinEngine()
  73.         {
  74.             this.active = true;
  75.             this.builtIn = true;
  76.             this.disableTag = 0x270f;
  77.             this.skinAllForm = true;
  78.             this.skinDialogs = true;
  79.             this.skinScrollBar = true;
  80.             this.formCaptionPosX = -1;
  81.             this.formCaptionPosY = -1;
  82.             this.serialNumber = "";
  83.             this.resSysMenuClose = "关闭(&C)";
  84.             this.resSysMenuMax = "最大化/还原(&X)";
  85.             this.resSysMenuMin = "最小化(&N)";
  86.             this.__build = "2006.08.16";
  87.             this.disabledForm = new Hashtable();
  88.             this.reader = new x7f0ebae1a2d30adf();
  89.             this.backColorBrush = IntPtr.Zero;
  90.             this.bitmapList = new Hashtable();
  91.             this.brushList = new Hashtable();
  92.             this.InternalConstructor();
  93.         }
  94.         public SkinEngine(Component owner)
  95.         {
  96.             this.active = true;
  97.             this.builtIn = true;
  98.             this.disableTag = 0x270f;
  99.             this.skinAllForm = true;
  100.             this.skinDialogs = true;
  101.             this.skinScrollBar = true;
  102.             this.formCaptionPosX = -1;
  103.             this.formCaptionPosY = -1;
  104.             this.serialNumber = "";
  105.             this.resSysMenuClose = "关闭(&C)";
  106.             this.resSysMenuMax = "最大化/还原(&X)";
  107.             this.resSysMenuMin = "最小化(&N)";
  108.             this.__build = "2006.08.16";
  109.             this.disabledForm = new Hashtable();
  110.             this.reader = new x7f0ebae1a2d30adf();
  111.             this.backColorBrush = IntPtr.Zero;
  112.             this.bitmapList = new Hashtable();
  113.             this.brushList = new Hashtable();
  114.             this.owner = owner;
  115.             this.InternalConstructor();
  116.         }
  117.         public SkinEngine(Component owner, Stream skinStream)
  118.         {
  119.             this.active = true;
  120.             this.builtIn = true;
  121.             this.disableTag = 0x270f;
  122.             this.skinAllForm = true;
  123.             this.skinDialogs = true;
  124.             this.skinScrollBar = true;
  125.             this.formCaptionPosX = -1;
  126.             this.formCaptionPosY = -1;
  127.             this.serialNumber = "";
  128.             this.resSysMenuClose = "关闭(&C)";
  129.             this.resSysMenuMax = "最大化/还原(&X)";
  130.             this.resSysMenuMin = "最小化(&N)";
  131.             this.__build = "2006.08.16";
  132.             this.disabledForm = new Hashtable();
  133.             this.reader = new x7f0ebae1a2d30adf();
  134.             this.backColorBrush = IntPtr.Zero;
  135.             this.bitmapList = new Hashtable();
  136.             this.brushList = new Hashtable();
  137.             this.owner = owner;
  138.             this.InternalConstructor();
  139.             this.SkinStream = skinStream;
  140.         }
  141.         public SkinEngine(Component owner, string skinFile)
  142.         {
  143.             this.active = true;
  144.             this.builtIn = true;
  145.             this.disableTag = 0x270f;
  146.             this.skinAllForm = true;
  147.             this.skinDialogs = true;
  148.             this.skinScrollBar = true;
  149.             this.formCaptionPosX = -1;
  150.             this.formCaptionPosY = -1;
  151.             this.serialNumber = "";
  152.             this.resSysMenuClose = "关闭(&C)";
  153.             this.resSysMenuMax = "最大化/还原(&X)";
  154.             this.resSysMenuMin = "最小化(&N)";
  155.             this.__build = "2006.08.16";
  156.             this.disabledForm = new Hashtable();
  157.             this.reader = new x7f0ebae1a2d30adf();
  158.             this.backColorBrush = IntPtr.Zero;
  159.             this.bitmapList = new Hashtable();
  160.             this.brushList = new Hashtable();
  161.             this.owner = owner;
  162.             this.InternalConstructor();
  163.             this.SkinFile = skinFile;
  164.         }
  165.         public void AddContextMenu(ContextMenu menu)
  166.         {
  167.             if (menu != null)
  168.             {
  169.                 new xa1883d0b59b7005b(this, menu);
  170.             }
  171.         }
  172.         public void AddContextMenuStrip(ContextMenuStrip menu)
  173.         {
  174.             if (menu != null)
  175.             {
  176.                 new x095234c5c1abb370(menu, Engine);
  177.             }
  178.         }
  179.         public void AddControl(Control control)
  180.         {
  181.             if (control != null)
  182.             {
  183.                 xf3f6919ac5d158dc.Create(control, Engine);
  184.             }
  185.         }
  186.         public void AddForm(Form form)
  187.         {
  188.             if ((form != null) && !form.IsDisposed)
  189.             {
  190.                 if (form.Created)
  191.                 {
  192.                     SkinHandleList.Add(form.Handle);
  193.                     this.DoAddWnd(form.Handle, true);
  194.                 }
  195.                 else
  196.                 {
  197.                     form.HandleCreated += new EventHandler(this.SkinFormHandleCreated);
  198.                 }
  199.             }
  200.         }
  201.         public void ApplyAdditionalBuiltInSkins(int count)
  202.         {
  203.             if (this.AddtionalBuiltInSkins.Count == 0)
  204.             {
  205.                 throw new ApplicationException("there is no addtional built in skin");
  206.             }
  207.             if ((count < 0) || (count > this.AddtionalBuiltInSkins.Count))
  208.             {
  209.                 throw new ArgumentOutOfRangeException("count", string.Format("count must equal to 0 or greater than 0 and less than {0}", this.AddtionalBuiltInSkins.Count));
  210.             }
  211.             this.reader.SkinPassword = this.AddtionalBuiltInSkins[count].SkinPassword;
  212.             this.SkinStream = this.AddtionalBuiltInSkins[count].SkinSteam;
  213.         }
  214.         public void ApplyMainBuiltInSkin()
  215.         {
  216.             this.reader.SkinPassword = this.skinPassword;
  217.             this.SkinStream = this.SkinStreamMain;
  218.         }
  219.         protected override void Dispose(bool disposing)
  220.         {
  221.             if (Hook != IntPtr.Zero)
  222.             {
  223.                 x61467fe65a98f20c.UnhookWindowsHookEx(Hook);
  224.                 Hook = IntPtr.Zero;
  225.             }
  226.             base.Dispose(disposing);
  227.         }
  228.         private void DoAddDlg(IntPtr handle, bool isManul)
  229.         {
  230.             if (!dialogList.ContainsKey(handle))
  231.             {
  232.                 dialogList.Add(handle, null);
  233.                 xb052c904ac95dc43 xbcacdc = new xb052c904ac95dc43(handle, this);
  234.                 dialogList[handle] = xbcacdc;
  235.             }
  236.         }
  237.         private void DoAddWnd(IntPtr handle, bool isManual)
  238.         {
  239.             Control control = Control.FromHandle(handle);
  240.             if (((((control is Form) && !windowList.ContainsKey(handle)) && (control.CompanyName != "9Rays.Net")) && (control.GetType().FullName != "XPTable.Editors.DropDownContainer")) && !(control is x4fef14ebf3863c7f))
  241.             {
  242.                 windowList.Add(handle, null);
  243.                 xa427f1b2281f554b xafbfb = new xa427f1b2281f554b(handle, this);
  244.                 windowList[handle] = xafbfb;
  245.             }
  246.         }
  247.         private static unsafe IntPtr FnHookProc(int nCode, IntPtr wParam, IntPtr lParam)
  248.         {
  249.             if (Engine != null)
  250.             {
  251.                 switch (nCode)
  252.                 {
  253.                     case 3:
  254.                     {
  255.                         StringBuilder lpClassName = new StringBuilder(260);
  256.                         x61467fe65a98f20c.GetClassName(wParam, lpClassName, 260);
  257.                         if ((lpClassName.Length != 9) || !(lpClassName.ToString().ToUpper() == "SCROLLBAR"))
  258.                         {
  259.                             break;
  260.                         }
  261.                         x40255b11ef821fa3.CBT_CREATEWND* cbt_createwndPtr = (x40255b11ef821fa3.CBT_CREATEWND*) lParam;
  262.                         x40255b11ef821fa3.CREATESTRUCT* lpcs = (x40255b11ef821fa3.CREATESTRUCT*) cbt_createwndPtr->lpcs;
  263.                         if ((((lpcs->style & 0x10L) != 0x10L) || !Engine.RealActive) || (lpcs->style > 0x56020014L))
  264.                         {
  265.                             break;
  266.                         }
  267.                         return new IntPtr(1);
  268.                     }
  269.                     case 5:
  270.                     {
  271.                         Control control = Control.FromHandle(wParam);
  272.                         if (control == null)
  273.                         {
  274.                             if (Engine.SkinDialogs)
  275.                             {
  276.                                 StringBuilder builder = new StringBuilder(260);
  277.                                 x61467fe65a98f20c.GetClassName(wParam, builder, 260);
  278.                                 if ((builder.Length == 6) && (builder.ToString() == "#32770"))
  279.                                 {
  280.                                     SkinHandleList.Add(wParam);
  281.                                     Engine.DoAddDlg(wParam, true);
  282.                                 }
  283.                             }
  284.                             break;
  285.                         }
  286.                         if (!Engine.SkinAllForm)
  287.                         {
  288.                             if (((Engine.Owner is Form) && (control.GetType() == Engine.Owner.GetType())) && !SkinHandleList.Contains(wParam))
  289.                             {
  290.                                 SkinHandleList.Add(wParam);
  291.                                 Engine.DoAddWnd(wParam, false);
  292.                             }
  293.                             break;
  294.                         }
  295.                         if (!SkinHandleList.Contains(wParam) && (control is Form))
  296.                         {
  297.                             SkinHandleList.Add(wParam);
  298.                             Engine.DoAddWnd(wParam, false);
  299.                         }
  300.                         break;
  301.                     }
  302.                 }
  303.             }
  304.             return x61467fe65a98f20c.CallNextHookEx(Hook, nCode, wParam, lParam);
  305.         }
  306.         public Bitmap GetBitmap(string key)
  307.         {
  308.             if (this.bitmapList.ContainsKey(key))
  309.             {
  310.                 return (Bitmap) this.bitmapList[key];
  311.             }
  312.             Bitmap bitmap = this.reader.GetBitmap(key);
  313.             if (bitmap != null)
  314.             {
  315.                 bitmap.MakeTransparent(this.GetColor("SKIN2_TRANSCOLOR"));
  316.             }
  317.             this.bitmapList.Add(key, bitmap);
  318.             return bitmap;
  319.         }
  320.         public Bitmap GetBitmap(string key, int spitCount, int spitIndex)
  321.         {
  322.             string str = string.Format("{0}{1}OF{2}", key, spitIndex, spitCount);
  323.             if (this.bitmapList.ContainsKey(str))
  324.             {
  325.                 return (Bitmap) this.bitmapList[str];
  326.             }
  327.             Bitmap bitmap = this.reader.GetBitmap(key, spitCount, spitIndex);
  328.             if (bitmap != null)
  329.             {
  330.                 bitmap.MakeTransparent(this.GetColor("SKIN2_TRANSCOLOR"));
  331.             }
  332.             this.bitmapList.Add(str, bitmap);
  333.             return bitmap;
  334.         }
  335.         public bool GetBool(string key)
  336.         {
  337.             return this.reader.GetBool(key);
  338.         }
  339.         public Brush GetBrush(string key)
  340.         {
  341.             if (this.brushList.ContainsKey(key))
  342.             {
  343.                 return (Brush) this.brushList[key];
  344.             }
  345.             Brush brush = new SolidBrush(this.reader.GetColor(key));
  346.             this.brushList.Add(key, brush);
  347.             return brush;
  348.         }
  349.         public Color GetColor(string key)
  350.         {
  351.             return this.reader.GetColor(key);
  352.         }
  353.         public int GetInt(string key)
  354.         {
  355.             return this.reader.GetInt(key);
  356.         }
  357.         private void InternalConstructor()
  358.         {
  359.             this.addtionalBuiltInSkins = new SkinCollection();
  360.             if (!IsDesignModel)
  361.             {
  362.                 if (Engine == null)
  363.                 {
  364.                     Engine = this;
  365.                     if (Hook == IntPtr.Zero)
  366.                     {
  367.                         CbtProc = new x6161963e817c3cff(SkinEngine.FnHookProc);
  368.                         Hook = x61467fe65a98f20c.SetWindowsHookEx(5, CbtProc, 0, AppDomain.GetCurrentThreadId());
  369.                         Application.ApplicationExit += new EventHandler(SkinEngine.OnApplicationExit);
  370.                     }
  371.                 }
  372.                 else if (this.owner is Form)
  373.                 {
  374.                     Form owner = (Form) this.owner;
  375.                     if (owner.Created)
  376.                     {
  377.                         SkinHandleList.Add(owner.Handle);
  378.                         this.DoAddWnd(owner.Handle, true);
  379.                     }
  380.                     else
  381.                     {
  382.                         owner.HandleCreated += new EventHandler(this.SkinFormHandleCreated);
  383.                     }
  384.                 }
  385.             }
  386.         }
  387.         protected virtual void OnActiveChanged()
  388.         {
  389.             if (!IsDesignModel)
  390.             {
  391.                 if (this.reader != null)
  392.                 {
  393.                     this.realActive = this.reader.Ready & this.active;
  394.                 }
  395.                 else
  396.                 {
  397.                     this.realActive = false;
  398.                 }
  399.                 this.OnCurrentSkinChanged();
  400.             }
  401.         }
  402.         private static void OnApplicationExit(object sender, EventArgs e)
  403.         {
  404.             Engine.Dispose(false);
  405.         }
  406.         protected virtual void OnBuiltInChanged(bool builtIn)
  407.         {
  408.             if (builtIn)
  409.             {
  410.                 this.SetBuiltInSkinFile(this.SkinFile);
  411.                 this.builtIn = true;
  412.             }
  413.             else
  414.             {
  415.                 this.builtIn = false;
  416.                 if (IsDesignModel)
  417.                 {
  418.                     this.SkinStreamMain = null;
  419.                 }
  420.             }
  421.         }
  422.         protected virtual void OnCurrentSkinChanged()
  423.         {
  424.             this.bitmapList = new Hashtable();
  425.             this.brushList = new Hashtable();
  426.             if (this.RealActive)
  427.             {
  428.                 this.PrepareResources();
  429.                 Bitmap image = this.Res.Bitmaps.SKIN2_TITLEBAR1;
  430.                 this.titleHeight = image.Height;
  431.                 image = this.Res.Bitmaps.SKIN2_FORMLEFTBORDER;
  432.                 this.leftBorderWidth = image.Width;
  433.                 image = this.Res.Bitmaps.SKIN2_FORMRIGHTBORDER;
  434.                 this.rightBorderWidth = image.Width;
  435.                 image = this.Res.Bitmaps.SKIN2_FORMBOTTOMBORDER1;
  436.                 this.bottomBorderHeight = image.Height;
  437.                 this.formMinWidth = 0;
  438.                 this.formMinWidth += this.leftBorderWidth + this.rightBorderWidth;
  439.                 if (this.Res.Bools.SKIN2_TITLEFIVESECT)
  440.                 {
  441.                     Font captionFont;
  442.                     image = this.Res.Bitmaps.SKIN2_TITLEBAR1;
  443.                     this.formMinWidth += image.Width;
  444.                     image = this.Res.Bitmaps.SKIN2_TITLEBAR3;
  445.                     this.formMinWidth += image.Width;
  446.                     if (this.TitleFont == null)
  447.                     {
  448.                         captionFont = x448fd9ab43628c71.GetCaptionFont();
  449.                     }
  450.                     else
  451.                     {
  452.                         captionFont = this.TitleFont;
  453.                     }
  454.                     using (Graphics graphics = Graphics.FromImage(image))
  455.                     {
  456.                         this.minTextWidth = graphics.MeasureString("W...", captionFont).ToSize().Width;
  457.                     }
  458.                     this.formMinWidth += (this.minTextWidth + this.Res.Integers.SKIN2_TITLEBARICONPOSX) + 40;
  459.                     this.formMinWidth = Math.Max(this.formMinWidth, 100);
  460.                 }
  461.                 else
  462.                 {
  463.                     image = this.Res.Bitmaps.SKIN2_TITLEBAR1;
  464.                     this.formMinWidth = image.Width;
  465.                     image = this.Res.Bitmaps.SKIN2_TITLEBAR3;
  466.                     this.formMinWidth += image.Width;
  467.                     this.formMinWidth = Math.Max(this.formMinWidth, 100);
  468.                 }
  469.             }
  470.             if (this.CurrentSkinChanged != null)
  471.             {
  472.                 this.CurrentSkinChanged(this, new SkinChangedEventArgs(this.RealActive));
  473.             }
  474.         }
  475.         protected virtual void OnMainSkinStreamChanged(Stream stream)
  476.         {
  477.             if (stream == null)
  478.             {
  479.                 this.realActive = false;
  480.             }
  481.             else
  482.             {
  483.                 this.reader.SkinStream = stream;
  484.                 this.realActive = this.reader.Ready & this.active;
  485.             }
  486.             this.skinStreamMain = stream;
  487.             this.OnCurrentSkinChanged();
  488.         }
  489.         protected virtual void OnSkinAllFormChanged()
  490.         {
  491.         }
  492.         protected virtual void OnSkinFileChanged(string fileName)
  493.         {
  494.             if (this.BuiltIn && IsDesignModel)
  495.             {
  496.                 this.SetBuiltInSkinFile(fileName);
  497.             }
  498.             else
  499.             {
  500.                 this.SetSkinFile(fileName);
  501.             }
  502.         }
  503.         protected virtual void OnSkinStreamChanged(Stream skinStream)
  504.         {
  505.             if (skinStream == null)
  506.             {
  507.                 this.realActive = false;
  508.             }
  509.             else
  510.             {
  511.                 this.reader.SkinStream = skinStream;
  512.                 this.realActive = this.reader.Ready & this.active;
  513.             }
  514.             this.OnCurrentSkinChanged();
  515.         }
  516.         private void PrepareResources()
  517.         {
  518.             if (this.res != null)
  519.             {
  520.                 this.res.Dispose();
  521.             }
  522.             this.res = null;
  523.             this.res = new Sunisoft.IrisSkin.Res(this);
  524.             if (this.backColorBrush != IntPtr.Zero)
  525.             {
  526.                 x31775329b2a4ff52.DeleteObject(this.backColorBrush);
  527.             }
  528.             x1439a41cfa24189f.LOGBRUSH brush = new x1439a41cfa24189f.LOGBRUSH();
  529.             uint @int = (uint) this.GetInt("SKIN2_FORMCOLOR");
  530.             if ((@int & 0xff000000) == 0xff000000)
  531.             {
  532.                 @int = (uint) x61467fe65a98f20c.GetSysColor(((int) @int) & 0xff);
  533.             }
  534.             brush.lbColor = @int;
  535.             brush.lbStyle = 0;
  536.             this.backColorBrush = x31775329b2a4ff52.CreateBrushIndirect(ref brush);
  537.             if (this.controlBorderBrush != IntPtr.Zero)
  538.             {
  539.                 x31775329b2a4ff52.DeleteObject(this.controlBorderBrush);
  540.             }
  541.             brush = new x1439a41cfa24189f.LOGBRUSH();
  542.             @int = (uint) this.GetInt("SKIN2_CONTROLBORDERCOLOR");
  543.             if ((@int & 0xff000000) == 0xff000000)
  544.             {
  545.                 @int = (uint) x61467fe65a98f20c.GetSysColor(((int) @int) & 0xff);
  546.             }
  547.             brush.lbColor = @int;
  548.             brush.lbStyle = 0;
  549.             this.controlBorderBrush = x31775329b2a4ff52.CreateBrushIndirect(ref brush);
  550.         }
  551.         public void RemoveForm(Form form, bool includeControls)
  552.         {
  553.             if ((form != null) && !form.IsDisposed)
  554.             {
  555.                 IntPtr handle = form.Handle;
  556.                 if (windowList.Contains(handle) && (windowList[handle] is xd24df615efe9450e))
  557.                 {
  558.                     ((xd24df615efe9450e) windowList[handle]).x52b190e626f65140(includeControls);
  559.                     windowList.Remove(handle);
  560.                 }
  561.             }
  562.         }
  563.         public void ResetMainMenu(Form form)
  564.         {
  565.             if ((form != null) && !form.IsDisposed)
  566.             {
  567.                 x61467fe65a98f20c.SendMessage(form.Handle, 0x20d3, (uint) 0x20d3, (uint) 0);
  568.             }
  569.         }
  570.         public void SetBrush(string key, Brush b)
  571.         {
  572.             this.brushList.Add(key, b);
  573.         }
  574.         private void SetBuiltInSkinFile(string file)
  575.         {
  576.             if ((file == null) || (file == ""))
  577.             {
  578.                 this.skinStreamMain = null;
  579.                 this.realActive = false;
  580.                 this.skinFile = file;
  581.             }
  582.             else
  583.             {
  584.                 try
  585.                 {
  586.                     this.Reader.SkinFile = file;
  587.                     FileStream input = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);
  588.                     BinaryReader reader = new BinaryReader(input);
  589.                     this.skinStreamMain = new MemoryStream(reader.ReadBytes((int) input.Length));
  590.                     reader.Close();
  591.                     this.skinFile = file;
  592.                     this.realActive = this.Reader.Ready & this.active;
  593.                 }
  594.                 catch
  595.                 {
  596.                 }
  597.             }
  598.         }
  599.         private void SetSkinFile(string file)
  600.         {
  601.             try
  602.             {
  603.                 this.Reader.SkinFile = file;
  604.             }
  605.             catch (Exception exception)
  606.             {
  607.                 Console.WriteLine(exception.Message);
  608.             }
  609.             this.skinFile = file;
  610.             this.realActive = this.Reader.Ready & this.active;
  611.             this.OnCurrentSkinChanged();
  612.         }
  613.         private void SkinFormHandleCreated(object sender, EventArgs e)
  614.         {
  615.             if (sender is Form)
  616.             {
  617.                 Form form = (Form) sender;
  618.                 SkinHandleList.Add(form.Handle);
  619.                 this.DoAddWnd(form.Handle, true);
  620.             }
  621.         }
  622.         [Browsable(false), DefaultValue("2006.08.16")]
  623.         public string __Build
  624.         {
  625.             get
  626.             {
  627.                 return this.__build;
  628.             }
  629.         }
  630.         [Category("Behavior"), DefaultValue(true), Description("If the skin engine skin all .NET forms")]
  631.         public bool Active
  632.         {
  633.             get
  634.             {
  635.                 return this.active;
  636.             }
  637.             set
  638.             {
  639.                 this.active = value;
  640.                 this.OnActiveChanged();
  641.             }
  642.         }
  643.         [DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Build more skins into the EXE file"), Category("Skins")]
  644.         public SkinCollection AddtionalBuiltInSkins
  645.         {
  646.             get
  647.             {
  648.                 return this.addtionalBuiltInSkins;
  649.             }
  650.         }
  651.         internal IntPtr BackColorBrush
  652.         {
  653.             get
  654.             {
  655.                 return this.backColorBrush;
  656.             }
  657.         }
  658.         internal int BottomBorderHeight
  659.         {
  660.             get
  661.             {
  662.                 return this.bottomBorderHeight;
  663.             }
  664.         }
  665.         [Category("Skins"), DefaultValue(true), Description("Specifies whether build the skin file into the EXE file.")]
  666.         public bool BuiltIn
  667.         {
  668.             get
  669.             {
  670.                 return this.builtIn;
  671.             }
  672.             set
  673.             {
  674.                 if (this.builtIn != value)
  675.                 {
  676.                     this.OnBuiltInChanged(value);
  677.                 }
  678.             }
  679.         }
  680.         internal IntPtr ControlBorderBrush
  681.         {
  682.             get
  683.             {
  684.                 return this.controlBorderBrush;
  685.             }
  686.         }
  687.         internal Hashtable DisabledForm
  688.         {
  689.             get
  690.             {
  691.                 return this.disabledForm;
  692.             }
  693.         }
  694.         [DefaultValue(0x270f), Category("Behavior"), Description("If you do not want skin the control, Set Control's Tag property to this")]
  695.         public int DisableTag
  696.         {
  697.             get
  698.             {
  699.                 return this.disableTag;
  700.             }
  701.             set
  702.             {
  703.                 this.disableTag = value;
  704.             }
  705.         }
  706.         [Description("Enable/Disable skin 3rd controls"), DefaultValue(false), Category("Behavior")]
  707.         public bool Enable3rdControl
  708.         {
  709.             get
  710.             {
  711.                 return this.enable3rdControl;
  712.             }
  713.             set
  714.             {
  715.                 this.enable3rdControl = value;
  716.             }
  717.         }
  718.         [DefaultValue(-1), Category("Behavior"), Description("Force to specifies the position of the caption on title bar. In general, the position is an auto-position defined in a skin")]
  719.         public int FormCaptionPosX
  720.         {
  721.             get
  722.             {
  723.                 return this.formCaptionPosX;
  724.             }
  725.             set
  726.             {
  727.                 this.formCaptionPosX = value;
  728.             }
  729.         }
  730.         [Description("Force to specifies the position of the caption on title bar. In general, the position is an auto-position defined in a skin"), DefaultValue(-1), Category("Behavior")]
  731.         public int FormCaptionPosY
  732.         {
  733.             get
  734.             {
  735.                 return this.formCaptionPosY;
  736.             }
  737.             set
  738.             {
  739.                 this.formCaptionPosY = value;
  740.             }
  741.         }
  742.         internal int FormMinWidth
  743.         {
  744.             get
  745.             {
  746.                 return this.formMinWidth;
  747.             }
  748.         }
  749.         private static bool IsDesignModel
  750.         {
  751.             get
  752.             {
  753.                 string fileName = Path.GetFileName(Application.ExecutablePath);
  754.                 if ((fileName == null) || (fileName.Length != 10))
  755.                 {
  756.                     return false;
  757.                 }
  758.                 if (fileName.ToUpper() != "DEVENV.EXE")
  759.                 {
  760.                     return false;
  761.                 }
  762.                 return true;
  763.             }
  764.         }
  765.         internal int LeftBorderWidth
  766.         {
  767.             get
  768.             {
  769.                 return this.leftBorderWidth;
  770.             }
  771.         }
  772.         [DefaultValue((string) null), Category("Font"), Description("Specifies the font of the main menu on the skinned forms")]
  773.         public Font MenuFont
  774.         {
  775.             get
  776.             {
  777.                 return this.menuFont;
  778.             }
  779.             set
  780.             {
  781.                 this.menuFont = value;
  782.             }
  783.         }
  784.         internal int MinTextWidth
  785.         {
  786.             get
  787.             {
  788.                 return this.minTextWidth;
  789.             }
  790.         }
  791.         [Browsable(false)]
  792.         public Component Owner
  793.         {
  794.             get
  795.             {
  796.                 return this.owner;
  797.             }
  798.         }
  799.         internal static int Random
  800.         {
  801.             get
  802.             {
  803.                 if (SkinEngine.random == 0)
  804.                 {
  805.                     SkinEngine.random = 0xc350;
  806.                 }
  807.                 else
  808.                 {
  809.                     SkinEngine.random = ram.Next(0xc351);
  810.                 }
  811.                 int random = SkinEngine.random;
  812.                 SkinEngine.random++;
  813.                 return random;
  814.             }
  815.         }
  816.         internal x7f0ebae1a2d30adf Reader
  817.         {
  818.             get
  819.             {
  820.                 return this.reader;
  821.             }
  822.         }
  823.         internal bool RealActive
  824.         {
  825.             get
  826.             {
  827.                 return this.realActive;
  828.             }
  829.         }
  830.         [Browsable(false)]
  831.         public Sunisoft.IrisSkin.Res Res
  832.         {
  833.             get
  834.             {
  835.                 return this.res;
  836.             }
  837.         }
  838.         [Description("Specifies the text for the close menu item in the system menu"), DefaultValue("关闭(&C)"), Category("Misc")]
  839.         public string ResSysMenuClose
  840.         {
  841.             get
  842.             {
  843.                 return this.resSysMenuClose;
  844.             }
  845.             set
  846.             {
  847.                 this.resSysMenuClose = value;
  848.             }
  849.         }
  850.         [Description("Specifies the text for the maximize/restore menu item in the system menu"), Category("Misc"), DefaultValue("最大化/还原(&X)")]
  851.         public string ResSysMenuMax
  852.         {
  853.             get
  854.             {
  855.                 return this.resSysMenuMax;
  856.             }
  857.             set
  858.             {
  859.                 this.resSysMenuMax = value;
  860.             }
  861.         }
  862.         [DefaultValue("最小化(&N)"), Category("Misc"), Description("Specifies the text for the minimize menu item in the system menu")]
  863.         public string ResSysMenuMin
  864.         {
  865.             get
  866.             {
  867.                 return this.resSysMenuMin;
  868.             }
  869.             set
  870.             {
  871.                 this.resSysMenuMin = value;
  872.             }
  873.         }
  874.         internal int RightBorderWidth
  875.         {
  876.             get
  877.             {
  878.                 return this.rightBorderWidth;
  879.             }
  880.         }
  881.         [DefaultValue(" "), Category("Misc"), Description("Input the serial number hear to built the skin without registry infomation")]
  882.         public string SerialNumber
  883.         {
  884.             get
  885.             {
  886.                 return this.serialNumber;
  887.             }
  888.             set
  889.             {
  890.                 this.serialNumber = value;
  891.             }
  892.         }
  893.         [Description("If the skin engine skin all .NET forms"), DefaultValue(true), Category("Behavior")]
  894.         public bool SkinAllForm
  895.         {
  896.             get
  897.             {
  898.                 return this.skinAllForm;
  899.             }
  900.             set
  901.             {
  902.                 this.skinAllForm = value;
  903.                 this.OnSkinAllFormChanged();
  904.             }
  905.         }
  906.         [Category("Behavior"), Description("If the skin engine skin the dialogs"), DefaultValue(true)]
  907.         public bool SkinDialogs
  908.         {
  909.             get
  910.             {
  911.                 return this.skinDialogs;
  912.             }
  913.             set
  914.             {
  915.                 this.skinDialogs = value;
  916.             }
  917.         }
  918.         [Description("Specifies the skin file(.sui file). "), Editor(typeof(x1cc8dd3ebd3495cd), typeof(UITypeEditor)), Category("Skins")]
  919.         public string SkinFile
  920.         {
  921.             get
  922.             {
  923.                 return this.skinFile;
  924.             }
  925.             set
  926.             {
  927.                 this.OnSkinFileChanged(value);
  928.             }
  929.         }
  930.         [DefaultValue((string) null), Description("Specifies the password of the skinFile"), Category("Skins")]
  931.         public string SkinPassword
  932.         {
  933.             get
  934.             {
  935.                 return this.skinPassword;
  936.             }
  937.             set
  938.             {
  939.                 this.reader.SkinPassword = value;
  940.                 this.skinPassword = value;
  941.             }
  942.         }
  943.         [DefaultValue(true), Description("If the skin engine skin the Scroll bar of a control"), Category("Behavior")]
  944.         public bool SkinScrollBar
  945.         {
  946.             get
  947.             {
  948.                 return this.skinScrollBar;
  949.             }
  950.             set
  951.             {
  952.                 this.skinScrollBar = value;
  953.             }
  954.         }
  955.         [Browsable(false), DefaultValue((string) null)]
  956.         public Stream SkinStream
  957.         {
  958.             get
  959.             {
  960.                 return this.skinStream;
  961.             }
  962.             set
  963.             {
  964.                 this.OnSkinStreamChanged(value);
  965.             }
  966.         }
  967.         [Browsable(false), DefaultValue((string) null)]
  968.         public Stream SkinStreamMain
  969.         {
  970.             get
  971.             {
  972.                 return this.skinStreamMain;
  973.             }
  974.             set
  975.             {
  976.                 this.OnMainSkinStreamChanged(value);
  977.             }
  978.         }
  979.         [DefaultValue((string) null), Category("Font"), Description("Specifies the title font of the skinned forms")]
  980.         public Font TitleFont
  981.         {
  982.             get
  983.             {
  984.                 return this.titleFont;
  985.             }
  986.             set
  987.             {
  988.                 this.titleFont = value;
  989.             }
  990.         }
  991.         internal int TitleHeight
  992.         {
  993.             get
  994.             {
  995.                 return this.titleHeight;
  996.             }
  997.         }
  998.         [Category("Version"), Description("Current version of IrisSkin")]
  999.         public string Version
  1000.         {
  1001.             get
  1002.             {
  1003.                 return "3.2";
  1004.             }
  1005.         }
  1006.     }
  1007. }