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/Logging | |
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/Logging')
-rw-r--r-- | src/SMAPI/Framework/Logging/LogManager.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs index 094dd749..1e484709 100644 --- a/src/SMAPI/Framework/Logging/LogManager.cs +++ b/src/SMAPI/Framework/Logging/LogManager.cs @@ -195,9 +195,10 @@ namespace StardewModdingAPI.Framework.Logging /// <summary>Write an update alert marker file.</summary> /// <param name="version">The new version found.</param> - public void WriteUpdateMarker(string version) + /// <param name="url">The download URL for the update.</param> + public void WriteUpdateMarker(string version, string url) { - File.WriteAllText(Constants.UpdateMarker, version); + File.WriteAllText(Constants.UpdateMarker, $"{version}|{url}"); } /// <summary>Check whether SMAPI crashed or detected an update during the last session, and display them in the SMAPI console.</summary> @@ -206,13 +207,17 @@ namespace StardewModdingAPI.Framework.Logging // show update alert if (File.Exists(Constants.UpdateMarker)) { - string rawUpdateFound = File.ReadAllText(Constants.UpdateMarker); - if (SemanticVersion.TryParse(rawUpdateFound, out ISemanticVersion updateFound)) + string[] rawUpdateFound = File.ReadAllText(Constants.UpdateMarker).Split(new [] { '|' }, 2); + if (SemanticVersion.TryParse(rawUpdateFound[0], out ISemanticVersion updateFound)) { if (Constants.ApiVersion.IsPrerelease() && updateFound.IsNewerThan(Constants.ApiVersion)) { + string url = rawUpdateFound.Length > 1 + ? rawUpdateFound[1] + : Constants.HomePageUrl; + this.Monitor.Log("A new version of SMAPI was detected last time you played.", LogLevel.Error); - this.Monitor.Log($"You can update to {updateFound}: https://smapi.io.", LogLevel.Error); + this.Monitor.Log($"You can update to {updateFound}: {url}.", LogLevel.Error); this.Monitor.Log("Press any key to continue playing anyway. (This only appears when using a SMAPI beta.)", LogLevel.Info); Console.ReadKey(); } |