internal static async Task Update() { #if DEBUG return; #endif await Task.Run(() => { try { Logger.Info("Checking for a new version of CoolFish"); var latestInfo = GithubAPI.GetLatestVersionId(); if (latestInfo.HasValue) { Logger.Info("A new version of CoolFish was found. Downloading the latest version."); MessageBox.Show("A new version of CoolFish was found. We will now update to the latest version", "Update Required", MessageBoxButtons.OK); GithubAPI.DownloadAsset(latestInfo.Value); Logger.Info("Download Complete."); MessageBox.Show("The download has completed. Please extract the zip file in the CoolFish directory. This application will now close."); BotManager.SafeShutdown(); } else { Logger.Info("No new versions available."); } } catch (Exception ex) { Logger.Warn("Exception thrown while trying to check for a new version", ex); } }); }
internal static async Task Update() { await Task.Run(() => { try { Logger.Info("Checking for a new version of CoolFish"); Tuple <int, string> latestInfo = GithubAPI.GetLatestVersionInfo(); if (latestInfo != null) { Logger.Info("A new version of CoolFish was found. Downloading the latest version."); MessageBox.Show("A new version of CoolFish was found. We will now update to the latest version", "Update Required", MessageBoxButtons.OK); GithubAPI.DownloadAsset(latestInfo.Item1, latestInfo.Item2); } else { Logger.Info("No new versions available."); } } catch (Exception ex) { Logger.Warn("Exception thrown while trying to check for a new version", ex); } }); }