summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-07 12:04:20 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-07 12:04:20 -0500
commit0b03b4f16a446e4b139efd33f6378598ae66efee (patch)
treef9165f143f796c7cfebc6d91605c19478f6f4cb2 /src/StardewModdingAPI.Toolkit
parent60237f4d39eef619d030bd8f3334a13cbd2caffe (diff)
downloadSMAPI-0b03b4f16a446e4b139efd33f6378598ae66efee.tar.gz
SMAPI-0b03b4f16a446e4b139efd33f6378598ae66efee.tar.bz2
SMAPI-0b03b4f16a446e4b139efd33f6378598ae66efee.zip
deprecate old manifest version format
Diffstat (limited to 'src/StardewModdingAPI.Toolkit')
-rw-r--r--src/StardewModdingAPI.Toolkit/SemanticVersion.cs7
-rw-r--r--src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/StardewModdingAPI.Toolkit/SemanticVersion.cs b/src/StardewModdingAPI.Toolkit/SemanticVersion.cs
index 32fea3d7..de33df2f 100644
--- a/src/StardewModdingAPI.Toolkit/SemanticVersion.cs
+++ b/src/StardewModdingAPI.Toolkit/SemanticVersion.cs
@@ -42,6 +42,9 @@ namespace StardewModdingAPI.Toolkit
/// <summary>An optional prerelease tag.</summary>
public string Build { get; }
+ /// <summary>Whether the version was parsed from the legacy object format.</summary>
+ public bool IsLegacyFormat { get; }
+
/*********
** Public methods
@@ -51,12 +54,14 @@ namespace StardewModdingAPI.Toolkit
/// <param name="minor">The minor version incremented for backwards-compatible changes.</param>
/// <param name="patch">The patch version for backwards-compatible fixes.</param>
/// <param name="tag">An optional prerelease tag.</param>
- public SemanticVersion(int major, int minor, int patch, string tag = null)
+ /// <param name="isLegacyFormat">Whether the version was parsed from the legacy object format.</param>
+ public SemanticVersion(int major, int minor, int patch, string tag = null, bool isLegacyFormat = false)
{
this.MajorVersion = major;
this.MinorVersion = minor;
this.PatchVersion = patch;
this.Build = this.GetNormalisedTag(tag);
+ this.IsLegacyFormat = isLegacyFormat;
this.AssertValid();
}
diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs
index 070f2c97..e0e185c9 100644
--- a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs
+++ b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs
@@ -70,7 +70,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters
if (build == "0")
build = null; // '0' from incorrect examples in old SMAPI documentation
- return new SemanticVersion(major, minor, patch, build);
+ return new SemanticVersion(major, minor, patch, build, isLegacyFormat: true);
}
/// <summary>Read a JSON string.</summary>