Exemplo n.º 1
0
        private HexEditor CreateHexEditor(byte[] data, EventHandler <byte[]> saveHandler)
        {
            var editor = new HexEditor();

            editor.Width = 700;
            editor.LoadData(data);
            editor.SaveData += saveHandler;

            return(editor);
        }
Exemplo n.º 2
0
        private void AddTab(EFTB.NodeBase node)
        {
            var tab = new TabPage(node.Signature);

            if (node is EFTB.CADP)
            {
                tab.Controls.Add(CreateCADPEditor((EFTB.CADP)node));
            }
            else if (node.UnknownData != null && node.UnknownData.Length > 0)
            {
                var hexEditor = new HexEditor();
                hexEditor.Dock = DockStyle.Fill;
                hexEditor.LoadData(node.UnknownData);
                tab.Controls.Add(hexEditor);
            }
            stTabControl1.TabPages.Add(tab);
        }
Exemplo n.º 3
0
        private Control CreateCADPEditor(EFTB.CADP cadp)
        {
            var panel = new FlowLayoutPanel();

            panel.Dock          = DockStyle.Fill;
            panel.FlowDirection = FlowDirection.TopDown;
            var label = new Label();

            label.Text = "Shape";
            panel.Controls.Add(label);
            foreach (EFTB.CADP.Shape flag in Enum.GetValues(typeof(EFTB.CADP.Shape)))
            {
                var checkbox = new CheckBox();
                checkbox.Text            = Enum.GetName(typeof(EFTB.CADP.Shape), flag);
                checkbox.Checked         = cadp.ShapeFlag.HasFlag(flag);
                checkbox.CheckedChanged += (object sender, EventArgs e) =>
                {
                    if (checkbox.Checked)
                    {
                        cadp.ShapeFlag |= flag;
                    }
                    else
                    {
                        cadp.ShapeFlag &= ~flag;
                    }
                };
                panel.Controls.Add(checkbox);
            }
            var hexEditor = new HexEditor();

            hexEditor.Width = 700;
            // hexEditor.Dock = DockStyle.Fill;
            hexEditor.LoadData(cadp.UnknownData);
            hexEditor.SaveData += (object sender, byte[] data) => cadp.UnknownData = data;
            panel.Controls.Add(hexEditor);

            return(panel);
        }