/// <summary> /// Handles the closing of the form. Hooks are disabled and the settings are saved before closing. /// </summary> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { HookManager.DisableMouseHook(); HookManager.DisableKeyboardHook(); GlobalSettings.Save(); }
/// <summary> /// Handles clicking of the OK button, the new settings are applied and saved and the form is closed. /// </summary> private void OkButton_Click(object sender, System.EventArgs e) { // Apply the new settings. GlobalSettings.Settings.MouseSensitivity = (int)this.udMouseSensitivity.Value; GlobalSettings.Settings.ScrollHold = (int)this.udScrollHold.Value; GlobalSettings.Settings.TrapKeyboard = this.chkTrapKeyboard.Checked; GlobalSettings.Settings.TrapMouse = this.chkTrapMouse.Checked; GlobalSettings.Settings.TrapToggleKeyCode = this.trapToggleKey; GlobalSettings.Settings.ShowKeyPresses = this.chkShowKeypresses.Checked; GlobalSettings.Settings.Capitalization = this.rdbFollowKeystate.Checked ? CapitalizationMethod.FollowKeys : this.rdbAlwaysLower.Checked ? CapitalizationMethod.Lowercase : CapitalizationMethod.Capitalize; GlobalSettings.Settings.MouseFromCenter = this.chkMouseFromCenter.Checked; MouseState.SetMouseFromCenter(GlobalSettings.Settings.MouseFromCenter); GlobalSettings.Save(); this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// Toggles updating the text position of an element when a boundary or edge is updated. /// </summary> private void mnuUpdateTextPosition_Click(object sender, EventArgs e) { this.menuOpen = false; GlobalSettings.Settings.UpdateTextPosition = this.mnuUpdateTextPosition.Checked; GlobalSettings.Save(); }
/// <summary> /// Handles clicking of the OK button, the new settings are applied and saved and the form is closed. /// </summary> private void OkButton_Click(object sender, System.EventArgs e) { // Apply the new settings. GlobalSettings.Settings.MouseSensitivity = (int)this.udMouseSensitivity.Value; GlobalSettings.Settings.ScrollHold = (int)this.udScrollHold.Value; GlobalSettings.Settings.TrapKeyboard = this.chkTrapKeyboard.Checked; GlobalSettings.Settings.TrapMouse = this.chkTrapMouse.Checked; GlobalSettings.Settings.TrapToggleKeyCode = this.trapToggleKey; GlobalSettings.Settings.Capitalization = this.rdbFollowKeystate.Checked ? CapitalizationMethod.FollowKeys : this.rdbAlwaysLower.Checked ? CapitalizationMethod.Lowercase : CapitalizationMethod.Capitalize; GlobalSettings.Settings.FollowShiftForCapsInsensitive = this.chkFollowShiftCapsInsensitive.Checked; GlobalSettings.Settings.FollowShiftForCapsSensitive = this.chkFollowShiftCapsSensitive.Checked; GlobalSettings.Settings.MouseFromCenter = this.chkMouseFromCenter.Checked; Func <Rectangle, Point> getCenter = r => r.Location + new Size(r.Width / 2, r.Height / 2); MouseState.SetMouseFromCenter(GlobalSettings.Settings.MouseFromCenter, Screen.AllScreens.Select(x => (x.Bounds, getCenter(x.Bounds))).ToList()); GlobalSettings.Settings.WindowTitle = this.txtTitle.Text; GlobalSettings.Settings.PressHold = (int)this.udPressHold.Value; GlobalSettings.Save(); this.DialogResult = DialogResult.OK; }
private void Button_Click_3(object sender, RoutedEventArgs e) { foreach (var item in setting.GetType().GetFields()) { var att = item.GetCustomAttributes <ExcelConfigAttribute>(true).FirstOrDefault(); if (att != null) { var type = item.FieldType; if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(Dictionary <,>))) { var obj = map[item]; Type keyType = type.GetGenericArguments()[0]; Type valueType = type.GetGenericArguments()[1]; var t = typeof(Window.ObservablePairCollection <,>); var genericType = t.MakeGenericType(keyType, valueType); var method = genericType.GetMethod("GetDictionary"); var dict = method.Invoke(obj, null); item.SetValue(setting, dict); } } } setting.Save("configs\\test.json"); }
private int Run(string[] args) { _output = new ConsoleOutput(); try { BuildOptions options = ParseBuildOptions(args); if (options == null || options.Solution == null) { return(1); } GlobalSettings globalSettings = GlobalSettings.Load(_output); globalSettings.Save(); var settings = new Settings(globalSettings, options, _output); var stopwatch = new Stopwatch(); stopwatch.Start(); int exitCode = 0; if (options.CleanCache) { CacheCleaner.Run(settings); } else { var solutionReaderWriter = new SolutionReaderWriter(settings); SolutionInfo solutionInfo = solutionReaderWriter.ReadWrite(options.Solution.FullName); settings.SolutionSettings = SolutionSettings.Load(settings, solutionInfo); var projectReaderWriter = new ProjectReaderWriter(settings); projectReaderWriter.ReadWrite(solutionInfo); settings.SolutionSettings.UpdateAndSave(settings, solutionInfo); if (!options.GenerateOnly) { var processLauncher = new ProcessLauncher(settings); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs cancelArgs) { _output.WriteLine("Stopping build..."); processLauncher.Stop(); cancelArgs.Cancel = true; }; exitCode = processLauncher.Run(solutionInfo); } } stopwatch.Stop(); TimeSpan ts = stopwatch.Elapsed; string buildTimeText = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); _output.WriteLine("Build time: " + buildTimeText); return(exitCode); } catch (Exception e) { _output.WriteLine("ERROR: " + e.Message); return(-1); } }
public void AddLaunchHistory(string settingsPath, string shortName, string description, string iconPath) { FileInfo fi = new FileInfo(settingsPath); string revisedIconPath = iconPath .Replace("{CurrentLocation}", Environment.CurrentDirectory) .Replace("{SettingsLocation}", fi.DirectoryName); globalSettings.AddLaunchHistory( settingsPath, shortName, description, revisedIconPath ); globalSettings.Save(globalSettingsPath); }
public void SaveClick() { if (Sniper2Exe != null && Sniper2Exe.Contains(".exe")) { ColVisibility = Visibility.Visible; } if (Sniper2Exe == null || Sniper2Exe.Equals("")) { Sniper2Exe = ""; ColVisibility = Visibility.Collapsed; } GlobalSettings.ShowLimit = Math.Max(ShowLimit, 1); GlobalSettings.Port = CustomPort; GlobalSettings.PokeSnipers2Exe = Sniper2Exe; GlobalSettings.ShowLimit = ShowLimit; GlobalSettings.RemoveAfter = int.Parse(RemoveMinutes); GlobalSettings.VerifyOnSkiplagged = UseSkiplagged; GlobalSettings.VerifiedOnly = VerifiedOnly; GlobalSettings.UseFilter = UseFilter; GlobalSettings.MinimumIV = MinimumIV; GlobalSettings.UseGeoLocationBoundsFilter = UseGeoLocationBoundsFilter; GlobalSettings.GeoLocationBounds = GeoLocationBounds; GlobalSettings.AppTheme = AppThemeText; GlobalSettings.Save(); GlobalSettings.Output.RemoveListExtras(); }
private void btnOk_Click(object sender, EventArgs e) { Globals.Settings.PaddingWidth = tbpaddingwidth.IntValue; Globals.Settings.LineInterval = tblineinterval.IntValue; Globals.Settings.TabSize = Convert.ToInt32(tabsize.Value); Globals.Settings.RecentFileNumber = Convert.ToInt32(numrecent.Value); GlobalSettings.Save(Globals.Settings, GlobalSettings.SettingsDir + "User.ynotesettings"); Close(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { var profilePath = Path.Combine(Directory.GetCurrentDirectory(), ""); var profileConfigPath = Path.Combine(profilePath, "config"); var configFile = Path.Combine(profileConfigPath, "config.json"); var authFile = Path.Combine(profileConfigPath, "auth.json"); _set = Settings.GetGlobalSettingsObject(); _set.Save(configFile); _set.Auth.Save(authFile); }
private void button1_Click(object sender, EventArgs e) { globalSettings.Save(); colorSettings.Save(); prioritySettings.Save(); opacitySettings.Save(); sizeSettings.Save(); shapeSettings.Save(); SaveSettings(savedEntityBox); DialogResult = DialogResult.OK; Close(); }
private void applyButton_Click(object sender, EventArgs e) { // Write back the property values userSettings["Opacity"] = (float)this.opacityValue.Value; userSettings["TrailLength"] = (int)this.trailLengthValue.Value; userSettings["MaximumNumberOfFlakes"] = ( int )this.maximumFlakesUpDown.Value; // Save the settings GlobalSettings.Save(Path.GetDirectoryName(Application.ExecutablePath) + "\\" + Properties.Settings.Default.SettingsFilePath); // Close the option form (( Form )this.Parent).Close( ); }
private void TextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var p = OpenFolderDialog(); if (Directory.Exists(p)) { if (File.Exists(Path.Combine(p, "PokeSniper2.exe"))) { path.Text = Path.Combine(p, "PokeSniper2.exe"); GlobalSettings.PokeSnipers2Exe = Path.Combine(p, "PokeSniper2.exe"); GlobalSettings.Save(); return; } } }
private void okButton_Click(object sender, EventArgs e) { // Save the profiles in our collection foreach (Profile objProfile in this.LoadedProfiles) { objProfile.Save(); } // Save the global settings GlobalSettings.Save(); // Close the form this.DialogResult = DialogResult.OK; this.Close(); }
public Builder(IOutput output) { _output = output; _stopwatch = new Stopwatch(); try { _globalSettings = GlobalSettings.Load(_output); _globalSettings.Save(); } catch (System.Exception ex) { _output.WriteLine("Error saving global settings: " + ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtServerPort.Text)) { GlobalSettings.ServerPort = int.Parse(txtServerPort.Text); } if (!string.IsNullOrEmpty(txtRootFolder.Text)) { GlobalSettings.ServerRoot = txtRootFolder.Text; } GlobalSettings.Save(); DialogResult = DialogResult.OK; Close(); }
public void SaveClick() { if (Sniper2Exe != null && Sniper2Exe.Contains(".exe")) { ColVisibility = Visibility.Visible; } if (Sniper2Exe == null || Sniper2Exe.Equals("")) { Sniper2Exe = ""; ColVisibility = Visibility.Collapsed; } GlobalSettings.ShowLimit = Math.Max(ShowLimit, 1); GlobalSettings.Port = CustomPort; GlobalSettings.PokeSnipers2Exe = Sniper2Exe; GlobalSettings.ShowLimit = ShowLimit; GlobalSettings.RemoveAfter = int.Parse(RemoveMinutes); GlobalSettings.Save(); GlobalSettings.Output.RemoveListExtras(); }
/// <summary> /// Handles the closing of the form. Hooks are disabled and the settings are saved before closing. /// </summary> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (GlobalSettings.UnsavedDefinitionChanges || GlobalSettings.UnsavedStyleChanges && !CrashHandler.Crashed) { var result = MessageBox.Show( "You have unsaved changes. If you exit now you will lose them. Are you sure you want to exit?", "Discard changes", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result != DialogResult.OK) { e.Cancel = true; return; } } HookManager.DisableMouseHook(); HookManager.DisableKeyboardHook(); GlobalSettings.Save(); }
public void SaveLatLngSettingClick() { GlobalSettings.GeoLocationBounds = LocationBoundsSettingToSave; GlobalSettings.Save(); ShowSettings(); }
static void Main(string[] args) { GlobalSettings.Load(); GlobalSettings.Save(); Logger.SetActive(GlobalSettings.LoggerActive); //Logger.SetOutputFile("Data\\Log.txt"); Logger.SetMinDebugLevelToConsole(GlobalSettings.MinConsoleLevel); if (GlobalSettings.ClearImportsAtStart) { var path = Path.Combine("Data", "Imports"); DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo file in di.EnumerateFiles()) { file.Delete(); } foreach (DirectoryInfo dir in di.EnumerateDirectories()) { dir.Delete(true); } } while (true) { GlobalSettings.ShowSettingsPath(); ProgramSetting testing = GetProgramSetting(); Logger.DebugLine($"Chosen Program: {testing.ToString()}", 10); //Main Part for the Program if (testing == ProgramSetting.AllTests) { TestSuite(testing); } else if (testing == ProgramSetting.ErrorTests) { TestSuite(testing); } else if (testing == ProgramSetting.PositiveTests) { TestSuite(testing); } else if (testing == ProgramSetting.Import) { Import(testing); TestSuite(testing); } else if (testing == ProgramSetting.ImportTest) { ImportTest(); } else if (testing == ProgramSetting.HandmadeImport) { Import(testing); TestSuite(testing); } else if (testing == ProgramSetting.CorpusRun) { CorpusTestrun(); //CorpusTestrun(t => // { // var filesize = (long)Math.Round(new FileInfo(t).Length / 1024.0); // return filesize >= 150 && filesize <= 300; // } //); } else if (testing == ProgramSetting.SpreadsheetRun) { SpreadsheetTestrun(); } else if (testing == ProgramSetting.ResetCorpusPath) { GlobalSettings.data.ImportPathEuses = GlobalSettings.GetImportEusesFromUser(); } Logger.SaveToFile(); Console.WriteLine("Program has ended. Press Enter to restart"); Console.ReadLine(); Console.Clear(); } }
public static void LoadSettings(EntityBox entityBox) { Properties.Settings settings = Properties.Settings.Default; /// Load global settings GlobalSettings global = new GlobalSettings(entityBox); global.SelectEntitiesAfterAdd = settings.SelectEntitiesAfterAdd; global.Grayscale = settings.Grayscale; global.Lambda = settings.Lambda; global.LockScroll0 = settings.LockScroll0; global.LockScroll1 = settings.LockScroll1; global.LockScroll2 = settings.LockScroll2; global.LockZoom0 = settings.LockZoom0; global.LockZoom1 = settings.LockZoom1; global.LockZoom2 = settings.LockZoom2; global.HideGrid = settings.HideGrid; global.HideLambdaMetrics = settings.HideLambdaMetrics; global.CellTextAlignment = (TextAlignment)settings.CellTextAlignment; global.ViasTextAlignment = (TextAlignment)settings.ViasTextAlignment; global.WireTextAlignment = (TextAlignment)settings.WireTextAlignment; global.Save(); /// Load color settings /// ColorSettings color = new ColorSettings(entityBox); color.SelectionBoxColor = settings.SelectionBoxColor; color.ViasInputColor = settings.ViasInputColor; color.ViasOutputColor = settings.ViasOutputColor; color.ViasInoutColor = settings.ViasInoutColor; color.ViasConnectColor = settings.ViasConnectColor; color.ViasFloatingColor = settings.ViasFloatingColor; color.ViasPowerColor = settings.ViasPowerColor; color.ViasGroundColor = settings.ViasGroundColor; color.WireInterconnectColor = settings.WireInterconnectColor; color.WirePowerColor = settings.WirePowerColor; color.WireGroundColor = settings.WireGroundColor; color.CellNotColor = settings.CellNotColor; color.CellBufferColor = settings.CellBufferColor; color.CellMuxColor = settings.CellMuxColor; color.CellLogicColor = settings.CellLogicColor; color.CellAdderColor = settings.CellAdderColor; color.CellBusSuppColor = settings.CellBusSuppColor; color.CellFlipFlopColor = settings.CellFlipFlopColor; color.CellLatchColor = settings.CellLatchColor; color.CellOtherColor = settings.CellOtherColor; color.UnitRegfileColor = settings.UnitRegfileColor; color.UnitMemoryColor = settings.UnitMemoryColor; color.UnitCustomColor = settings.UnitCustomColor; color.SelectionColor = settings.SelectionColor; color.ViasOverrideColor = settings.ViasOverrideColor; color.WireOverrideColor = settings.WireOverrideColor; color.CellOverrideColor = settings.CellOverrideColor; color.RegionOverrideColor = settings.RegionOverrideColor; color.Save(); /// Load priority settings /// PrioritySettings priority = new PrioritySettings(entityBox); priority.ViasPriority = settings.ViasPriority; priority.WirePriority = settings.WirePriority; priority.CellPriority = settings.CellPriority; priority.BeaconPriority = settings.BeaconPriority; priority.RegionPriority = settings.RegionPriority; priority.AutoPriority = settings.AutoPriority; priority.Save(); /// Load opacity settings /// OpacitySettings opacity = new OpacitySettings(entityBox); opacity.ViasOpacity = settings.ViasOpacity; opacity.WireOpacity = settings.WireOpacity; opacity.CellOpacity = settings.CellOpacity; opacity.Save(); /// Load shape settings /// ShapeSettings shape = new ShapeSettings(entityBox); shape.ViasShape = (ViasShape)settings.ViasShape; shape.Save(); entityBox.Invalidate(); }
private void saveBtn_Click(object sender, EventArgs e) { if (UserLoginBox.Text.Length == 0 || UserPasswordBox.Text.Length == 0) { MessageBox.Show( @"You haven't complete entering your basic information yet." + Environment.NewLine + @"Either Username, Password is empty. Please complete them before saving.", @"Incomplete information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { #region Auth Settings var lastPosFile = Path.Combine(_setting.ProfileConfigPath, "LastPos.ini"); if (File.Exists(lastPosFile)) { File.Delete(lastPosFile); } _setting.Auth.AuthConfig.AuthType = authTypeCb.Text == @"Google" ? AuthType.Google : AuthType.Ptc; if (_setting.Auth.AuthConfig.AuthType == AuthType.Google) { _setting.Auth.AuthConfig.GoogleUsername = UserLoginBox.Text; _setting.Auth.AuthConfig.GooglePassword = UserPasswordBox.Text; _setting.Auth.AuthConfig.PtcUsername = null; _setting.Auth.AuthConfig.PtcPassword = null; } else { _setting.Auth.AuthConfig.GoogleUsername = null; _setting.Auth.AuthConfig.GooglePassword = null; _setting.Auth.AuthConfig.PtcUsername = UserLoginBox.Text; _setting.Auth.AuthConfig.PtcPassword = UserPasswordBox.Text; } _setting.GoogleWalkConfig.GoogleAPIKey = GoogleApiBox.Text == "" ? null : GoogleApiBox.Text; _setting.Auth.ProxyConfig.UseProxy = useProxyCb.Checked == true ? true : false; _setting.Auth.ProxyConfig.UseProxyHost = proxyHostTb.Text == "" ? null : proxyHostTb.Text; _setting.Auth.ProxyConfig.UseProxyPort = proxyPortTb.Text == "" ? null : proxyPortTb.Text; _setting.Auth.ProxyConfig.UseProxyAuthentication = useProxyAuthCb.Checked == true ? true : false; _setting.Auth.ProxyConfig.UseProxyUsername = proxyUserTb.Text == "" ? null : proxyUserTb.Text; _setting.Auth.ProxyConfig.UseProxyPassword = proxyPwTb.Text == "" ? null : proxyPwTb.Text; _setting.Auth.DeviceConfig.DevicePackageName = "custom"; _setting.Auth.DeviceConfig.DeviceId = DeviceIdTb.Text == "" ? null : DeviceIdTb.Text; _setting.Auth.DeviceConfig.AndroidBoardName = AndroidBoardNameTb.Text == "" ? null : AndroidBoardNameTb.Text; _setting.Auth.DeviceConfig.AndroidBootloader = AndroidBootloaderTb.Text == "" ? null : AndroidBootloaderTb.Text; _setting.Auth.DeviceConfig.DeviceBrand = DeviceBrandTb.Text == "" ? null : DeviceBrandTb.Text; _setting.Auth.DeviceConfig.DeviceModel = DeviceModelTb.Text == "" ? null : DeviceModelTb.Text; _setting.Auth.DeviceConfig.DeviceModelIdentifier = DeviceModelIdentifierTb.Text == "" ? null : DeviceModelIdentifierTb.Text; _setting.Auth.DeviceConfig.DeviceModelBoot = DeviceModelBootTb.Text == "" ? null : DeviceModelBootTb.Text; _setting.Auth.DeviceConfig.HardwareManufacturer = HardwareManufacturerTb.Text == "" ? null : HardwareManufacturerTb.Text; _setting.Auth.DeviceConfig.HardwareModel = HardwareModelTb.Text == "" ? null : HardwareModelTb.Text; _setting.Auth.DeviceConfig.FirmwareBrand = FirmwareBrandTb.Text == "" ? null : FirmwareBrandTb.Text; _setting.Auth.DeviceConfig.FirmwareTags = FirmwareTagsTb.Text == "" ? null : FirmwareTagsTb.Text; _setting.Auth.DeviceConfig.FirmwareType = FirmwareTypeTb.Text == "" ? null: FirmwareTypeTb.Text; _setting.Auth.DeviceConfig.FirmwareFingerprint = FirmwareFingerprintTb.Text == "" ? null : FirmwareFingerprintTb.Text; _setting.Auth.Save(AuthFilePath); #endregion #region RocketBot2.Form Settings _setting.ConsoleConfig.TranslationLanguageCode = cbLanguage.Text; #region Location _setting.LocationConfig.DefaultLatitude = ConvertStringToDouble(tbLatitude.Text); _setting.LocationConfig.DefaultLongitude = ConvertStringToDouble(tbLongitude.Text); _setting.LocationConfig.WalkingSpeedInKilometerPerHour = ConvertStringToInt(tbWalkingSpeed.Text); #endregion #region Pokemon #region Catch _setting.PokemonConfig.CatchPokemon = cbCatchPoke.Checked; _setting.PokemonConfig.UseEggIncubators = cbUseEggIncubators.Checked; _setting.PokemonConfig.MaxPokeballsPerPokemon = ConvertStringToInt(tbMaxPokeballsPerPokemon.Text); _setting.PokemonsToIgnore = ConvertClbToList(clbIgnore); _setting.PokemonConfig.AutoFavoritePokemon = cbAutoFavoritePokemon.Checked; _setting.PokemonConfig.FavoriteMinIvPercentage = ConvertStringToFloat(tbFavoriteMinIvPercentage.Text); _setting.ItemUseFilters.FirstOrDefault().Value.MaxItemsUsePerPokemon = ConvertStringToInt(tBMaxBerriesToUsePerPokemon.Text); _setting.ItemUseFilters.FirstOrDefault().Value.UseItemMinCP = ConvertStringToInt(tbUseBerriesMinCp.Text); _setting.ItemUseFilters.FirstOrDefault().Value.UseItemMinIV = ConvertStringToInt(tbUseBerriesMinIv.Text); _setting.ItemUseFilters.FirstOrDefault().Value.CatchProbability = ConvertStringToDouble(tbUseBerriesBelowCatchProbability.Text); _setting.ItemUseFilters.FirstOrDefault().Value.Operator = cbUseBerriesOperator.SelectedIndex == 0 ? "and" : "or"; _setting.PokemonConfig.UseGreatBallAboveCp = ConvertStringToInt(tbUseGreatBallAboveCp.Text); _setting.PokemonConfig.UseUltraBallAboveCp = ConvertStringToInt(tbUseUltraBallAboveCp.Text); _setting.PokemonConfig.UseMasterBallAboveCp = ConvertStringToInt(tbUseMasterBallAboveCp.Text); _setting.PokemonConfig.UseGreatBallAboveIv = ConvertStringToDouble(tbUseGreatBallAboveIv.Text); _setting.PokemonConfig.UseUltraBallAboveIv = ConvertStringToDouble(tbUseUltraBallAboveIv.Text); _setting.PokemonConfig.UseGreatBallBelowCatchProbability = ConvertStringToDouble(tbUseGreatBallBelowCatchProbability.Text); _setting.PokemonConfig.UseUltraBallBelowCatchProbability = ConvertStringToDouble(tbUseUltraBallBelowCatchProbability.Text); _setting.PokemonConfig.UseMasterBallBelowCatchProbability = ConvertStringToDouble(tbUseMasterBallBelowCatchProbability.Text); #endregion #region Transfer _setting.PokemonConfig.PrioritizeIvOverCp = cbPrioritizeIvOverCp.Checked; _setting.PokemonConfig.KeepMinCp = ConvertStringToInt(tbKeepMinCp.Text); _setting.PokemonConfig.KeepMinIvPercentage = ConvertStringToFloat(tbKeepMinIV.Text); _setting.PokemonConfig.KeepMinLvl = ConvertStringToInt(tbKeepMinLvl.Text); _setting.PokemonConfig.KeepMinOperator = cbKeepMinOperator.SelectedIndex == 0 ? "and" : "or"; _setting.PokemonConfig.TransferWeakPokemon = cbTransferWeakPokemon.Checked; _setting.PokemonConfig.TransferDuplicatePokemon = cbTransferDuplicatePokemon.Checked; _setting.PokemonConfig.TransferDuplicatePokemonOnCapture = cbTransferDuplicatePokemonOnCapture.Checked; _setting.PokemonConfig.KeepMinDuplicatePokemon = ConvertStringToInt(tbKeepMinDuplicatePokemon.Text); _setting.PokemonConfig.UseKeepMinLvl = cbUseKeepMinLvl.Checked; _setting.PokemonsNotToTransfer = ConvertClbToList(clbTransfer); #endregion #region PowerUp _setting.PokemonConfig.UseLevelUpList = true; _setting.PokemonConfig.AutomaticallyLevelUpPokemon = cbAutoPowerUp.Checked; _setting.PokemonConfig.OnlyUpgradeFavorites = cbPowerUpFav.Checked; _setting.PokemonConfig.LevelUpByCPorIv = cbPowerUpType.SelectedIndex == 0 ? "iv" : "cp"; _setting.PokemonConfig.UpgradePokemonMinimumStatsOperator = cbPowerUpCondiction.SelectedIndex == 0 ? "and" : "or"; _setting.PokemonConfig.GetMinStarDustForLevelUp = ConvertStringToInt(cbPowerUpMinStarDust.Text); _setting.PokemonConfig.UpgradePokemonIvMinimum = ConvertStringToFloat(tbPowerUpMinIV.Text); _setting.PokemonConfig.UpgradePokemonCpMinimum = ConvertStringToFloat(tbPowerUpMinCP.Text); _setting.PokemonsToLevelUp = ConvertClbToList(clbPowerUp); #endregion #region Evo _setting.PokemonConfig.EvolveAllPokemonAboveIv = cbEvoAllAboveIV.Checked; _setting.PokemonConfig.EvolveAboveIvValue = ConvertStringToFloat(tbEvoAboveIV.Text); _setting.PokemonConfig.EvolveAllPokemonWithEnoughCandy = cbEvolveAllPokemonWithEnoughCandy.Checked; _setting.PokemonConfig.KeepPokemonsThatCanEvolve = cbKeepPokemonsThatCanEvolve.Checked; _setting.PokemonConfig.UseLuckyEggsWhileEvolving = cbUseLuckyEggsWhileEvolving.Checked; _setting.PokemonConfig.EvolveKeptPokemonsAtStorageUsagePercentage = ConvertStringToDouble(tbEvolveKeptPokemonsAtStorageUsagePercentage.Text); _setting.PokemonConfig.UseLuckyEggsMinPokemonAmount = ConvertStringToInt(tbUseLuckyEggsMinPokemonAmount.Text); _setting.PokemonsToEvolve = ConvertClbToList(clbEvolve); #endregion #endregion #region Item _setting.PokemonConfig.UseLuckyEggConstantly = cbUseLuckyEggConstantly.Checked; _setting.PokemonConfig.UseIncenseConstantly = cbUseIncenseConstantly.Checked; _setting.RecycleConfig.TotalAmountOfPokeballsToKeep = ConvertStringToInt(tbTotalAmountOfPokeballsToKeep.Text); _setting.RecycleConfig.TotalAmountOfPotionsToKeep = ConvertStringToInt(tbTotalAmountOfPotionsToKeep.Text); _setting.RecycleConfig.TotalAmountOfRevivesToKeep = ConvertStringToInt(tbTotalAmountOfRevivesToKeep.Text); _setting.RecycleConfig.TotalAmountOfBerriesToKeep = ConvertStringToInt(tbTotalAmountOfBerriesToKeep.Text); _setting.RecycleConfig.VerboseRecycling = cbVerboseRecycling.Checked; _setting.RecycleConfig.RecycleInventoryAtUsagePercentage = ConvertStringToDouble(tbRecycleInventoryAtUsagePercentage.Text); #endregion #region Advanced Settings _setting.LocationConfig.DisableHumanWalking = cbDisableHumanWalking.Checked; _setting.LocationConfig.UseWalkingSpeedVariant = cbUseWalkingSpeedVariant.Checked; _setting.LocationConfig.WalkingSpeedVariant = ConvertStringToDouble(tbWalkingSpeedVariantInKilometerPerHour.Text); _setting.LocationConfig.ShowVariantWalking = cbShowWalkingSpeed.Checked; _setting.LocationConfig.MaxSpawnLocationOffset = ConvertStringToInt(tbMaxSpawnLocationOffset.Text); _setting.LocationConfig.MaxTravelDistanceInMeters = ConvertStringToInt(tbMaxTravelDistanceInMeters.Text); _setting.PlayerConfig.DelayBetweenPlayerActions = ConvertStringToInt(tbDelayBetweenPlayerActions.Text); _setting.PokemonConfig.DelayBetweenPokemonCatch = ConvertStringToInt(tbDelayBetweenPokemonCatch.Text); // _setting.PlayerConfig.DelayBetweenRecycle = ConvertStringToInt(tbDelayBetweenRecycle.Text); _setting.RecycleConfig.RandomizeRecycle = cbRandomizeRecycle.Checked; _setting.RecycleConfig.RandomRecycleValue = ConvertStringToInt(tbRandomRecycleValue.Text); _setting.CustomCatchConfig.EnableHumanizedThrows = cbEnableHumanizedThrows.Checked; _setting.CustomCatchConfig.NiceThrowChance = ConvertStringToInt(tbNiceThrowChance.Text); _setting.CustomCatchConfig.GreatThrowChance = ConvertStringToInt(tbGreatThrowChance.Text); _setting.CustomCatchConfig.ExcellentThrowChance = ConvertStringToInt(tbExcellentThrowChance.Text); _setting.CustomCatchConfig.CurveThrowChance = ConvertStringToInt(tbCurveThrowChance.Text); _setting.CustomCatchConfig.ForceGreatThrowOverIv = ConvertStringToDouble(tbForceGreatThrowOverIv.Text); _setting.CustomCatchConfig.ForceExcellentThrowOverIv = ConvertStringToDouble(tbForceExcellentThrowOverIv.Text); _setting.CustomCatchConfig.ForceGreatThrowOverCp = ConvertStringToInt(tbForceGreatThrowOverCp.Text); _setting.CustomCatchConfig.ForceExcellentThrowOverCp = ConvertStringToInt(tbForceExcellentThrowOverCp.Text); #endregion _setting.Save(ConfigFilePath); #endregion Application.Restart(); Close(); } }
public void OnGameLoaded(object sender, PluginEventArgs e) { // Warning: Setting numeric up/down controls to values that are outside their min/max // range will cause an exception and crash the program. It is safest to use // Util.SetNumericUpDown() to set them since it will adjust the value to a valid value // if it is too high or low. CurrentWSG = e.WTM.SaveData; CharacterName.Text = CurrentWSG.CharacterName; Util.SetNumericUpDown(Level, CurrentWSG.Level); if (Level.Value != CurrentWSG.Level) { MessageBox.Show("The character's level was outside the acceptable range. It has been adjusted.\n\nOld: " + CurrentWSG.Level + "\nNew: " + (int)Level.Value); } Util.SetNumericUpDown(Experience, CurrentWSG.Experience); if (Experience.Value != CurrentWSG.Experience) { MessageBox.Show("The character's experience was outside the acceptable range. It has been adjusted.\n\nOld: " + CurrentWSG.Experience + "\nNew: " + (int)Experience.Value); } Util.SetNumericUpDown(SkillPoints, CurrentWSG.SkillPoints); if (SkillPoints.Value != CurrentWSG.SkillPoints) { MessageBox.Show("The character's skill point count was outside the acceptable range. It has been adjusted.\n\nOld: " + CurrentWSG.SkillPoints + "\nNew: " + (int)SkillPoints.Value); } if (CurrentWSG.FinishedPlaythrough1 == 0) { PT2Unlocked.SelectedIndex = 0; } else { PT2Unlocked.SelectedIndex = 1; } // No message when cash is adjusted because it will likely have to be changed on // every load for people who exceed the limit. The spam would be annoying. if (CurrentWSG.Cash < 0) { Util.SetNumericUpDown(Cash, int.MaxValue); } else { Util.SetNumericUpDown(Cash, CurrentWSG.Cash); } Util.SetNumericUpDown(BackpackSpace, CurrentWSG.BackpackSize); if (BackpackSpace.Value != CurrentWSG.BackpackSize) { MessageBox.Show("The character's backpack capacity was outside the acceptable range. It has been adjusted.\n\nOld: " + CurrentWSG.BackpackSize + "\nNew: " + (int)BackpackSpace.Value); } Util.SetNumericUpDown(EquipSlots, CurrentWSG.EquipSlots); Util.SetNumericUpDown(SaveNumber, CurrentWSG.SaveNumber); UI_UpdateCurrentLocationComboBox(CurrentWSG.CurrentLocation); if (!GlobalSettings.customCharacters.ContainsValue("gd_Roland.Character.CharacterClass_Roland")) { foreach (var character in defaultCharacters) { GlobalSettings.customCharacters.Add(character.Key, character.Value); } } string possibleCharacter = "Unknown"; // Some fun string handling to detect a [hopefully] properly formatted character name. // Only do this string handling if it's not a default class. if (!defaultCharacters.ContainsValue(CurrentWSG.Class)) { try { possibleCharacter = Regex.Split(CurrentWSG.Class, "gd_", RegexOptions.IgnoreCase)[1].Split('.')[0]; } catch (IndexOutOfRangeException) { possibleCharacter = CurrentWSG.Class.Split(new string[] { "." }, StringSplitOptions.None)[0]; } if (possibleCharacter == "Unknown") { Class.Text = "Unknown"; } else { if (!GlobalSettings.customCharacters.Keys.Contains(possibleCharacter) && !GlobalSettings.customCharacters.Values.Contains(CurrentWSG.Class)) { GlobalSettings.customCharacters.Add(possibleCharacter, CurrentWSG.Class); } } } // This'll select our current class now that it's been added. foreach (var character in GlobalSettings.customCharacters) { // No duplicates. if (!Class.Items.Contains(character.Key)) { Class.Items.Add(character.Key); } // This'll select our current class now that it's been added. if (character.Value == CurrentWSG.Class) { Class.SelectedIndex = Class.Items.IndexOf(character.Key); } } // If DLC section 1 is not present then the bank does not exist, so disable the // control to prevent the user from editing its size. labelGeneralBankSpace.Enabled = CurrentWSG.DLC.HasSection1; BankSpace.Enabled = CurrentWSG.DLC.HasSection1; if (CurrentWSG.DLC.HasSection1) { Util.SetNumericUpDown(BankSpace, CurrentWSG.DLC.BankSize); if (BankSpace.Value != CurrentWSG.DLC.BankSize) { MessageBox.Show("The character's bank capacity was outside the acceptable range. It has been adjusted.\n\nOld: " + CurrentWSG.BackpackSize + "\nNew: " + (int)BackpackSpace.Value); } } else { Util.SetNumericUpDown(BankSpace, 0); } DoWindowTitle(); Application.DoEvents(); DoLocationTree(); GlobalSettings.Save(); this.Enabled = true; }
private void OnOK(object sender, RoutedEventArgs e) { DialogResult = true; _globalSettings.Save(); }
private void Application_Exit(object sender, ExitEventArgs e) { NotifyIcon.Visible = false; // ScraperCollection.Save(); <-- 読み込みミスって保存したら全部消えてまうやん! GlobalSettings.Save(); }
/// <summary> /// Saves the setting in the application wide folder /// </summary> public override void Save() => GlobalSettings.Save(this);
static public void WinKill() { WindowSettings.Save(windowconfigfile); }