From dd27b3bf35d01e4fd0703e47d538bd8cec03652b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 20 Feb 2020 21:32:55 -0500 Subject: fix parsing four-part versions from the update-check API --- .../Serialization/Converters/SemanticVersionConverter.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs') diff --git a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs index e1b9db1d..3604956b 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs @@ -7,6 +7,13 @@ namespace StardewModdingAPI.Toolkit.Serialization.Converters /// Handles deserialization of . internal class SemanticVersionConverter : JsonConverter { + /********* + ** Fields + *********/ + /// Whether to allow non-standard extensions to semantic versioning. + protected bool AllowNonStandard { get; set; } + + /********* ** Accessors *********/ @@ -78,7 +85,7 @@ namespace StardewModdingAPI.Toolkit.Serialization.Converters { if (string.IsNullOrWhiteSpace(str)) return null; - if (!SemanticVersion.TryParse(str, out ISemanticVersion version)) + if (!SemanticVersion.TryParse(str, allowNonStandard: this.AllowNonStandard, out ISemanticVersion version)) throw new SParseException($"Can't parse semantic version from invalid value '{str}', should be formatted like 1.2, 1.2.30, or 1.2.30-beta (path: {path})."); return version; } -- cgit