private void ReadResourceTable() { _resources = new Dictionary<uint, List<ResourceInfo>>(); using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader)) { long numRead = 0; while (numRead < s.Length) { byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size); numRead += ResourceInfo.Size; ResourceInfo info = new ResourceInfo(); info.Read(resBuffer, 0); uint hashHash = Utilities.ToUInt32LittleEndian(info.Hash, 0); if (!_resources.ContainsKey(hashHash)) { _resources[hashHash] = new List<ResourceInfo>(1); } _resources[hashHash].Add(info); } } }
internal ShortResourceHeader LocateImage(int index) { int i = 0; using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader)) { long numRead = 0; while (numRead < s.Length) { byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size); numRead += ResourceInfo.Size; ResourceInfo info = new ResourceInfo(); info.Read(resBuffer, 0); if ((info.Header.Flags & ResourceFlags.MetaData) != 0) { if (i == index) { return info.Header; } ++i; } } } return null; }