From 6ddcef61e94a81711ad25a378f0fa03d7799f2dc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 20 Jul 2017 00:05:39 -0400 Subject: simplify mod compatibility model parsing --- .../Framework/Models/ModCompatibility.cs | 35 ++++------------------ 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'src/StardewModdingAPI/Framework/Models/ModCompatibility.cs') diff --git a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs index 90cbd237..eb312eff 100644 --- a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs +++ b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs @@ -1,5 +1,5 @@ -using System.Runtime.Serialization; -using Newtonsoft.Json; +using Newtonsoft.Json; +using StardewModdingAPI.Framework.Serialisation; namespace StardewModdingAPI.Framework.Models { @@ -19,10 +19,12 @@ namespace StardewModdingAPI.Framework.Models public string Name { get; set; } /// The oldest incompatible mod version, or null for all past versions. - public string LowerVersion { get; set; } + [JsonConverter(typeof(SFieldConverter))] + public ISemanticVersion LowerVersion { get; set; } /// The most recent incompatible mod version. - public string UpperVersion { get; set; } + [JsonConverter(typeof(SFieldConverter))] + public ISemanticVersion UpperVersion { get; set; } /// A label to show to the user instead of , when the manifest version differs from the user-facing version. public string UpperVersionLabel { get; set; } @@ -39,30 +41,5 @@ namespace StardewModdingAPI.Framework.Models /// Indicates how SMAPI should consider the mod. public ModCompatibilityType Compatibility { get; set; } - - - /**** - ** Injected - ****/ - /// The semantic version corresponding to . - [JsonIgnore] - public ISemanticVersion LowerSemanticVersion { get; set; } - - /// The semantic version corresponding to . - [JsonIgnore] - public ISemanticVersion UpperSemanticVersion { get; set; } - - - /********* - ** Private methods - *********/ - /// The method called when the model finishes deserialising. - /// The deserialisation context. - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - this.LowerSemanticVersion = this.LowerVersion != null ? new SemanticVersion(this.LowerVersion) : null; - this.UpperSemanticVersion = this.UpperVersion != null ? new SemanticVersion(this.UpperVersion) : null; - } } } -- cgit From 7d73b0bf0c545b281d9d84bc73ad40932764b483 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 20 Jul 2017 00:37:58 -0400 Subject: simplify compatibility skip message in 2.0 & combine update URL fields --- src/StardewModdingAPI/Framework/Models/ModCompatibility.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/StardewModdingAPI/Framework/Models/ModCompatibility.cs') diff --git a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs index eb312eff..72b6f2af 100644 --- a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs +++ b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs @@ -29,11 +29,8 @@ namespace StardewModdingAPI.Framework.Models /// A label to show to the user instead of , when the manifest version differs from the user-facing version. public string UpperVersionLabel { get; set; } - /// The URL the user can check for an official updated version. - public string UpdateUrl { get; set; } - - /// The URL the user can check for an unofficial updated version. - public string UnofficialUpdateUrl { get; set; } + /// The URLs the user can check for a newer version. + public string[] UpdateUrls { get; set; } /// The reason phrase to show in the warning, or null to use the default value. /// "this version is incompatible with the latest version of the game" -- cgit From 7c1ac555a401819bf01ebe0e515b02416bc49b15 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 20 Jul 2017 00:47:28 -0400 Subject: simplify compatibility list by defaulting compatibility type, update readme --- src/StardewModdingAPI/Framework/Models/ModCompatibility.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/StardewModdingAPI/Framework/Models/ModCompatibility.cs') diff --git a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs index 72b6f2af..91be1d38 100644 --- a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs +++ b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs @@ -37,6 +37,6 @@ namespace StardewModdingAPI.Framework.Models public string ReasonPhrase { get; set; } /// Indicates how SMAPI should consider the mod. - public ModCompatibilityType Compatibility { get; set; } + public ModCompatibilityType Compatibility { get; set; } = ModCompatibilityType.AssumeBroken; } } -- cgit From c20b21bcaa799a9961799316b7f4b7d8f929ca3f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 21 Jul 2017 01:51:05 -0400 Subject: add support for disambiguating IDs in mod compatibility list --- src/StardewModdingAPI/Framework/Models/ModCompatibility.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/StardewModdingAPI/Framework/Models/ModCompatibility.cs') diff --git a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs index 91be1d38..d3a9c533 100644 --- a/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs +++ b/src/StardewModdingAPI/Framework/Models/ModCompatibility.cs @@ -9,11 +9,9 @@ namespace StardewModdingAPI.Framework.Models /********* ** Accessors *********/ - /**** - ** From config - ****/ /// The unique mod IDs. - public string[] ID { get; set; } + [JsonConverter(typeof(SFieldConverter))] + public ModCompatibilityID[] ID { get; set; } /// The mod name. public string Name { get; set; } -- cgit