Пример #1
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(view, x, y));
            }

            var origX = x;
            var origY = y;

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

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.VTable, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

            x = AddComment(view, x, y);

            DrawInvalidMemoryIndicator(view, y);
            AddTypeDrop(view, y);
            AddDelete(view, y);

            y += view.Font.Height;

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

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

                memory.Size    = Nodes.Count * IntPtr.Size;
                memory.Process = view.Memory.Process;
                memory.Update(ptr);

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

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

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

                    y += innerSize.Height;
                }
            }

            return(size);
        }
Пример #2
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            DrawInvalidMemoryIndicator(view, y);

            var origX = x;
            var origY = y;

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

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

            x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Ptr") + view.Font.Width;
            x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width;
            x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + view.Font.Width;
            x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType) + view.Font.Width;

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

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

            x = AddComment(view, x, y);

            AddTypeDrop(view, y);
            AddDelete(view, y);

            y += view.Font.Height;

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

            if (levelsOpen[view.Level])
            {
                memory.Size    = InnerNode.MemorySize;
                memory.Process = view.Memory.Process;
                memory.Update(ptr);

                var v = view.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);
        }
        protected override Size DrawChild(ViewInfo view, int x, int y)
        {
            var v = view.Clone();

            v.Address        = view.Address.Add(Offset) + InnerNode.MemorySize * CurrentIndex;
            v.Memory         = view.Memory.Clone();
            v.Memory.Offset += Offset.ToInt32() + InnerNode.MemorySize * CurrentIndex;

            return(InnerNode.Draw(v, x, y));
        }
Пример #4
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(view, x, y));
            }

            var origX = x;
            var origY = y;

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

            x = AddOpenCloseIcon(view, x, y);
            x = AddIcon(view, x, y, Icons.Union, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

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

            x = AddComment(view, x, y);

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

            y += view.Font.Height;

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

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

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

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

                    y += innerSize.Height;
                }
            }

            return(size);
        }
Пример #5
0
        /// <summary>Draws this node.</summary>
        /// <param name="view">The view information.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <returns>The height the node occupies.</returns>
        public override int Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            AddSelection(view, x, y, view.Font.Height);
            AddDelete(view, x, y);
            AddTypeDrop(view, x, y);

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

            x += view.Font.Width;
            AddComment(view, x, y);

            y += view.Font.Height;

            if (levelsOpen[view.Level])
            {
                var ptr = view.Memory.ReadObject <IntPtr>(Offset);
                if (!ptr.IsNull())
                {
                    ptr = view.Memory.Process.ReadRemoteObject <IntPtr>(ptr);
                    if (!ptr.IsNull())
                    {
                        ptr = ptr - IntPtr.Size;
                    }
                }

                memory.Size    = InnerNode.MemorySize;
                memory.Process = view.Memory.Process;
                memory.Update(ptr);

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

                y = InnerNode.Draw(v, tx, y);
            }

            return(y);
        }
Пример #6
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(view, x, y));
            }

            var origX = x;
            var origY = y;

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

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Class, HotSpot.NoneId, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

            x = AddComment(view, x, y);

            DrawInvalidMemoryIndicator(view, y);
            AddTypeDrop(view, y);
            AddDelete(view, y);

            y += view.Font.Height;

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

            if (LevelsOpen[view.Level])
            {
                var v = view.Clone();
                v.Address        = view.Address.Add(Offset);
                v.Memory         = view.Memory.Clone();
                v.Memory.Offset += Offset.ToInt32();

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

            return(size);
        }
