示例#1
0
        public static ResourceDirectoryEntry Parse(BinaryReader reader)
        {
            ResourceDirectoryEntry entry = new ResourceDirectoryEntry();

            entry.NameOffsetOrIntegerID = reader.ReadUInt32();
            uint isLeafAndOffset = reader.ReadUInt32();

            entry.IsDirectory = Convert.ToBoolean(isLeafAndOffset >> 31);
            entry.DataOffset  = (isLeafAndOffset & 0x7FFFFFFF);
            return(entry);
        }
        public static ResourceDirectoryTable Parse(BinaryReader reader)
        {
            ResourceDirectoryTable table = new ResourceDirectoryTable();

            table.Header = ResourceDirectoryTableHeader.Parse(reader);
            for (int index = 0; index < table.Header.NumberOfNameEntries; index++)
            {
                ResourceDirectoryEntry entry = ResourceDirectoryEntry.Parse(reader);
                table.NameEntries.Add(entry);
            }

            for (int index = 0; index < table.Header.NumberOfIDEntries; index++)
            {
                ResourceDirectoryEntry entry = ResourceDirectoryEntry.Parse(reader);
                table.IDEntries.Add(entry);
            }
            return(table);
        }