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

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin
  2. {
  3.     using Sunisoft.IrisSkin.Design;
  4.     using System;
  5.     using System.ComponentModel;
  6.     using System.Drawing;
  7.     using System.Drawing.Design;
  8.     using System.IO;
  9.     [Serializable, TypeConverter(typeof(TypeConverter)), ToolboxBitmap(typeof(SkinEngine), "ItemIcon.bmp"), ToolboxItem(false)]
  10.     public class SkinCollectionItem : Component
  11.     {
  12.         [NonSerialized]
  13.         private x7f0ebae1a2d30adf reader;
  14.         private string skinFile;
  15.         private MemoryStream skinStream;
  16.         public SkinCollectionItem()
  17.         {
  18.             this.reader = new x7f0ebae1a2d30adf();
  19.         }
  20.         public SkinCollectionItem(string fileName)
  21.         {
  22.             this.reader = new x7f0ebae1a2d30adf();
  23.             this.SkinFile = fileName;
  24.         }
  25.         protected void OnSkinFileChanged(string file)
  26.         {
  27.             if ((file == null) || (file == ""))
  28.             {
  29.                 this.skinStream = null;
  30.             }
  31.             else
  32.             {
  33.                 try
  34.                 {
  35.                     this.reader.SkinFile = file;
  36.                     FileStream input = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);
  37.                     BinaryReader reader = new BinaryReader(input);
  38.                     this.skinStream = new MemoryStream(reader.ReadBytes((int) input.Length));
  39.                     reader.Close();
  40.                     this.skinFile = file;
  41.                 }
  42.                 catch
  43.                 {
  44.                 }
  45.             }
  46.         }
  47.         [DesignOnly(true), Category("Skins"), Description("Specifies the skin file(.sui file). "), Editor(typeof(x1cc8dd3ebd3495cd), typeof(UITypeEditor))]
  48.         public string SkinFile
  49.         {
  50.             get
  51.             {
  52.                 return this.skinFile;
  53.             }
  54.             set
  55.             {
  56.                 if (this.skinFile != value)
  57.                 {
  58.                     this.OnSkinFileChanged(value);
  59.                 }
  60.             }
  61.         }
  62.         [Description("Specifies the password of the skinFile"), Category("Skins"), DefaultValue("")]
  63.         public string SkinPassword
  64.         {
  65.             get
  66.             {
  67.                 return this.reader.SkinPassword;
  68.             }
  69.             set
  70.             {
  71.                 this.reader.SkinPassword = value;
  72.             }
  73.         }
  74.         [Browsable(false)]
  75.         public MemoryStream SkinSteam
  76.         {
  77.             get
  78.             {
  79.                 return this.skinStream;
  80.             }
  81.             set
  82.             {
  83.                 this.skinStream = value;
  84.             }
  85.         }
  86.     }
  87. }