diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-11-21 14:10:09 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-11-21 14:10:09 -0500 |
commit | 85b947dced10f5398055af36b5fdb6b8d32a6a6b (patch) | |
tree | efc2f877a6f41869a40b6d0a320e6d5c4fd591ca /src/SMAPI/Framework/SCore.cs | |
parent | e20d26adcf7276c7f12ab9ab6ea0311953aa5194 (diff) | |
parent | a0cb83ed406fc0447e8edf00e680585005480d23 (diff) | |
download | SMAPI-85b947dced10f5398055af36b5fdb6b8d32a6a6b.tar.gz SMAPI-85b947dced10f5398055af36b5fdb6b8d32a6a6b.tar.bz2 SMAPI-85b947dced10f5398055af36b5fdb6b8d32a6a6b.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/SCore.cs')
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index f07e41f0..1b4c32bb 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1195,37 +1195,42 @@ namespace StardewModdingAPI.Framework this.Monitor.Log("Checking for updates..."); // check SMAPI version - ISemanticVersion updateFound = null; - try { - // fetch update check - ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Pathoschild.SMAPI", Constants.ApiVersion, new[] { $"GitHub:{this.Settings.GitHubProjectName}" }) }, apiVersion: Constants.ApiVersion, gameVersion: Constants.GameVersion, platform: Constants.Platform).Single().Value; - if (response.SuggestedUpdate != null) - this.Monitor.Log($"You can update SMAPI to {response.SuggestedUpdate.Version}: {Constants.HomePageUrl}", LogLevel.Alert); - else - this.Monitor.Log(" SMAPI okay."); - - updateFound = response.SuggestedUpdate?.Version; + ISemanticVersion updateFound = null; + string updateUrl = null; + try + { + // fetch update check + ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Pathoschild.SMAPI", Constants.ApiVersion, new[] { $"GitHub:{this.Settings.GitHubProjectName}" }) }, apiVersion: Constants.ApiVersion, gameVersion: Constants.GameVersion, platform: Constants.Platform).Single().Value; + updateFound = response.SuggestedUpdate?.Version; + updateUrl = response.SuggestedUpdate?.Url ?? Constants.HomePageUrl; + + // log message + if (updateFound != null) + this.Monitor.Log($"You can update SMAPI to {updateFound}: {updateUrl}", LogLevel.Alert); + else + this.Monitor.Log(" SMAPI okay."); - // show errors - if (response.Errors.Any()) + // show errors + if (response.Errors.Any()) + { + this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you may not be notified of new versions if this keeps happening.", LogLevel.Warn); + this.Monitor.Log($"Error: {string.Join("\n", response.Errors)}"); + } + } + catch (Exception ex) { - this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you may not be notified of new versions if this keeps happening.", LogLevel.Warn); - this.Monitor.Log($"Error: {string.Join("\n", response.Errors)}"); + this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you won't be notified of new versions if this keeps happening.", LogLevel.Warn); + this.Monitor.Log(ex is WebException && ex.InnerException == null + ? $"Error: {ex.Message}" + : $"Error: {ex.GetLogSummary()}" + ); } - } - catch (Exception ex) - { - this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you won't be notified of new versions if this keeps happening.", LogLevel.Warn); - this.Monitor.Log(ex is WebException && ex.InnerException == null - ? $"Error: {ex.Message}" - : $"Error: {ex.GetLogSummary()}" - ); - } - // show update message on next launch - if (updateFound != null) - this.LogManager.WriteUpdateMarker(updateFound.ToString()); + // show update message on next launch + if (updateFound != null) + this.LogManager.WriteUpdateMarker(updateFound.ToString(), updateUrl); + } // check mod versions if (mods.Any()) |