fix ISemanticVersion deserialisation errors (#532)
This commit is contained in:
parent
b08e27d13a
commit
85efb31129
|
@ -2,8 +2,8 @@ using Newtonsoft.Json.Linq;
|
|||
|
||||
namespace StardewModdingAPI.Toolkit.Serialisation.Converters
|
||||
{
|
||||
/// <summary>Handles deserialisation of <see cref="SemanticVersion"/>.</summary>
|
||||
internal class SemanticVersionConverter : SimpleReadOnlyConverter<SemanticVersion>
|
||||
/// <summary>Handles deserialisation of <see cref="ISemanticVersion"/>.</summary>
|
||||
internal class SemanticVersionConverter : SimpleReadOnlyConverter<ISemanticVersion>
|
||||
{
|
||||
/*********
|
||||
** Protected methods
|
||||
|
@ -11,7 +11,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters
|
|||
/// <summary>Read a JSON object.</summary>
|
||||
/// <param name="obj">The JSON object to read.</param>
|
||||
/// <param name="path">The path to the current JSON node.</param>
|
||||
protected override SemanticVersion ReadObject(JObject obj, string path)
|
||||
protected override ISemanticVersion ReadObject(JObject obj, string path)
|
||||
{
|
||||
int major = obj.ValueIgnoreCase<int>("MajorVersion");
|
||||
int minor = obj.ValueIgnoreCase<int>("MinorVersion");
|
||||
|
@ -26,7 +26,7 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Converters
|
|||
/// <summary>Read a JSON string.</summary>
|
||||
/// <param name="str">The JSON string value.</param>
|
||||
/// <param name="path">The path to the current JSON node.</param>
|
||||
protected override SemanticVersion ReadString(string str, string path)
|
||||
protected override ISemanticVersion ReadString(string str, string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
return null;
|
||||
|
|
|
@ -20,11 +20,9 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models
|
|||
public string Author { get; set; }
|
||||
|
||||
/// <summary>The mod version.</summary>
|
||||
[JsonConverter(typeof(SemanticVersionConverter))]
|
||||
public ISemanticVersion Version { get; set; }
|
||||
|
||||
/// <summary>The minimum SMAPI version required by this mod, if any.</summary>
|
||||
[JsonConverter(typeof(SemanticVersionConverter))]
|
||||
public ISemanticVersion MinimumApiVersion { get; set; }
|
||||
|
||||
/// <summary>The name of the DLL in the directory that has the <c>Entry</c> method. Mutually exclusive with <see cref="ContentPackFor"/>.</summary>
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using Newtonsoft.Json;
|
||||
using StardewModdingAPI.Toolkit.Serialisation.Converters;
|
||||
|
||||
namespace StardewModdingAPI.Toolkit.Serialisation.Models
|
||||
{
|
||||
/// <summary>Indicates which mod can read the content pack represented by the containing manifest.</summary>
|
||||
|
@ -13,7 +10,6 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models
|
|||
public string UniqueID { get; set; }
|
||||
|
||||
/// <summary>The minimum required version (if any).</summary>
|
||||
[JsonConverter(typeof(SemanticVersionConverter))]
|
||||
public ISemanticVersion MinimumVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
using Newtonsoft.Json;
|
||||
using StardewModdingAPI.Toolkit.Serialisation.Converters;
|
||||
|
||||
namespace StardewModdingAPI.Toolkit.Serialisation.Models
|
||||
{
|
||||
/// <summary>A mod dependency listed in a mod manifest.</summary>
|
||||
|
@ -13,7 +10,6 @@ namespace StardewModdingAPI.Toolkit.Serialisation.Models
|
|||
public string UniqueID { get; set; }
|
||||
|
||||
/// <summary>The minimum required version (if any).</summary>
|
||||
[JsonConverter(typeof(SemanticVersionConverter))]
|
||||
public ISemanticVersion MinimumVersion { get; set; }
|
||||
|
||||
/// <summary>Whether the dependency must be installed to use the mod.</summary>
|
||||
|
|
Loading…
Reference in New Issue