private void ConfigureSettings() { bool oldCoinWarzValue = applicationConfiguration.UseCoinWarzApi; string oldCoinWarzKey = applicationConfiguration.CoinWarzApiKey; SettingsForm settingsForm = new SettingsForm(applicationConfiguration, engineConfiguration.XgminerConfiguration, pathConfiguration); DialogResult dialogResult = settingsForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { Application.DoEvents(); pathConfiguration.SavePathConfiguration(); //save settings as the "shared" config path may have changed //these are settings not considered machine/device-specific //e.g. no device settings, no miner settings engineConfiguration.SaveMinerConfiguration(); applicationConfiguration.SaveApplicationConfiguration(pathConfiguration.SharedConfigPath); perksConfiguration.SavePerksConfiguration(pathConfiguration.SharedConfigPath); engineConfiguration.SaveCoinConfigurations(pathConfiguration.SharedConfigPath); engineConfiguration.SaveStrategyConfiguration(pathConfiguration.SharedConfigPath); SaveKnownCoinsToFile(); SetupCoinApi(); RefreshCoinApiLabel(); crashRecoveryTimer.Enabled = applicationConfiguration.RestartCrashedMiners; SetupRestartTimer(); CheckForUpdates(); //don't refresh coin stats excessively if ((oldCoinWarzValue != applicationConfiguration.UseCoinWarzApi) || !oldCoinWarzKey.Equals(applicationConfiguration.CoinWarzApiKey)) RefreshCoinStats(); SetupAccessibleMenu(); SetGpuEnvironmentVariables(); Application.DoEvents(); } else { engineConfiguration.LoadMinerConfiguration(); pathConfiguration.LoadPathConfiguration(); applicationConfiguration.LoadApplicationConfiguration(pathConfiguration.SharedConfigPath); } }
private void ConfigureSettingsRemotely() { ApplicationConfiguration workingApplicationConfiguration = new ApplicationConfiguration(); EngineConfiguration workingEngineConfiguration = new EngineConfiguration(); PathConfiguration workingPathConfiguration = new PathConfiguration(); GetRemoteApplicationConfiguration(this.selectedRemoteInstance); ObjectCopier.CopyObject(this.remoteApplicationConfig, workingApplicationConfiguration); ObjectCopier.CopyObject(this.remoteEngineConfig, workingEngineConfiguration); ObjectCopier.CopyObject(this.remotePathConfig, workingPathConfiguration); SettingsForm settingsForm = new SettingsForm(workingApplicationConfiguration, workingEngineConfiguration.XgminerConfiguration, workingPathConfiguration); settingsForm.Text = String.Format("{0}: {1}", settingsForm.Text, this.selectedRemoteInstance.MachineName); DialogResult dialogResult = settingsForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { ObjectCopier.CopyObject(workingApplicationConfiguration, this.remoteApplicationConfig); ObjectCopier.CopyObject(workingEngineConfiguration, this.remoteEngineConfig); ObjectCopier.CopyObject(workingPathConfiguration, this.remotePathConfig); SetConfigurationRemotely(this.selectedRemoteInstance, this.remoteApplicationConfig, this.remoteEngineConfig, this.remotePathConfig, null); } }
private void ConfigureSettings() { bool oldCoinWarzValue = applicationConfiguration.UseCoinWarzApi; string oldCoinWarzKey = applicationConfiguration.CoinWarzApiKey; string oldConfigPath = pathConfiguration.SharedConfigPath; SettingsForm settingsForm = new SettingsForm(applicationConfiguration, engineConfiguration.XgminerConfiguration, pathConfiguration); DialogResult dialogResult = settingsForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { Application.DoEvents(); pathConfiguration.SavePathConfiguration(); //save settings as the "shared" config path may have changed //these are settings not considered machine/device-specific //e.g. no device settings, no miner settings string newConfigPath = pathConfiguration.SharedConfigPath; //if the shared config path changed, and there are already settings //in that path, load those settings (so they aren't overwritten) //idea being the user has shared settings already there they want to use if (!Path.Equals(oldConfigPath, newConfigPath)) { if (File.Exists(Path.Combine(newConfigPath, Path.GetFileName(applicationConfiguration.ApplicationConfigurationFileName())))) applicationConfiguration.LoadApplicationConfiguration(newConfigPath); if (File.Exists(Path.Combine(newConfigPath, Path.GetFileName(perksConfiguration.PerksConfigurationFileName())))) perksConfiguration.LoadPerksConfiguration(newConfigPath); if (File.Exists(Path.Combine(newConfigPath, Path.GetFileName(engineConfiguration.CoinConfigurationsFileName())))) engineConfiguration.LoadCoinConfigurations(newConfigPath); if (File.Exists(Path.Combine(newConfigPath, Path.GetFileName(engineConfiguration.StrategyConfigurationsFileName())))) engineConfiguration.LoadStrategyConfiguration(newConfigPath); } applicationConfiguration.SaveApplicationConfiguration(newConfigPath); perksConfiguration.SavePerksConfiguration(newConfigPath); engineConfiguration.SaveCoinConfigurations(newConfigPath); engineConfiguration.SaveStrategyConfiguration(newConfigPath); engineConfiguration.SaveMinerConfiguration(); SaveKnownCoinsToFile(); SetupCoinApi(); RefreshCoinApiLabel(); crashRecoveryTimer.Enabled = applicationConfiguration.RestartCrashedMiners; SetupRestartTimer(); CheckForUpdates(); SetupCoinStatsTimer(); SuggestCoinsToMine(); //don't refresh coin stats excessively if ((oldCoinWarzValue != applicationConfiguration.UseCoinWarzApi) || !oldCoinWarzKey.Equals(applicationConfiguration.CoinWarzApiKey)) RefreshCoinStats(); SetupAccessibleMenu(); SetGpuEnvironmentVariables(); Application.DoEvents(); } else { engineConfiguration.LoadMinerConfiguration(); pathConfiguration.LoadPathConfiguration(); applicationConfiguration.LoadApplicationConfiguration(pathConfiguration.SharedConfigPath); } }
private void ConfigureSettingsLocally() { bool oldCoinWarzValue = applicationConfiguration.UseCoinWarzApi; string oldCoinWarzKey = applicationConfiguration.CoinWarzApiKey; string oldConfigPath = pathConfiguration.SharedConfigPath; SettingsForm settingsForm = new SettingsForm(applicationConfiguration, engineConfiguration.XgminerConfiguration, pathConfiguration); DialogResult dialogResult = settingsForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { Application.DoEvents(); pathConfiguration.SavePathConfiguration(); //save settings as the "shared" config path may have changed //these are settings not considered machine/device-specific //e.g. no device settings, no miner settings string newConfigPath = pathConfiguration.SharedConfigPath; MigrateSettingsToNewFolder(oldConfigPath, newConfigPath); applicationConfiguration.SaveApplicationConfiguration(newConfigPath); perksConfiguration.SavePerksConfiguration(newConfigPath); engineConfiguration.SaveCoinConfigurations(newConfigPath); engineConfiguration.SaveStrategyConfiguration(newConfigPath); engineConfiguration.SaveMinerConfiguration(); SaveKnownCoinsToFile(); //don't refresh coin stats excessively if ((oldCoinWarzValue != applicationConfiguration.UseCoinWarzApi) || !oldCoinWarzKey.Equals(applicationConfiguration.CoinWarzApiKey)) RefreshCoinStats(); RefreshViewForConfigurationChanges(); } else { engineConfiguration.LoadMinerConfiguration(); pathConfiguration.LoadPathConfiguration(); applicationConfiguration.LoadApplicationConfiguration(pathConfiguration.SharedConfigPath); } }
private void ShowApplicationSettings() { SettingsForm settingsForm = new SettingsForm(applicationConfiguration, engineConfiguration.XgminerConfiguration); DialogResult dialogResult = settingsForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { Application.DoEvents(); bool wasMining = miningEngine.Mining; StopMining(); // or USB devices may be in use for RefreshDevices() call below engineConfiguration.SaveMinerConfiguration(); applicationConfiguration.SaveApplicationConfiguration(); RefreshDevices(); RefreshBackendLabel(); crashRecoveryTimer.Enabled = applicationConfiguration.RestartCrashedMiners; SetupRestartTimer(); CheckForUpdates(); Application.DoEvents(); if (wasMining) StartMining(); } else { engineConfiguration.LoadMinerConfiguration(); applicationConfiguration.LoadApplicationConfiguration(); } }