summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/LegacyManifestVersion.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-01-12 01:24:49 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-01-12 01:24:49 -0500
commit0ad9fbddddbf9edfd847c507d70e10d2f8ce559b (patch)
treea7bf3bd2b04767bbb0ad9c23fdb3e7ea0edee895 /src/SMAPI/Framework/LegacyManifestVersion.cs
parentdc2ceb39f31c35752c943b5052d5abaa7b6494fa (diff)
downloadSMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.tar.gz
SMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.tar.bz2
SMAPI-0ad9fbddddbf9edfd847c507d70e10d2f8ce559b.zip
fix semantic versions always ignoring `-0` tag (#421)
Diffstat (limited to 'src/SMAPI/Framework/LegacyManifestVersion.cs')
-rw-r--r--src/SMAPI/Framework/LegacyManifestVersion.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/LegacyManifestVersion.cs b/src/SMAPI/Framework/LegacyManifestVersion.cs
new file mode 100644
index 00000000..454b9137
--- /dev/null
+++ b/src/SMAPI/Framework/LegacyManifestVersion.cs
@@ -0,0 +1,26 @@
+using Newtonsoft.Json;
+
+namespace StardewModdingAPI.Framework
+{
+ /// <summary>An implementation of <see cref="ISemanticVersion"/> that hamdles the legacy <see cref="IManifest"/> version format.</summary>
+ internal class LegacyManifestVersion : SemanticVersion
+ {
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="majorVersion">The major version incremented for major API changes.</param>
+ /// <param name="minorVersion">The minor version incremented for backwards-compatible changes.</param>
+ /// <param name="patchVersion">The patch version for backwards-compatible bug fixes.</param>
+ /// <param name="build">An optional build tag.</param>
+ [JsonConstructor]
+ public LegacyManifestVersion(int majorVersion, int minorVersion, int patchVersion, string build = null)
+ : base(
+ majorVersion,
+ minorVersion,
+ patchVersion,
+ build != "0" ? build : null // '0' from incorrect examples in old SMAPI documentation
+ )
+ { }
+ }
+}