add support for ISemanticVersion in JSON models

This commit is contained in:
Jesse Plamondon-Willard 2018-02-18 02:31:39 -05:00
parent 4444b590f0
commit f1c24e3052
3 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@
* Updated compatibility list and enabled update checks for more old mods.
* For modders:
* Added support for `ISemanticVersion` in JSON models.
* Fixed deadlock in rare cases when injecting a file with an asset loader.
* Fixed unhelpful error when a mod exposes a non-public API.

View File

@ -20,11 +20,9 @@ namespace StardewModdingAPI.Framework.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 <see cref="IMod.Entry"/> method. Mutually exclusive with <see cref="ContentPackFor"/>.</summary>

View File

@ -21,6 +21,9 @@ namespace StardewModdingAPI.Framework.Serialisation
ObjectCreationHandling = ObjectCreationHandling.Replace, // avoid issue where default ICollection<T> values are duplicated each time the config is loaded
Converters = new List<JsonConverter>
{
// SMAPI types
new SemanticVersionConverter(),
// enums
new StringEnumConverter<Buttons>(),
new StringEnumConverter<Keys>(),