示例#1
0
        public override Size Draw(DrawContext context, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;
            var origY = y;

            AddSelection(context, x, y, context.Font.Height);

            x = AddOpenCloseIcon(context, x, y);
            x = AddIcon(context, x, y, context.IconProvider.VirtualTable, HotSpot.NoneId, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.VTableColor, HotSpot.NoneId, $"VTable[{Nodes.Count}]") + context.Font.Width;
            if (!IsWrapped)
            {
                x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
            }

            x = AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level])
            {
                var ptr = context.Memory.ReadIntPtr(Offset);

                memory.Size = Nodes.Count * IntPtr.Size;
                memory.UpdateFrom(context.Process, ptr);

                var innerContext = context.Clone();
                innerContext.Address = ptr;
                innerContext.Memory  = memory;

                foreach (var node in Nodes)
                {
                    var innerSize = node.Draw(innerContext, tx, y);

                    size.Width   = Math.Max(size.Width, innerSize.Width + tx - origX);
                    size.Height += innerSize.Height;

                    y += innerSize.Height;
                }
            }

            return(size);
        }
示例#2
0
        protected override Size DrawChild(DrawContext context, int x, int y)
        {
            var innerContext = context.Clone();

            innerContext.Address        = context.Address + Offset + InnerNode.MemorySize * CurrentIndex;
            innerContext.Memory         = context.Memory.Clone();
            innerContext.Memory.Offset += Offset + InnerNode.MemorySize * CurrentIndex;

            return(InnerNode.Draw(innerContext, x, y));
        }
示例#3
0
        public override Size Draw(DrawContext context, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;
            var origY = y;

            AddSelection(context, x, y, context.Font.Height);

            x = AddOpenCloseIcon(context, x, y);
            x = AddIcon(context, x, y, context.IconProvider.Union, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Union") + context.Font.Width;

            x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[Nodes: {Nodes.Count}, Size: {MemorySize}]") + context.Font.Width;

            x = AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level])
            {
                var innerContext = context.Clone();
                innerContext.Settings = Program.Settings.Clone();
                innerContext.Settings.ShowNodeAddress = false;
                innerContext.Address        = context.Address + Offset;
                innerContext.Memory         = context.Memory.Clone();
                innerContext.Memory.Offset += Offset;

                foreach (var node in Nodes)
                {
                    var innerSize = node.Draw(innerContext, tx, y);

                    size.Width   = Math.Max(size.Width, innerSize.Width + tx - origX);
                    size.Height += innerSize.Height;

                    y += innerSize.Height;
                }
            }

            return(size);
        }
示例#4
0
        public override Size Draw(DrawContext context, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;
            var origY = y;

            AddSelection(context, x, y, context.Font.Height);

            x = AddOpenCloseIcon(context, x, y);
            x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Instance") + context.Font.Width;
            if (!IsWrapped)
            {
                x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
            }
            x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + context.Font.Width;
            x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeClassType) + context.Font.Width;

            x = AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level])
            {
                var innerContext = context.Clone();
                innerContext.Address        = context.Address + Offset;
                innerContext.Memory         = context.Memory.Clone();
                innerContext.Memory.Offset += Offset;

                var innerSize = InnerNode.Draw(innerContext, tx, y);
                size.Width   = Math.Max(size.Width, innerSize.Width + tx - origX);
                size.Height += innerSize.Height;
            }

            return(size);
        }
示例#5
0
        public override int CalculateDrawnHeight(DrawContext context)
        {
            if (IsHidden)
            {
                return(HiddenHeight);
            }

            var height = context.Font.Height;

            if (LevelsOpen[context.Level])
            {
                var nv = context.Clone();
                nv.Level++;
                height += Nodes.Sum(n => n.CalculateDrawnHeight(nv));
            }
            return(height);
        }
示例#6
0
        protected override Size DrawChild(DrawContext context, int x, int y)
        {
            var ptr = context.Memory.ReadIntPtr(Offset);

            if (!ptr.IsNull())
            {
                ptr = context.Process.ReadRemoteIntPtr(ptr + CurrentIndex * IntPtr.Size);
            }

            memory.Size = InnerNode.MemorySize;
            memory.UpdateFrom(context.Process, ptr);

            var innerContext = context.Clone();

            innerContext.Address = ptr;
            innerContext.Memory  = memory;

            return(InnerNode.Draw(innerContext, x, y));
        }
