Example #1
0
        private void LoadHeaps(uint startOffset)
        {
            // heap headers
            int n       = _reader.ReadUInt16();
            var headers = Enumerable
                          .Range(0, n)
                          .Select(x =>
                                  new
            {
                Offset = startOffset + _reader.ReadUInt32(),
                Size   = _reader.ReadUInt32(),
                Name   = _reader.ReadAlignedString(16)
            })
                          .ToList();

            headers.ForEach(h =>
            {
                switch (h.Name)
                {
                case "#-":
                case "#~":
                    _reader.Position = h.Offset;
                    CreateTables();
                    break;

                case "#Strings":
                    _strings = new StringHeap(_reader.Slice(h.Offset, h.Size));
                    break;

                case "#US":
                    _userStrings = new UserStringHeap(_reader.Slice(h.Offset, h.Size));
                    break;

                case "#GUID":
                    _guids = new GuidHeap(_reader.Slice(h.Offset, h.Size));
                    break;

                case "#Blob":
                    _blob = new BlobHeap(_reader.Slice(h.Offset, h.Size));
                    break;
                }
            });
        }