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;
            }
            if (Indents.Count > 0)
            {
                Indents.Peek().Members.Add(result);
            }
            if (this != Root)
            {
                Members.Add(result);
            }
            Root.Members.Add(result);
            return(result);
        }
Example #2
0
        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);
        }