From 85efb3112912a28dbdc82b18d0be8dd117f8c8ee Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 24 Jun 2018 23:01:39 -0400 Subject: [PATCH] fix ISemanticVersion deserialisation errors (#532) --- .../Serialisation/Converters/SemanticVersionConverter.cs | 8 ++++---- .../Serialisation/Models/Manifest.cs | 2 -- .../Serialisation/Models/ManifestContentPackFor.cs | 4 ---- .../Serialisation/Models/ManifestDependency.cs | 4 ---- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs index eff95d1f..4f0949fa 100644 --- a/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs +++ b/src/StardewModdingAPI.Toolkit/Serialisation/Converters/SemanticVersionConverter.cs @@ -2,8 +2,8 @@ using Newtonsoft.Json.Linq; namespace StardewModdingAPI.Toolkit.Serialisation.Converters { - /// Handles deserialisation of . - internal class SemanticVersionConverter : SimpleReadOnlyConverter + /// Handles deserialisation of . + internal class SemanticVersionConverter : SimpleReadOnlyConverter { /********* ** Protected methods @@ -11,7 +11,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters /// Read a JSON object. /// The JSON object to read. /// The path to the current JSON node. - protected override SemanticVersion ReadObject(JObject obj, string path) + protected override ISemanticVersion ReadObject(JObject obj, string path) { int major = obj.ValueIgnoreCase("MajorVersion"); int minor = obj.ValueIgnoreCase("MinorVersion"); @@ -26,7 +26,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters /// Read a JSON string. /// The JSON string value. /// The path to the current JSON node. - protected override SemanticVersion ReadString(string str, string path) + protected override ISemanticVersion ReadString(string str, string path) { if (string.IsNullOrWhiteSpace(str)) return null; diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Models/Manifest.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Models/Manifest.cs index 6ec57258..6cb9496b 100644 --- a/src/StardewModdingAPI.Toolkit/Serialisation/Models/Manifest.cs +++ b/src/StardewModdingAPI.Toolkit/Serialisation/Models/Manifest.cs @@ -20,11 +20,9 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models public string Author { get; set; } /// The mod version. - [JsonConverter(typeof(SemanticVersionConverter))] public ISemanticVersion Version { get; set; } /// The minimum SMAPI version required by this mod, if any. - [JsonConverter(typeof(SemanticVersionConverter))] public ISemanticVersion MinimumApiVersion { get; set; } /// The name of the DLL in the directory that has the Entry method. Mutually exclusive with . diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestContentPackFor.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestContentPackFor.cs index 64808dcf..d0e42216 100644 --- a/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestContentPackFor.cs +++ b/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestContentPackFor.cs @@ -1,6 +1,3 @@ -using Newtonsoft.Json; -using StardewModdingAPI.Toolkit.Serialisation.Converters; - namespace StardewModdingAPI.Toolkit.Serialisation.Models { /// Indicates which mod can read the content pack represented by the containing manifest. @@ -13,7 +10,6 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models public string UniqueID { get; set; } /// The minimum required version (if any). - [JsonConverter(typeof(SemanticVersionConverter))] public ISemanticVersion MinimumVersion { get; set; } } } diff --git a/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestDependency.cs b/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestDependency.cs index 67e733dd..8db58d5d 100644 --- a/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestDependency.cs +++ b/src/StardewModdingAPI.Toolkit/Serialisation/Models/ManifestDependency.cs @@ -1,6 +1,3 @@ -using Newtonsoft.Json; -using StardewModdingAPI.Toolkit.Serialisation.Converters; - namespace StardewModdingAPI.Toolkit.Serialisation.Models { /// A mod dependency listed in a mod manifest. @@ -13,7 +10,6 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models public string UniqueID { get; set; } /// The minimum required version (if any). - [JsonConverter(typeof(SemanticVersionConverter))] public ISemanticVersion MinimumVersion { get; set; } /// Whether the dependency must be installed to use the mod.