예제 #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 Simulate()
        {
            for (int loop = 0; loop < int.Parse(ProjectSettings_TextField_Count.Text); loop++)
            {
                foreach (BotEvent bot in memory_event.getList())
                {
                    actual_botevent_running = bot;

                    memory_variables.getDictionary()["$ActualX"] = Cursor.Position.X.ToString();
                    memory_variables.getDictionary()["$ActualY"] = Cursor.Position.Y.ToString();

                    TakeScreenshot_tmp();

                    if (bot.getType() == "change_variable_value")
                    {
                        if (memory_variables.getDictionary().ContainsKey(bot.getDictionary().First().Value))
                        {
                            try
                            {
                                memory_variables.getDictionary()[bot.getDictionary().First().Value] =
                                    int.Parse(memory_variables.getDictionary()[bot.getDictionary().First().Value].ToString()) + int.Parse(GetValue(bot.getDictionary().ElementAt(1).Value));
                            }
                            catch
                            {
                                MessageBox.Show("Trying to change string value to integer");
                            }
                        }

                        continue;
                    }

                    string procces_path = "lib\\" + bot.getType() + ".exe";
                    string procces_args = "";

                    foreach (KeyValuePair <string, string> item in bot.getDictionary())
                    {
                        procces_args += GetValue(item.Value) + " ";
                    }

                    Console.WriteLine(procces_path + " " + procces_args);

                    Process proc = new Process();

                    proc.StartInfo.FileName        = procces_path;
                    proc.StartInfo.Arguments       = procces_args;
                    proc.StartInfo.UseShellExecute = false;

                    proc.StartInfo.RedirectStandardOutput = true;
                    proc.StartInfo.RedirectStandardError  = true;
                    proc.StartInfo.CreateNoWindow         = true;
                    proc.EnableRaisingEvents = true;
                    proc.OutputDataReceived += new DataReceivedEventHandler(OnDataReceived);
                    proc.Start();
                    proc.BeginErrorReadLine();
                    proc.BeginOutputReadLine();
                    proc.WaitForExit();
                }
            }
        }
예제 #3
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();
            }
        }
예제 #4
0
 //work with list
 public void addToList(BotEvent bot)
 {
     list.Add(bot);
 }