private void FindHeader(Image_Resource_Directory resourceDir) { int entryCount = resourceDir.NumberOfIdEntries + resourceDir.NumberOfNamedEntries; for (int i = 0; i < entryCount; i++) { Image_Resource_Directory_Entry entry = resourceDir.ImageResourceDirectoryEntries[i]; if ((entry.OffsetToData & 0x80000000) != 0) { Image_Resource_Directory child = (Image_Resource_Directory)entry.ChildEntry; FindHeader(child); } else { Image_Resource_Data_Entry data = (Image_Resource_Data_Entry)entry.ChildEntry; CURSOR_HEADER hd = new CURSOR_HEADER(data.Data); CURSOR_DIRECTORY[] cds = new CURSOR_DIRECTORY[hd.Count]; for (int j = 0; j < cds.Length; j++) { cds[j] = new CURSOR_DIRECTORY(data.Data, 6 + j * 14); if (cds[j].CursorID == this.ID) { Header = hd; Directory = cds[j]; return; } } } } }
public GROUP_CURSOR(byte[] buff) { Header = new CURSOR_HEADER(buff); Directories = new CURSOR_DIRECTORY[Header.Count]; for (int i = 0; i < Directories.Length; i++) { Directories[i] = new CURSOR_DIRECTORY(buff, 6 + i * 14); } }
public UInt32 ImageOffset; // 好像固定是24 public CURSOR_INFO_HEADER(CURSOR_DIRECTORY dir) { Width = dir.Width; Height = dir.Height; ColorCount = dir.ColorCount; Reserved = dir.Reserved; Planes = dir.Planes; BitCount = dir.BitCount; BytesInRes = dir.BytesInRes; ImageOffset = 24; }