Пример #7
0
        /// <summary>Draws this node.</summary>
        /// <param name="view">The view information.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <returns>The height the node occupies.</returns>
        public override int Draw(ViewInfo view, int x, int y)
        {
            AddSelection(view, 0, y, view.Font.Height);
            x = AddOpenClose(view, x, y);

            var tx = x;

            x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None);
            x = AddText(view, x, y, view.Settings.OffsetColor, 0, AddressFormula) + view.Font.Width;

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

            y += view.Font.Height;

            if (levelsOpen[view.Level])
            {
                var nv = view.Clone();
                nv.Level++;
                foreach (var node in Nodes)
                {
                    // If the node is in the visible area draw it.
                    if (view.ClientArea.Contains(tx, y))
                    {
                        y = node.Draw(nv, tx, y);
                    }
                    else
                    {
                        // Otherwise calculate the height...
                        var height = node.CalculateHeight(nv);

                        // and check if the nodes area overlaps with the visible area...
                        if (new Rectangle(tx, y, view.ClientArea.Width, height).IntersectsWith(view.ClientArea))
                        {
                            // then draw the node...
                            y = node.Draw(nv, tx, y);
                        }
                        else
                        {
                            // or skip drawing and just add the height.
                            y += height;
                        }
                    }
                }
            }

            return(y);
        }
Пример #8
0
        protected override int DrawChild(ViewInfo view, int x, int y)
        {
            var ptr = view.Memory.ReadObject <IntPtr>(Offset + InnerNode.MemorySize * CurrentIndex);

            memory.Size    = InnerNode.MemorySize;
            memory.Process = view.Memory.Process;
            memory.Update(ptr);

            var v = view.Clone();

            v.Address = ptr;
            v.Memory  = memory;

            return(InnerNode.Draw(v, x, y));
        }
Пример #9
0
        public override int CalculateHeight(ViewInfo view)
        {
            if (IsHidden)
            {
                return(HiddenHeight);
            }

            var h = view.Font.Height;

            if (levelsOpen[view.Level])
            {
                var nv = view.Clone();
                nv.Level++;
                h += Nodes.Sum(n => n.CalculateHeight(nv));
            }
            return(h);
        }
Пример #10
0
        /// <summary>Draws this node.</summary>
        /// <param name="view">The view information.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <returns>The height the node occupies.</returns>
        public override int Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            AddSelection(view, x, y, view.Font.Height);
            AddDelete(view, x, y);
            AddTypeDrop(view, x, y);

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.VTable, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

            x = AddText(view, x, y, Program.Settings.VTableColor, HotSpot.NoneId, $"VTable[{nodes.Count}]") + view.Font.Width;
            x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width;

            AddComment(view, x, y);

            y += view.Font.Height;

            if (levelsOpen[view.Level])
            {
                var ptr = view.Memory.ReadObject <IntPtr>(Offset);

                memory.Size    = nodes.Count * IntPtr.Size;
                memory.Process = view.Memory.Process;
                memory.Update(ptr);

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

                foreach (var node in nodes)
                {
                    y = node.Draw(v, tx, y);
                }
            }

            return(y);
        }
        protected override Size DrawChild(ViewInfo view, int x, int y)
        {
            var ptr = view.Memory.ReadIntPtr(Offset);

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

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

            var v = view.Clone();

            v.Address = ptr;
            v.Memory  = memory;

            return(InnerNode.Draw(v, x, y));
        }
Пример #12
0
        /// <summary>Draws this node.</summary>
        /// <param name="view">The view information.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <returns>The height the node occupies.</returns>
        public override int Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden)
            {
                return(DrawHidden(view, x, y));
            }

            AddSelection(view, x, y, view.Font.Height);
            AddDelete(view, x, y);
            AddTypeDrop(view, x, y);

            x = AddOpenClose(view, x, y);
            x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

            x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Instance") + view.Font.Width;
            x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name);
            x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>");
            x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType);

            x += view.Font.Width;
            AddComment(view, x, y);

            y += view.Font.Height;

            if (levelsOpen[view.Level])
            {
                var v = view.Clone();
                v.Address       = view.Address.Add(Offset);
                v.Memory        = view.Memory.Clone();
                v.Memory.Offset = Offset.ToInt32();

                y = InnerNode.Draw(v, tx, y);
            }

            return(y);
        }
