Ejemplo n.º 1
0
        private void AddAddressBox_Click(object sender, EventArgs e)
        {
            // Get Some Info
            var lastItem = CompareItems.Last();
            var newLoc   = lastItem.AddressBox.Location; newLoc.X += lastItem.AddressBox.Size.Width + 6;
            var klass    = Classes.FirstOrDefault(c => c.Name == ClassBox.Text);

            // AddressBox
            var newBox = new PlaceholderTextBox
            {
                Name            = $"Box{CompareItems.Count + 1}",
                Location        = newLoc,
                PlaceholderText = "Address",
                Text            = klass.Offset.ToString("X2")
            };

            newBox.TextChanged += AddressBox_TextChanged;

            // ViewBox
            var viewBox = new MemoryCompareControl()
            {
                Name   = $"ViewBox{CompareItems.Count}",
                Dock   = DockStyle.Fill,
                Memory = new MemoryBuffer()
                {
                    Process = Program.RemoteProcess
                },
                ShowOptions = new CompareOptions(),
                ClassNode   = Classes.FirstOrDefault(c => c.Name == ClassBox.Text)
            };

            viewBox.Leave += ViewBox_Leave;

            // Add To List
            CompareItems.Add(new CompareItem()
            {
                AddressBox = newBox, ViewBox = viewBox
            });

            // Add Controls
            addressPanel.Controls.Add(newBox);
            LayoutPanel.Panel.ColumnStyles.Add(new ColumnStyle()
            {
                SizeType = SizeType.Absolute, Width = 150
            });
            LayoutPanel.Panel.Controls.Add(viewBox, CompareItems.Count - 1, 0);

            // Update ViewBox
            viewBox.Invalidate();
        }
Ejemplo n.º 2
0
        public ClassCompare(IEnumerable <ClassNode> classes)
        {
            Contract.Requires(classes != null);
            InitializeComponent();

            // Init
            Classes      = classes;
            CompareItems = new List <CompareItem>();
            var ViewBox1 = new MemoryCompareControl()
            {
                Name   = "ViewBox1",
                Dock   = DockStyle.Fill,
                Memory = new MemoryBuffer()
                {
                    Process = Program.RemoteProcess
                },
                ShowOptions = new CompareOptions(),
                AutoScroll  = false,
                AutoSize    = false
            };
            var ViewBox2 = new MemoryCompareControl()
            {
                Name   = "ViewBox2",
                Dock   = DockStyle.Fill,
                Memory = new MemoryBuffer()
                {
                    Process = Program.RemoteProcess
                },
                ShowOptions = new CompareOptions(),
                AutoScroll  = false,
                AutoSize    = false
            };

            // Events
            ViewBox1.Leave += ViewBox_Leave;
            ViewBox2.Leave += ViewBox_Leave;

            Box1.TextChanged += AddressBox_TextChanged;
            Box2.TextChanged += AddressBox_TextChanged;

            // Add To Panel
            // LayoutPanel.Panel.ColumnStyles.Add(new ColumnStyle() { SizeType = SizeType.Percent, Width = 50 });
            LayoutPanel.Panel.Controls.Add(ViewBox1, 0, 0);
            LayoutPanel.Panel.ColumnStyles.Add(new ColumnStyle()
            {
                SizeType = SizeType.Absolute, Width = 150
            });
            LayoutPanel.Panel.Controls.Add(ViewBox2, 1, 0);

            // Fill Info
            ClassBox.Items.AddRange(classes.Select(t => t.Name).ToArray());
            CompareItems.Add(new CompareItem()
            {
                AddressBox = Box1, ViewBox = ViewBox1
            });
            CompareItems.Add(new CompareItem()
            {
                AddressBox = Box2, ViewBox = ViewBox2
            });

            // Some Settings
            LayoutPanel.VerticalScroll.Visible   = true;
            LayoutPanel.HorizontalScroll.Visible = true;
        }