상속: Win32Resource
예제 #1
0
        public override void WriteTo(Stream s)
        {
            using (BinaryWriter w = new BinaryWriter(s)) {
                w.Write((short)0);
                w.Write((short)1);
                w.Write((short)icons.Length);
                for (int i = 0; i < icons.Length; ++i)
                {
                    Win32IconResource icon  = icons [i];
                    ICONDIRENTRY      entry = icon.Icon;

                    w.Write(entry.bWidth);
                    w.Write(entry.bHeight);
                    w.Write(entry.bColorCount);
                    w.Write((byte)0);
                    w.Write(entry.wPlanes);
                    w.Write(entry.wBitCount);
                    w.Write((int)entry.image.Length);
                    w.Write((short)icon.Name.Id);
                }
            }
        }
예제 #2
0
 public override void WriteTo(Stream s)
 {
     using (BinaryWriter binaryWriter = new BinaryWriter(s))
     {
         binaryWriter.Write(0);
         binaryWriter.Write(1);
         binaryWriter.Write((short)this.icons.Length);
         for (int i = 0; i < this.icons.Length; i++)
         {
             Win32IconResource win32IconResource = this.icons[i];
             ICONDIRENTRY      icon = win32IconResource.Icon;
             binaryWriter.Write(icon.bWidth);
             binaryWriter.Write(icon.bHeight);
             binaryWriter.Write(icon.bColorCount);
             binaryWriter.Write(0);
             binaryWriter.Write(icon.wPlanes);
             binaryWriter.Write(icon.wBitCount);
             binaryWriter.Write(icon.image.Length);
             binaryWriter.Write((short)win32IconResource.Name.Id);
         }
     }
 }
예제 #3
0
		/* 
		 * Mono extension to support /win32icon in mcs
		 */
		internal void DefineIconResource (string iconFileName)
		{
			if (iconFileName == null)
				throw new ArgumentNullException ("iconFileName");
			if (iconFileName.Length == 0)
				throw new ArgumentException ("iconFileName");
			if (!File.Exists (iconFileName) || Directory.Exists (iconFileName))
				throw new FileNotFoundException ("File '" + iconFileName + "' does not exists or is a directory.");

			using (FileStream fs = new FileStream (iconFileName, FileMode.Open, FileAccess.Read)) {
				Win32IconFileReader reader = new Win32IconFileReader (fs);
				
				ICONDIRENTRY[] entries = reader.ReadIcons ();

				Win32IconResource[] icons = new Win32IconResource [entries.Length];
				for (int i = 0; i < entries.Length; ++i) {
					icons [i] = new Win32IconResource (i + 1, 0, entries [i]);
					AddUnmanagedResource (icons [i]);
				}

				Win32GroupIconResource group = new Win32GroupIconResource (1, 0, icons);
				AddUnmanagedResource (group);
			}
		}
예제 #4
0
	public Win32GroupIconResource (int id, int language, Win32IconResource[] icons) : base (Win32ResourceType.RT_GROUP_ICON, id, language) {
		this.icons = icons;
	}