Example #1
0
        DebugEntry AddEntry(string name, uint size)
        {
            var result = new DebugEntry()
            {
                Name          = name,
                RelativeIndex = (uint)Offset - (uint)_parentOffset + (uint)_reader.BaseStream.Position - size,
                AbsoluteIndex = (uint)Offset + (uint)_reader.BaseStream.Position - size,
                Size          = size,
                Indent        = Indent
            };
            var currentReadCount = (int)(_reader.BaseStream.Position);

            if (currentReadCount > ReadCount)
            {
                ReadCount = currentReadCount;
            }
            AddMember(result);
            return(result);
        }
        DebugEntry[] BuildUsedLookup()
        {
            var entries = Members.OfType <DebugEntry>();
            var used    = new DebugEntry[buffer.Length];

            foreach (var entry in entries)
            {
                for (var i = entry.AbsoluteIndex; i < entry.AbsoluteIndex + entry.Size; i++)
                {
                    if (used[i] == null)
                    {
                        used[i] = entry;
                    }
                    else if (entry.Indent > used[i].Indent)
                    {
                        used[i] = entry;
                    }
                }
            }
            return(used);
        }