summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs
diff options
context:
space:
mode:
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;
}