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(AccountantSettings settings) { settings.InvestmentEnabled = boxInvestmentEnabled.Checked; settings.SearchStrategy.Enabled = boxSearchEnabled.Checked; settings.SearchStrategy.SoundNotification = boxSoundEnabled.Checked; settings.MinMoney = (int)boxMinMoney.Value; settings.ShopingInteval = (int)boxShopingInteval.Value; settings.UpgradeCouloub = coulombSelector1.SelectedCoulomb; normalInvestmentStrategyControl.Save(settings.NormalStrategy); atackInvestmentStrategyControl.Save(settings.AlertStrategy); notificationSearcher.Save(settings.SearchStrategy.StuffConditions); }