示例#7
0
        public XDocument ToSvg(List <CadFigure> figList, DrawContext currentDC, double width, double height)
        {
            DrawContext dc = currentDC.Clone();

            dc.SetViewSize(width, height);
            dc.SetViewOrg(new Vector3d(width / 2, height / 2, 0));
            dc.UnitPerMilli = 1;

            XDocument doc = new XDocument();

            doc.Add(DocType);

            XElement root = CreateRoot(width, height);

            AddFiguresToElement(root, figList, dc, width, height);

            doc.Add(root);
            return(doc);
        }
        public override Size Draw(DrawContext context, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;
            var origY = y;

            AddSelection(context, x, y, context.Font.Height);

            x = AddOpenCloseIcon(context, x, y);
            x = AddIcon(context, x, y, context.IconProvider.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "WeakPtr") + context.Font.Width;
            x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
            x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>");
            x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeClassType);

            x += context.Font.Width;

            AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level])
            {
                var ptr = context.Memory.ReadIntPtr(Offset);
                if (!ptr.IsNull())
                {
                    ptr = context.Process.ReadRemoteIntPtr(ptr);
                    if (!ptr.IsNull())
                    {
                        ptr -= IntPtr.Size;
                    }
                }

                memory.Size = InnerNode.MemorySize;
                memory.UpdateFrom(context.Process, ptr);

                var v = context.Clone();
                v.Address = ptr;
                v.Memory  = memory;

                var innerSize = InnerNode.Draw(v, tx, y);

                size.Width   = Math.Max(size.Width, innerSize.Width + tx - origX);
                size.Height += innerSize.Height;
            }

            return(size);
        }
        public override Size Draw(DrawContext context, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(context, x, y));
            }

            var origX = x;
            var origY = y;

            AddSelection(context, x, y, context.Font.Height);

            if (InnerNode != null)
            {
                x = AddOpenCloseIcon(context, x, y);
            }
            else
            {
                x = AddIconPadding(context, x);
            }
            x = AddIcon(context, x, y, context.IconProvider.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(context, x, y);

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "TSharedPtr") + context.Font.Width;
            if (!IsWrapped)
            {
                x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
            }
            if (InnerNode == null)
            {
                x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, "<void>") + context.Font.Width;
            }
            x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType) + context.Font.Width;

            var ptr = context.Memory.ReadIntPtr(Offset);

            x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.NoneId, "->") + context.Font.Width;
            x = AddText(context, x, y, context.Settings.ValueColor, 0, "0x" + ptr.ToString(Constants.AddressHexFormat)) + context.Font.Width;

            x = AddComment(context, x, y);

            DrawInvalidMemoryIndicatorIcon(context, y);
            AddContextDropDownIcon(context, y);
            AddDeleteIcon(context, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level] && InnerNode != null)
            {
                memory.Size = InnerNode.MemorySize;
                memory.UpdateFrom(context.Process, ptr);

                var v = context.Clone();
                v.Address = ptr;
                v.Memory  = memory;

                var innerSize = InnerNode.Draw(v, tx, y);

                size.Width   = Math.Max(size.Width, innerSize.Width + tx - origX);
                size.Height += innerSize.Height;
            }

            return(size);
        }
示例#10
0
        public override Size Draw(DrawContext context, int x, int y)
        {
            AddSelection(context, 0, y, context.Font.Height);

            var origX = x;
            var origY = y;

            x = AddOpenCloseIcon(context, x, y);

            var tx = x;

            x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None);
            x = AddText(context, x, y, context.Settings.OffsetColor, 0, AddressFormula) + context.Font.Width;

            x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Class") + context.Font.Width;
            x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
            x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[{MemorySize}]") + context.Font.Width;
            x = AddComment(context, x, y);

            y += context.Font.Height;

            var size = new Size(x - origX, y - origY);

            if (LevelsOpen[context.Level])
            {
                var childOffset = tx - origX;

                var innerContext = context.Clone();
                innerContext.Level++;
                foreach (var node in Nodes)
                {
                    Size AggregateNodeSizes(Size baseSize, Size newSize)
                    {
                        return(new Size(Math.Max(baseSize.Width, newSize.Width), baseSize.Height + newSize.Height));
                    }

                    Size ExtendWidth(Size baseSize, int width)
                    {
                        return(new Size(baseSize.Width + width, baseSize.Height));
                    }

                    // Draw the node if it is in the visible area.
                    if (context.ClientArea.Contains(tx, y))
                    {
                        var innerSize = node.Draw(innerContext, tx, y);

                        size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset));

                        y += innerSize.Height;
                    }
                    else
                    {
                        // Otherwise calculate the height...
                        var calculatedHeight = node.CalculateDrawnHeight(innerContext);

                        // and check if the node area overlaps with the visible area...
                        if (new Rectangle(tx, y, 9999999, calculatedHeight).IntersectsWith(context.ClientArea))
                        {
                            // then draw the node...
                            var innerSize = node.Draw(innerContext, tx, y);

                            size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset));

                            y += innerSize.Height;
                        }
                        else
                        {
                            // or skip drawing and just use the calculated height.
                            size = AggregateNodeSizes(size, new Size(0, calculatedHeight));

                            y += calculatedHeight;
                        }
                    }
                }
            }

            return(size);
        }