public static List <GameBot> LoadBotsFromFile() { var result = new List <GameBot>(); if (!File.Exists("accounts.txt")) { return(result); } using (var reader = new StreamReader("accounts.txt")) { try { string line; while ((line = reader.ReadLine()) != null) { var bot = new GameBot(); bot.LoadFromString(line); result.Add(bot); } } catch (Exception) { } } return(result); }
private void BotOnOnLog(GameBot sender, string s) { Invoke((MethodInvoker)(() => { lbLog.Items.Add(string.Format("[{0}] [{1}] : {2}", DateTime.Now, sender.Name, s)); lbLog.SelectedIndex = lbLog.Items.Count - 1; })); }
private void btnAuth_Click(object sender, EventArgs e) { //Если нет бота, создадим if (Bot == null) { Bot = new GameBot(); } //Откроем форму браузера var authForm = new BrowserForm(Bot); authForm.Show(this); }
private void BotOnOnHp(GameBot sender, string s) { Invoke((MethodInvoker)(() => lblHp.Text = s)); }
public BrowserForm(GameBot bot) { InitializeComponent(); _bot = bot; }