diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-02-22 12:03:39 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-02-22 12:03:39 -0500 |
commit | 66079f2253a0c81bb33c1fee848a6cd2222d43d9 (patch) | |
tree | ca5fdd5f27c24f8d90665cb369e50f4580ce24fc /src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs | |
parent | c8d627cdf2ae3126584ec2500877ff19987db17f (diff) | |
parent | 585b23797e262073e0738069eff61e90819216b7 (diff) | |
download | SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.tar.gz SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.tar.bz2 SMAPI-66079f2253a0c81bb33c1fee848a6cd2222d43d9.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs')
-rw-r--r-- | src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs | 9 |
1 files changed, 8 insertions, 1 deletions
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 @@ -8,6 +8,13 @@ namespace StardewModdingAPI.Toolkit.Serialization.Converters internal class SemanticVersionConverter : JsonConverter { /********* + ** Fields + *********/ + /// <summary>Whether to allow non-standard extensions to semantic versioning.</summary> + protected bool AllowNonStandard { get; set; } + + + /********* ** Accessors *********/ /// <summary>Get whether this converter can read JSON.</summary> @@ -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; } |