Пример #13
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(view, x, y));
            }

            var origX = x;
            var origY = y;

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

            if (InnerNode != null)
            {
                x = AddOpenCloseIcon(view, x, y);
            }
            else
            {
                x += TextPadding;
            }
            x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

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

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

            x = AddComment(view, x, y);

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

            y += view.Font.Height;

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

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

                var v = view.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);
        }
Пример #14
0
        public override Size Draw(ViewInfo view, int x, int y)
        {
            if (IsHidden && !IsWrapped)
            {
                return(DrawHidden(view, x, y));
            }

            var origX = x;
            var origY = y;

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

            x = AddOpenCloseIcon(view, x, y);
            x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y);

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

            x += view.Font.Width;

            AddComment(view, x, y);

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

            y += view.Font.Height;

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

            if (LevelsOpen[view.Level])
            {
                var ptr = view.Memory.ReadObject <IntPtr>(Offset);
                if (!ptr.IsNull())
                {
                    ptr = view.Process.ReadRemoteObject <IntPtr>(ptr);
                    if (!ptr.IsNull())
                    {
                        ptr -= IntPtr.Size;
                    }
                }

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

                var v = view.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);
        }
Пример #15
0
        /// <summary>Draws this node.</summary>
        /// <param name="view">The view information.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <returns>The pixel size the node occupies.</returns>
        public override Size Draw(ViewInfo view, int x, int y)
        {
            AddSelection(view, 0, y, view.Font.Height);

            var origX = x;
            var origY = y;

            x = AddOpenClose(view, x, y);

            var tx = x;

            x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None);
            x = AddText(view, x, y, view.Settings.OffsetColor, 0, AddressFormula) + view.Font.Width;

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

            y += view.Font.Height;

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

            if (levelsOpen[view.Level])
            {
                var childOffset = tx - origX;

                var nv = view.Clone();
                nv.Level++;
                foreach (var node in Nodes)
                {
                    // Draw the node if it is in the visible area.
                    if (view.ClientArea.Contains(tx, y))
                    {
                        var innerSize = node.Draw(nv, tx, y);

                        size = Utils.AggregateNodeSizes(size, innerSize.Extend(childOffset, 0));

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

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

                            size = Utils.AggregateNodeSizes(size, innerSize.Extend(childOffset, 0));

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

                            y += calculatedHeight;
                        }
                    }
                }
            }

            return(size);
        }
Пример #16
0
        public override Size DrawCompare(ViewInfo view, int x, int y)
        {
            var viewType   = (MemoryCompareControl.ViewTypes)view.Tag;
            var otherViews = (List <MemoryBuffer>)view.Tag2;

            if (IsHidden && !view.ShowOptions.ShowHidden)
            {
                return(DrawHidden(view, x, y));
            }

            // DrawInvalidMemoryIndicator(view, y);

            var origX = x;
            var origY = y;

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

            x = AddOpenClose(view, x, y);
            // x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None);

            var tx = x;

            x = AddAddressOffset(view, x, y, true, false);

            x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Ptr") + view.Font.Width;
            x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width;
            // x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + view.Font.Width;
            // x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType) + view.Font.Width;

            IntPtr ptr = view.Memory.ReadIntPtr(Offset);

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

            // x = AddComment(view, x, y);

            // AddTypeDrop(view, y);
            // AddDelete(view, y);

            y += view.Font.Height;

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

            if (levelsOpen[view.Level])
            {
                memory.Size    = InnerNode.MemorySize;
                memory.Process = view.Memory.Process;
                memory.Update(ptr);

                var v = view.Clone();
                v.Address = ptr;
                v.Memory  = memory;
                v.Tag     = viewType;
                v.Tag2    = otherViews.Select(M => // Update all other MemoryBuffer
                {
                    var newMem     = new MemoryBuffer(M);
                    IntPtr newPtr  = M.ReadIntPtr(Offset);
                    newMem.Size    = InnerNode.MemorySize;
                    newMem.Process = view.Memory.Process;
                    newMem.Update(newPtr);

                    return(newMem);
                }).ToList();

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

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

            return(size);
        }