Пример #1
0
        public void ReadFromFile()
        {
            string[] lines = System.IO.File.ReadAllLines(path_to_project);

            foreach (string line in lines)
            {
                string[] loc = line.Split(';');

                if (string.Equals(loc[0], "BOT"))
                {
                    BotEvent bot = new BotEvent();
                    bot.setName(loc[1]);
                    bot.setType(loc[2]);

                    for (int i = 3; i < loc.Length;)
                    {
                        bot.addToDictionary(loc[i], loc[i + 1]);
                        i += 2;
                    }

                    memory_event.addToList(bot);
                    continue;
                }
                if (string.Equals(loc[0], "SCREENSHOT"))
                {
                    memory_screenshot_path.addToList(loc[1]);
                    continue;
                }
                if (string.Equals(loc[0], "VARIABLE"))
                {
                    memory_variables.addToDictionary(loc[1], loc[2]);
                    continue;
                }
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex > -1)
            {
                BotEvent bot = new BotEvent();

                bot.setType(comboBox1.SelectedItem.ToString());

                bot.setName(textBox1.Text);

                foreach (UserControl_Label_TextField item in list)
                {
                    string[] value = item.Name.Split(new char[] { '$' });

                    if (value.Count() > 1)
                    {
                        if (value[1].ToLower() == "x")
                        {
                            bot.addToDictionary(item.getLabelText(), x.ToString());
                            continue;
                        }
                        if (value[1].ToLower() == "y")
                        {
                            bot.addToDictionary(item.getLabelText(), y.ToString());
                            continue;
                        }
                    }
                    bot.addToDictionary(item.getLabelText(), item.Name);
                }

                memory_event.addToList(bot);
                form_main.getVariableMemory().addToDictionary("$" + textBox1.Text, 0);

                this.Close();
            }
        }