private static bool LoadSettings(string path) { try { gameSettings = GameSettings.Load(path); } catch (Exception ex) { LogSystem.Error("Error load settings " + path, ex); if (MessageBox.Show(@"Создать настройки по умолчанию? Yes -создадуться настройки поумолчанию. После создания проверьте пожалуйста настройки. No - подправить настройки в ручную и запустить заново бота (Для продвинутых пользователей).", "Незагрузился файл настроек" + path, MessageBoxButtons.YesNo) == DialogResult.Yes) { gameSettings = GameSettings.Create(path); GameSettings.Save(); } else { return(false); } } botvaSettings = gameSettings.BotvaSettings; accountantSettings = botvaSettings.AccountantSettings; minerSettings = botvaSettings.MinerSettings; attackSettings = botvaSettings.AttackSettings; acountSettings = botvaSettings.AcountSettings; return(true); }
/// <summary> /// Saves the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Save(BotvaSettings settings) { settings.Wardrobe.Clear(); try { data.ForEach(e => settings.Wardrobe.Add(e.Action, e.Coulomb)); } catch { } }
/// <summary> /// Shows the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Show(BotvaSettings settings) { columnAction.Setup(typeof(PlayerAction)); columnCoulomb.Setup(typeof(Coulomb)); data = settings.Wardrobe.Select(e => new DataRow { Action = e.Key, Coulomb = e.Value }).ToList(); dataGridView1.DataSource = new BindingList <DataRow>(data); }
/// <summary> /// Saves the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Save(BotvaSettings settings) { settings.UsePatrol = checkBoxUsePatrol.Checked; settings.AutoTreat = boxAutoThreat.Checked; settings.ShowAllerts = boxShowAllerts.Checked; settings.AllowDebugger = boxDebugger.Checked; settings.AcountSettings.CoolStatus = boxCoolStatus.Checked; settings.AcountSettings.Email = boxEmail.Text; settings.AcountSettings.Password = boxPassword.Text; settings.AcountSettings.Server = listServers.Text; settings.MaxInternetErrors = (int)boxMaxInternetErrors.Value; settings.MaxDangerousErrors = (int)boxMaxDangerousErrors.Value; }
/// <summary> /// Shows the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Show(BotvaSettings settings) { boxAutoThreat.Checked = settings.AutoTreat; boxShowAllerts.Checked = settings.ShowAllerts; boxDebugger.Checked = settings.AllowDebugger; checkBoxUsePatrol.Checked = settings.UsePatrol; boxCoolStatus.Checked = settings.AcountSettings.CoolStatus; boxEmail.Text = settings.AcountSettings.Email; boxPassword.Text = settings.AcountSettings.Password; listServers.Text = settings.AcountSettings.Server; boxMaxInternetErrors.Value = settings.MaxInternetErrors; boxMaxDangerousErrors.Value = settings.MaxDangerousErrors; }
/// <summary> /// Saves the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Save(BotvaSettings settings) { if (whiteListChanged) { settings.AttackSettings.WhiteList.Clear(); settings.AttackSettings.WhiteList.AddRange(User.ParseUserNameList(textBoxWhite.Text)); } if (bastardListChanged) { settings.BastardList.Clear(); settings.BastardList.AddRange(User.ParseUserNameList(textBoxBastards.Text)); } if (whiteClanListChanged) { settings.AttackSettings.ClanWhiteList.Clear(); settings.AttackSettings.ClanWhiteList.AddRange(boxWhiteClans.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); } }
/// <summary> /// Saves the specified settings. /// </summary> /// <param name="settings">The settings.</param> private void Save(BotvaSettings settings) { settings.AutoDisguise = boxAutoDisguise.Checked; AppCore.BotvaSettings.Wardrobe.MinEmptySlots = (int)boxMinEmptySlots.Value; }
/// <summary> /// Shows the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Show(BotvaSettings settings) { textBoxWhite.Text = StringUtil.Join(settings.AttackSettings.WhiteList, Environment.NewLine); boxWhiteClans.Text = StringUtil.Join(settings.AttackSettings.ClanWhiteList, Environment.NewLine); textBoxBastards.Text = StringUtil.Join(settings.BastardList, Environment.NewLine); }