Esempio n. 1
0
        private void edit_Click(object sender, EventArgs e)
        {
            if (commandTree.SelectedNode == null)
            {
                return;
            }
            // get the command from the treeview's selected node
            this.command = (Command)commandTree.SelectedNode.Tag;
            if (command.Opcode == 0xFF)
            {
                MessageBox.Show(
                    "Cannot edit command(s).\n\nThe two counter command barriers cannot be removed, modified, or moved.",
                    "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
                commandTree.SelectedNode.Checked = false;
                return;
            }
            // open the command dialog and load the command
            var commandForm = new CommandForm(command);
            var result      = commandForm.ShowDialog(this);

            // only if closed through OK button
            if (result == DialogResult.OK && commandForm.Tag != null)
            {
                this.modifiedNode = commandTree.SelectedNode;
                byte[] oldScript = Bits.Copy(battleScript.Buffer);
                LoadScript(commandTree.GetFullIndex());
                UpdateFreeBytesLabel();
                PushCommand(oldScript);
            }
        }
Esempio n. 2
0
        private void insert_Click(object sender, EventArgs e)
        {
            // load the command form to specify the new command's settings
            var commandForm = new CommandForm();
            var result      = commandForm.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }
            var command = (Command)commandForm.Tag;

            // insert the command into the collection and TreeView
            byte[] oldScript = Bits.Copy(battleScript.Buffer);
            AddCommand(command);
            // update info text for controls
            UpdateFreeBytesLabel();
            //
            if (modifiedNode != null)
            {
                modifiedNode = commandTree.SelectedNode;
            }
            //
            PushCommand(oldScript);
        }