summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-22 12:03:39 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-02-22 12:03:39 -0500
commit66079f2253a0c81bb33c1fee848a6cd2222d43d9 (patch)
treeca5fdd5f27c24f8d90665cb369e50f4580ce24fc /src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs
parentc8d627cdf2ae3126584ec2500877ff19987db17f (diff)
parent585b23797e262073e0738069eff61e90819216b7 (diff)
downloadSMAPI-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.cs9
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;
}