public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Kerbal Space Program {0}", CurrentInstance.Version()); }); // Update the settings dialog to reflect the changes made. Util.Invoke(m_SettingsDialog, () => { m_SettingsDialog.UpdateDialog(); }); m_Configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)m_Configuration.ActiveFilter); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); }); configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) { CompatibleKspVersionsDialog dialog = new CompatibleKspVersionsDialog(CurrentInstance); dialog.ShowDialog(); } UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
public void UpdateDialog() { RefreshReposListBox(); LocalVersionLabel.Text = Meta.Version(); CheckUpdateOnLaunchCheckbox.Checked = Main.Instance.configuration.CheckForUpdatesOnLaunch; RefreshOnStartupCheckbox.Checked = Main.Instance.configuration.RefreshOnStartup; UpdateCacheInfo(); }
public void UpdateDialog() { RefreshReposListBox(); KSPInstallPathLabel.Text = Main.Instance.CurrentInstance.GameDir(); LocalVersionLabel.Text = Meta.Version(); CheckUpdateOnLaunchCheckbox.Checked = Main.Instance.m_Configuration.CheckForUpdatesOnLaunch; UpdateCacheInfo(); }
public static Version FetchLatestCkanVersion() { try { FetchUpdaterUrl(); FetchCkanUrl(); } catch (Kraken) { return(new Version(Meta.Version())); } var response = MakeRequest(latestCKANReleaseApiUrl); return(new CKANVersion(response.tag_name.ToString(), response.name.ToString())); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); }); configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
/// <summary> /// Fetches all the latest release info, populating our attributes in /// the process. /// </summary> public void FetchLatestReleaseInfo() { var response = MakeRequest(latestCKANReleaseApiUrl); try { fetchedUpdaterUrl = RetrieveUrl(MakeRequest(latestUpdaterReleaseApiUrl)); fetchedCkanUrl = RetrieveUrl(response); } catch (Kraken) { LatestVersion = new Version(Meta.Version()); return; } string body = response.body.ToString(); ReleaseNotes = ExtractReleaseNotes(body); LatestVersion = new CKANVersion(response.tag_name.ToString(), response.name.ToString()); }
/// <summary> /// Fetches all the latest release info, populating our attributes in /// the process. /// </summary> public void FetchLatestReleaseInfo() { var response = MakeRequest(latestCKANReleaseApiUrl); try { fetchedUpdaterUrl = RetrieveUrl(response, "cfan_updater.exe"); fetchedCkanUrl = RetrieveUrl(response, "cfan.exe"); } catch (Kraken) { LatestVersion = new CFANVersion(Meta.Version(), ""); return; } string body = (string)response["body"]; ReleaseNotes = ExtractReleaseNotes(body); LatestVersion = new CFANVersion((string)response["tag_name"], (string)response["name"]); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CFAN {0} - Factorio {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Factorio {0}", CurrentInstance.Version()); }); m_Configuration = Configuration.LoadOrCreateConfiguration ( CurrentInstance.findFactorioBinaryPath(), Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)m_Configuration.ActiveFilter); }
private void CheckForUpdatesButton_Click(object sender, EventArgs e) { try { var latestVersion = AutoUpdate.FetchLatestCkanVersion(); if (latestVersion.IsGreaterThan(new Version(Meta.Version()))) { InstallUpdateButton.Enabled = true; } else { InstallUpdateButton.Enabled = false; } LatestVersionLabel.Text = latestVersion.ToString(); } catch (Exception ex) { } }
private void CheckForUpdatesButton_Click(object sender, EventArgs e) { try { AutoUpdate.Instance.FetchLatestReleaseInfo(); var latestVersion = AutoUpdate.Instance.LatestVersion; if (latestVersion.IsGreaterThan(new Version(Meta.Version())) && AutoUpdate.Instance.IsFetched()) { InstallUpdateButton.Enabled = true; } else { InstallUpdateButton.Enabled = false; } LatestVersionLabel.Text = latestVersion.ToString(); } catch (Exception ex) { log.Warn("Exception caught in CheckForUpdates:\r\n" + ex); } }
private void Main_Load(object sender, EventArgs e) { 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; UpdateModsList(); ApplyToolButton.Enabled = false; ModList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); Text = String.Format("CKAN {0} - KSP {1}", Meta.Version(), CurrentInstance.Version()); KSPVersionLabel.Text = String.Format("Kerbal Space Program {0}", CurrentInstance.Version()); }
private bool InstallList(HashSet <string> toInstall, RelationshipResolverOptions options, NetAsyncDownloader downloader) { if (toInstall.Any()) { // actual magic happens here, we run the installer with our mod list ModuleInstaller.GetInstance(manager.CurrentInstance, GUI.user).onReportModInstalled = OnModInstalled; cancelCallback = downloader.CancelDownload; try { ModuleInstaller.GetInstance(manager.CurrentInstance, GUI.user) .InstallList(toInstall.ToList(), options, downloader); } catch (ModuleNotFoundKraken ex) { GUI.user.RaiseMessage("Module {0} required, but not listed in index, or not available for your version of KSP", ex.module); return(false); } catch (BadMetadataKraken ex) { GUI.user.RaiseMessage("Bad metadata detected for module {0}: {1}", ex.module, ex.Message); return(false); } catch (FileExistsKraken ex) { if (ex.owning_module != null) { GUI.user.RaiseMessage( "\nOh no! We tried to overwrite a file owned by another mod!\n" + "Please try a `ckan update` and try again.\n\n" + "If this problem re-occurs, then it maybe a packaging bug.\n" + "Please report it at:\n\n" + "https://github.com/KSP-CKAN/CKAN-meta/issues/new\n\n" + "Please including the following information in your report:\n\n" + "File : {0}\n" + "Installing Mod : {1}\n" + "Owning Mod : {2}\n" + "CKAN Version : {3}\n", ex.filename, ex.installing_module, ex.owning_module, Meta.Version() ); } else { GUI.user.RaiseMessage( "\n\nOh no!\n\n" + "It looks like you're trying to install a mod which is already installed,\n" + "or which conflicts with another mod which is already installed.\n\n" + "As a safety feature, the CKAN will *never* overwrite or alter a file\n" + "that it did not install itself.\n\n" + "If you wish to install {0} via the CKAN,\n" + "then please manually uninstall the mod which owns:\n\n" + "{1}\n\n" + "and try again.\n", ex.installing_module, ex.filename ); } GUI.user.RaiseMessage("Your GameData has been returned to its original state.\n"); return(false); } catch (InconsistentKraken ex) { // The prettiest Kraken formats itself for us. GUI.user.RaiseMessage(ex.InconsistenciesPretty); return(false); } catch (CancelledActionKraken) { return(false); } catch (MissingCertificateKraken kraken) { // Another very pretty kraken. GUI.user.RaiseMessage(kraken.ToString()); return(false); } catch (DownloadErrorsKraken) { // User notified in InstallList return(false); } } return(true); }
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; UpdateModsList(); m_User.displayYesNo = YesNoDialog; URLHandlers.RegisterURLHandler(m_Configuration, m_User); m_User.displayYesNo = null; ApplyToolButton.Enabled = false; CurrentInstanceUpdated(); ModList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); 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).ToCkanModule(); 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"); base.OnLoad(e); }
/// <summary> /// Helper function to wrap around calls to ModuleInstaller. /// Handles some of the possible krakens and displays user friendly messages for them. /// </summary> private static bool WasSuccessful(Action action) { try { action(); } catch (ModuleNotFoundKraken ex) { GUI.user.RaiseMessage( "Module {0} required, but not listed in index, or not available for your version of KSP", ex.module); return(false); } catch (BadMetadataKraken ex) { GUI.user.RaiseMessage("Bad metadata detected for module {0}: {1}", ex.module, ex.Message); return(false); } catch (FileExistsKraken ex) { if (ex.owning_module != null) { GUI.user.RaiseMessage( "\nOh no! We tried to overwrite a file owned by another mod!\n" + "Please try a `ckan update` and try again.\n\n" + "If this problem re-occurs, then it maybe a packaging bug.\n" + "Please report it at:\n\n" + "https://github.com/KSP-CKAN/CKAN-meta/issues/new\n\n" + "Please including the following information in your report:\n\n" + "File : {0}\n" + "Installing Mod : {1}\n" + "Owning Mod : {2}\n" + "CKAN Version : {3}\n", ex.filename, ex.installing_module, ex.owning_module, Meta.Version() ); } else { GUI.user.RaiseMessage( "\n\nOh no!\n\n" + "It looks like you're trying to install a mod which is already installed,\n" + "or which conflicts with another mod which is already installed.\n\n" + "As a safety feature, the CKAN will *never* overwrite or alter a file\n" + "that it did not install itself.\n\n" + "If you wish to install {0} via the CKAN,\n" + "then please manually uninstall the mod which owns:\n\n" + "{1}\n\n" + "and try again.\n", ex.installing_module, ex.filename ); } GUI.user.RaiseMessage("Your GameData has been returned to its original state.\n"); return(false); } catch (InconsistentKraken ex) { // The prettiest Kraken formats itself for us. GUI.user.RaiseMessage(ex.InconsistenciesPretty); return(false); } catch (CancelledActionKraken) { return(false); } catch (MissingCertificateKraken kraken) { // Another very pretty kraken. GUI.user.RaiseMessage(kraken.ToString()); return(false); } catch (DownloadErrorsKraken) { // User notified in InstallList return(false); } catch (DirectoryNotFoundKraken kraken) { GUI.user.RaiseMessage("\n{0}", kraken.Message); return(false); } return(true); }
protected override void OnLoad(EventArgs e) { enableTls2IfPossible(); Location = m_Configuration.WindowLoc; Size = m_Configuration.WindowSize; if (CurrentInstance.lacksFactorioAuthData()) { m_User.RaiseError( "Your config file located in {0} does not contain Factorio authorization data. Mods from official factorio.com mod portal will not be shown.\n\rYou can fix it by launching Factorio, entering in-game mod manager (mods -> install mods), quitting the game and restarting CFAN.", new object[] { CurrentInstance.getFactorioAuthDataPath() } ); } 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"); AutoUpdate.Instance.FetchLatestReleaseInfo(); var latest_version = AutoUpdate.Instance.LatestVersion; var current_version = new CFANVersion(Meta.Version(), ""); if (AutoUpdate.Instance.IsFetched() && latest_version.IsGreaterThan(current_version)) { log.Debug("Found higher cfan version"); var release_notes = AutoUpdate.Instance.ReleaseNotes; var dialog = new NewUpdateDialog(latest_version.ToString(), release_notes); if (dialog.ShowDialog() == DialogResult.OK) { log.Info("Start cfan update"); BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += (sender, args) => AutoUpdate.Instance.StartUpdateProcess(true, PleaseWait.User); bw.RunWorkerAsync(); new PleaseWait().ShowDialog(this); } } } 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; var old_YesNoDialog = m_User.displayYesNo; m_User.displayYesNo = YesNoDialog; //URLHandlers.RegisterURLHandler(m_Configuration, m_User); m_User.displayYesNo = old_YesNoDialog; ApplyToolButton.Enabled = false; CurrentInstanceUpdated(); CheckForConsistency(); if (m_Configuration.RefreshOnStartup) { UpdateRepo(); } Text = String.Format("CFAN {0} - Factorio {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Factorio {0}", CurrentInstance.Version()); if (m_CommandLineArgs.Length >= 2) { var identifier = m_CommandLineArgs[1]; if (identifier.StartsWith("//")) { identifier = identifier.Substring(2); } else if (identifier.StartsWith("cfan://")) { identifier = identifier.Substring(7); } if (identifier.EndsWith("/")) { identifier = identifier.Substring(0, identifier.Length - 1); } log.Debug("Attempting to select mod from startup parameters"); FocusMod(identifier, true, true); ModList.Refresh(); 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); CurrentInstance.RebuildKSPSubDir(); log.Info("GUI started"); base.OnLoad(e); }
private void Main_Load(object sender, EventArgs e) { 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; UpdateModsList(); m_User.displayYesNo = YesNoDialog; URLHandlers.RegisterURLHandler(m_Configuration, m_User); m_User.displayYesNo = null; ApplyToolButton.Enabled = false; ModList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); Text = String.Format("CKAN {0} - KSP {1}", Meta.Version(), CurrentInstance.Version()); 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; foreach (DataGridViewRow row in ModList.Rows) { var module = ((GUIMod)row.Tag).ToCkanModule(); if (identifier == module.identifier) { ModList.FirstDisplayedScrollingRowIndex = i; row.Selected = true; break; } i++; } } var pluginsPath = Path.Combine(CurrentInstance.CkanDir(), "Plugins"); if (!Directory.Exists(pluginsPath)) { Directory.CreateDirectory(pluginsPath); } m_PluginController = new PluginController(pluginsPath, true); }
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"); AutoUpdate.Instance.FetchLatestReleaseInfo(); var latest_version = AutoUpdate.Instance.LatestVersion; var current_version = new Version(Meta.Version()); if (AutoUpdate.Instance.IsFetched() && latest_version.IsGreaterThan(current_version)) { log.Debug("Found higher ckan version"); var release_notes = AutoUpdate.Instance.ReleaseNotes; var dialog = new NewUpdateDialog(latest_version.ToString(), release_notes); if (dialog.ShowDialog() == DialogResult.OK) { log.Info("Start ckan update"); AutoUpdate.Instance.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; var old_YesNoDialog = m_User.displayYesNo; m_User.displayYesNo = YesNoDialog; URLHandlers.RegisterURLHandler(m_Configuration, m_User); m_User.displayYesNo = old_YesNoDialog; 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); } log.Debug("Attempting to select mod from startup parameters"); FocusMod(identifier, true, true); ModList.Refresh(); 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); CurrentInstance.RebuildKSPSubDir(); log.Info("GUI started"); base.OnLoad(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel3 = new System.Windows.Forms.LinkLabel(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.linkLabel5 = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // label1 // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(317, 20); this.label1.TabIndex = 0; this.label1.Text = "CKAN - The Comprehensive Kerbal Archive Network"; this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(0, 8); this.linkLabel1.Location = new System.Drawing.Point(140, 29); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(43, 17); this.linkLabel1.TabIndex = 1; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "License"; this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel1.UseCompatibleTextRendering = true; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // // linkLabel2 // this.linkLabel2.AutoSize = true; this.linkLabel2.LinkArea = new System.Windows.Forms.LinkArea(0, 7); this.linkLabel2.Location = new System.Drawing.Point(141, 56); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing.Size(43, 13); this.linkLabel2.TabIndex = 2; this.linkLabel2.TabStop = true; this.linkLabel2.Text = "Authors"; this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // // linkLabel3 // this.linkLabel3.AutoSize = true; this.linkLabel3.LinkArea = new System.Windows.Forms.LinkArea(0, 6); this.linkLabel3.Location = new System.Drawing.Point(52, 84); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing.Size(41, 13); this.linkLabel3.TabIndex = 3; this.linkLabel3.TabStop = true; this.linkLabel3.Text = "Source"; this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked); // // linkLabel4 // this.linkLabel4.AutoSize = true; this.linkLabel4.LinkArea = new System.Windows.Forms.LinkArea(0, 12); this.linkLabel4.Location = new System.Drawing.Point(213, 84); this.linkLabel4.Name = "linkLabel4"; this.linkLabel4.Size = new System.Drawing.Size(73, 13); this.linkLabel4.TabIndex = 4; this.linkLabel4.TabStop = true; this.linkLabel4.Text = "Forum Thread"; this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); // // label2 // this.label2.Location = new System.Drawing.Point(79, 106); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(184, 18); this.label2.TabIndex = 5; this.label2.Text = "Version " + Meta.Version(); this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // linkLabel5 // this.linkLabel5.LinkArea = new System.Windows.Forms.LinkArea(0, 15); this.linkLabel5.Location = new System.Drawing.Point(125, 84); this.linkLabel5.Name = "linkLabel5"; this.linkLabel5.Size = new System.Drawing.Size(71, 13); this.linkLabel5.TabIndex = 6; this.linkLabel5.TabStop = true; this.linkLabel5.Text = "Homepage"; this.linkLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel5.UseCompatibleTextRendering = true; this.linkLabel5.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel5_LinkClicked); // // AboutDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(341, 133); this.Controls.Add(this.linkLabel5); this.Controls.Add(this.label2); this.Controls.Add(this.linkLabel4); this.Controls.Add(this.linkLabel3); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AboutDialog"; this.Text = "About"; this.ResumeLayout(false); this.PerformLayout(); }
protected override void OnLoad(EventArgs e) { Location = configuration.WindowLoc; Size = configuration.WindowSize; if (!configuration.CheckForUpdatesOnLaunchNoNag) { log.Debug("Asking user if they wish for autoupdates"); if (new AskUserForAutoUpdatesDialog().ShowDialog() == DialogResult.OK) { configuration.CheckForUpdatesOnLaunch = true; } configuration.CheckForUpdatesOnLaunchNoNag = true; configuration.Save(); } bool autoUpdating = false; if (configuration.CheckForUpdatesOnLaunch) { try { log.Info("Making autoupdate call"); AutoUpdate.Instance.FetchLatestReleaseInfo(); var latest_version = AutoUpdate.Instance.LatestVersion; var current_version = new Version(Meta.Version()); if (AutoUpdate.Instance.IsFetched() && latest_version.IsGreaterThan(current_version)) { log.Debug("Found higher ckan version"); var release_notes = AutoUpdate.Instance.ReleaseNotes; var dialog = new NewUpdateDialog(latest_version.ToString(), release_notes); if (dialog.ShowDialog() == DialogResult.OK) { UpdateCKAN(); autoUpdating = true; } } } catch (Exception exception) { currentUser.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; installWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; installWorker.RunWorkerCompleted += PostInstallMods; installWorker.DoWork += InstallMods; var old_YesNoDialog = currentUser.displayYesNo; currentUser.displayYesNo = YesNoDialog; URLHandlers.RegisterURLHandler(configuration, currentUser); currentUser.displayYesNo = old_YesNoDialog; ApplyToolButton.Enabled = false; CurrentInstanceUpdated(); // if we're autoUpdating then we shouldn't interfere progress tab if (configuration.RefreshOnStartup && !autoUpdating) { UpdateRepo(); } Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); if (commandLineArgs.Length >= 2) { var identifier = 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); } log.Debug("Attempting to select mod from startup parameters"); FocusMod(identifier, true, true); ModList.Refresh(); log.Debug("Failed to select mod from startup parameters"); } var pluginsPath = Path.Combine(CurrentInstance.CkanDir(), "Plugins"); if (!Directory.Exists(pluginsPath)) { Directory.CreateDirectory(pluginsPath); } pluginController = new PluginController(pluginsPath, true); CurrentInstance.RebuildKSPSubDir(); NavInit(); // initialize navigation. this should be called as late // as possible, once the UI is "settled" from its initial // load. log.Info("GUI started"); base.OnLoad(e); }