示例#1
0
        private void AddCmd(Node nCmds)
        {
            var  bytesStartCount    = default(int);
            bool allowOpenHexEditor = true;

            // Set start bytes count
            if (General.GetCurrentHexEditMode() == HexEditModes.BuildInHexEditor)
            {
                var valueInputDialog = new ValueInputDialog();
                valueInputDialog.InfoLabel.Text    = "Count of Bytes";
                valueInputDialog.ValueTextBox.Text = Conversions.ToString(8);
                if (valueInputDialog.ShowDialog() == DialogResult.OK)
                {
                    bytesStartCount = TextValueConverter.ValueFromText(valueInputDialog.ValueTextBox.Text);
                }

                allowOpenHexEditor = bytesStartCount > 0;
            }
            else
            {
                bytesStartCount = 0;
            }

            // Create Buffer
            var cmdBuf = new byte[bytesStartCount];

            // Create new
            if (allowOpenHexEditor)
            {
                General.OpenHexEditor(ref cmdBuf);
            }

            if (cmdBuf?.Any() == true)
            {
                ObjectBankData obd  = (ObjectBankData)nCmds.Tag;
                var            cmd  = new ObjectBankDataCommand(cmdBuf);
                var            nCmd = GetNodeFromCmd(cmd);

                // Add cmd
                obd.Commands.Add(cmd);

                // Add node
                BeginTreeUpdate();
                nCmds.Nodes.Add(nCmd);
                nCmds.Expand();
                EndTreeUpdate();

                // Raise event
                ChangedObjectBankDataCommand?.Invoke(obd);
            }
        }
示例#2
0
        private void AddObj(Node nObjs)
        {
            var input = new ValueInputDialog();

            input.ValueTextBox.Text = "New Object";
            if (input.ShowDialog() == DialogResult.OK)
            {
                ObjectBankData obd   = (ObjectBankData)nObjs.Tag;
                string         name  = input.ValueTextBox.Text.Trim();
                int            index = obd.Objects.Count;
                var            nObj  = GetNodeFromObj(name, index, obd);

                // Add object
                obd.Objects.Add(name);

                // Add node
                BeginTreeUpdate();
                nObjs.Nodes.Add(nObj);
                nObjs.Expand();
                EndTreeUpdate();
            }
        }
示例#3
0
        private void AddObd(Node nObdList)
        {
            var input = new ValueInputDialog();

            input.ValueTextBox.Text = "New Object Bank Data";
            if (input.ShowDialog() == DialogResult.OK)
            {
                ObjectBankDataList obdList = ((KeyValuePair <byte, ObjectBankDataList>)nObdList.Tag).Value;
                string             name    = input.ValueTextBox.Text.Trim();
                var obd  = new ObjectBankData(name);
                var nObd = GetNodeFromObd(obd);

                // Add object
                obdList.Add(obd);

                // Add node
                BeginTreeUpdate();
                nObdList.Nodes.Add(nObd);
                nObdList.Expand();
                EndTreeUpdate();
            }
        }