diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-24 19:55:34 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-24 19:55:34 -0400 |
commit | b105c97dda01441d503d31e8b8ac0b3fd35fef14 (patch) | |
tree | 1e92d4a56d9d3647319fd66a814b75f2292fc6b4 /src/StardewModdingAPI/Program.cs | |
parent | f84def385d3d1b537e7f19b6ae1f90096e136505 (diff) | |
download | SMAPI-b105c97dda01441d503d31e8b8ac0b3fd35fef14.tar.gz SMAPI-b105c97dda01441d503d31e8b8ac0b3fd35fef14.tar.bz2 SMAPI-b105c97dda01441d503d31e8b8ac0b3fd35fef14.zip |
add support for remapping legacy versions for update checks (#361)
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 3e1db20c..7b3048c0 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -576,12 +576,13 @@ namespace StardewModdingAPI } // track update - ISemanticVersion version = new SemanticVersion(info.Version); - bool isUpdate = version.IsNewerThan(mod.Manifest.Version); - this.VerboseLog($" {mod.DisplayName} ({result.Key}): {(isUpdate ? $"{mod.Manifest.Version} => {info.Version}" : "OK")}."); + ISemanticVersion localVersion = new SemanticVersion(mod.DataRecord?.GetLocalVersionForUpdateChecks(mod.Manifest.Version.ToString())); + ISemanticVersion latestVersion = new SemanticVersion(mod.DataRecord?.GetRemoteVersionForUpdateChecks(info.Version)); + bool isUpdate = latestVersion.IsNewerThan(localVersion); + this.VerboseLog($" {mod.DisplayName} ({result.Key}): {(isUpdate ? $"{mod.Manifest.Version}{(!localVersion.Equals(mod.Manifest.Version) ? $" [{localVersion}]" : "")} => {info.Version}{(!latestVersion.Equals(new SemanticVersion(info.Version)) ? $" [{latestVersion}]" : "")}" : "OK")}."); if (isUpdate) { - if (!updatesByMod.TryGetValue(mod, out ModInfoModel other) || version.IsNewerThan(other.Version)) + if (!updatesByMod.TryGetValue(mod, out ModInfoModel other) || latestVersion.IsNewerThan(other.Version)) updatesByMod[mod] = info; } } |