protected override void OnLoad(EventArgs e) { Location = m_Configuration.WindowLoc; Size = m_Configuration.WindowSize; if (!m_Configuration.CheckForUpdatesOnLaunchNoNag) { log.Debug("Asking user if they wish for autoupdates"); if (new AskUserForAutoUpdatesDialog().ShowDialog() == DialogResult.OK) { m_Configuration.CheckForUpdatesOnLaunch = true; } m_Configuration.CheckForUpdatesOnLaunchNoNag = true; m_Configuration.Save(); } if (m_Configuration.CheckForUpdatesOnLaunch) { try { log.Info("Making autoupdate call"); var latest_version = AutoUpdate.FetchLatestCkanVersion(); var current_version = new Version(Meta.Version()); if (latest_version.IsGreaterThan(current_version)) { log.Debug("Found higher ckan version"); var release_notes = AutoUpdate.FetchLatestCkanVersionReleaseNotes(); var dialog = new NewUpdateDialog(latest_version.ToString(), release_notes); if (dialog.ShowDialog() == DialogResult.OK) { log.Info("Start ckan update"); AutoUpdate.StartUpdateProcess(true); } } } catch (Exception exception) { m_User.RaiseError("Error in autoupdate: \n\t" + exception.Message + ""); log.Error("Error in autoupdate", exception); } } m_UpdateRepoWorker = new BackgroundWorker { WorkerReportsProgress = false, WorkerSupportsCancellation = true }; m_UpdateRepoWorker.RunWorkerCompleted += PostUpdateRepo; m_UpdateRepoWorker.DoWork += UpdateRepo; m_InstallWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; m_InstallWorker.RunWorkerCompleted += PostInstallMods; m_InstallWorker.DoWork += InstallMods; m_CacheWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; m_CacheWorker.RunWorkerCompleted += PostModCaching; m_CacheWorker.DoWork += CacheMod; m_User.displayYesNo = YesNoDialog; URLHandlers.RegisterURLHandler(m_Configuration, m_User); m_User.displayYesNo = null; ApplyToolButton.Enabled = false; CurrentInstanceUpdated(); if (m_Configuration.RefreshOnStartup) { UpdateRepo(); } Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Kerbal Space Program {0}", CurrentInstance.Version()); if (m_CommandLineArgs.Length >= 2) { var identifier = m_CommandLineArgs[1]; if (identifier.StartsWith("//")) { identifier = identifier.Substring(2); } else if (identifier.StartsWith("ckan://")) { identifier = identifier.Substring(7); } if (identifier.EndsWith("/")) { identifier = identifier.Substring(0, identifier.Length - 1); } int i = 0; log.Debug("Attempting to select mod from startup parameters"); foreach (DataGridViewRow row in ModList.Rows) { var module = ((GUIMod)row.Tag); if (identifier == module.Identifier) { ModList.FirstDisplayedScrollingRowIndex = i; row.Selected = true; break; } i++; } log.Debug("Failed to select mod from startup parameters"); } var pluginsPath = Path.Combine(CurrentInstance.CkanDir(), "Plugins"); if (!Directory.Exists(pluginsPath)) { Directory.CreateDirectory(pluginsPath); } m_PluginController = new PluginController(pluginsPath, true); log.Info("GUI started"); ModList.Select(); base.OnLoad(e); }