Beispiel #1
0
        private void b_cmdAdd_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0 && richTextBox1.Text.Length == 0)
            {
                MessageBox.Show("Запоните поля!!!");
            }
            else
            {
                bool        b   = false;
                List <cmds> tmp = new List <cmds>();
                tmp = SOL.ListFromFile(path_cmds);
                for (int i = 0; i < tmp.Count; i++)
                {
                    if (tmp[i].name == textBox1.Text)
                    {
                        MessageBox.Show("Такая комманда уже существует!");
                        b = true;
                        break;
                    }
                }
                if (b != true)
                {
                    cmds t = new cmds();
                    t.name = textBox1.Text;
                    t.desk = richTextBox1.Text;
                    cmdlist.Add(t);

                    SOL.ToFile(path_cmds, cmdlist);
                    cmdlist = SOL.ListFromFile(path_cmds);

                    lb_cmdList.Items.Clear();
                    for (int o = 0; o < cmdlist.Count; o++)
                    {
                        lb_cmdList.Items.Add(cmdlist[o].name);
                    }
                }
            }
        }
 public void Cmd(string a_name, cmds a_cmd, GameState a_state)
 {
     StateCmd newCmd = new StateCmd(a_name, a_cmd, a_state);
     m_cmds.Add(newCmd);
 }
 public StateCmd(string a_name, cmds a_cmd, GameState a_state)
 {
     m_name = a_name;
     m_cmd = a_cmd;
     m_state = a_state;
 }