public static void ApplyWizardResults(FormConfigWizard.Results results) { if (results.OnUpdateShowNewFeatures != null) Settings.Value.NotifyOnNewFeatures = results.OnUpdateShowNewFeatures.Value; else Settings.Value.NotifyOnNewFeatures = false; if (results.OnUpdateShowFullChangelog != null) Settings.Value.ChangelogOnEveryUpdate = results.OnUpdateShowFullChangelog.Value; else Settings.Value.ChangelogOnEveryUpdate = false; if (results.OverrideWurmDir != null) { Settings.Value.WurmDirOverride = results.OverrideWurmDir; } }
private void configurationWizardToolStripMenuItem_Click(object sender, EventArgs e) { FormConfigWizard ui = new FormConfigWizard(this); if (ui.ShowDialog() == DialogResult.OK) { AssistantEngine.ApplyWizardResults(ui.results); AssistantEngine.ScheduleSearcherDbWipeOnNextRun(); MessageBox.Show("Wurm Assistant must restart now"); Application.Restart(); } }
//first part of init, close program if this fails //all requirements for starting assistant should be here public static bool Init1_Settings(WurmAssistant mainForm) { AssistantForm = mainForm; SetupDataDirectories(); Logger.SetLogSaveDir(Path.Combine(DataDir, "Logs")); Logger.SetTBOutput(AssistantForm.GetTextBoxForLog()); Logger.SetConsoleHandlingMode(Logger.ConsoleHandlingOption.SendConsoleToLoggerOutputINFO); Logger.LogDiag("-------------"); Logger.LogDiag("-------------"); Logger.LogDiag("STARTING WURM ASSISTANT " + Assembly.GetEntryAssembly().GetName().Version.ToString()); Settings.FilePath = Path.Combine(DataDir, "AssistantSettings.xml"); Logger.LogDiag("loading settings"); bool settingsLoaded = Settings.Load(); AssistantForm.ButtonBuyBeerHidden = BeerButtonHidden; if (!settingsLoaded || !Settings.Value.WizardCompleted) { Logger.LogDiag("launching configuration wizard"); FormConfigWizard wizard = new FormConfigWizard(); if (wizard.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Logger.LogDiag("applying wizard choices"); ApplyWizardResults(wizard.results); Settings.Value.WizardCompleted = true; Logger.LogDiag("saving updated settings"); Settings.Save(); return true; } else return false; } if (Settings.Value.WurmDirOverride != null && !WurmState.WurmClient.InitSuccessful) { WurmState.WurmClient.OverrideWurmDir(Settings.Value.WurmDirOverride); } return true; }