From b5c88d87d2cb1739585651e02513fef73dfc0e27 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 2 Oct 2021 16:40:23 -0400 Subject: add support for unified mod data overrides on the wiki --- .../Clients/WebApi/ModExtendedMetadataModel.cs | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src/SMAPI.Toolkit/Framework/Clients/WebApi') diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs index 8c21e4e0..5945ff6e 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -87,11 +86,14 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /**** ** Version mappings ****/ - /// Maps local versions to a semantic version for update checks. - public IDictionary MapLocalVersions { get; set; } + /// A serialized change descriptor to apply to the local version during update checks (see ). + public string ChangeLocalVersions { get; set; } - /// Maps remote versions to a semantic version for update checks. - public IDictionary MapRemoteVersions { get; set; } + /// A serialized change descriptor to apply to the remote version during update checks (see ). + public string ChangeRemoteVersions { get; set; } + + /// A serialized change descriptor to apply to the update keys during update checks (see ). + public string ChangeUpdateKeys { get; set; } /********* @@ -137,8 +139,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi this.BetaCompatibilitySummary = wiki.BetaCompatibility?.Summary; this.BetaBrokeIn = wiki.BetaCompatibility?.BrokeIn; - this.MapLocalVersions = wiki.MapLocalVersions; - this.MapRemoteVersions = wiki.MapRemoteVersions; + this.ChangeLocalVersions = wiki.Overrides?.ChangeLocalVersions?.ToString(); + this.ChangeRemoteVersions = wiki.Overrides?.ChangeRemoteVersions?.ToString(); + this.ChangeUpdateKeys = wiki.Overrides?.ChangeUpdateKeys?.ToString(); } // internal DB data @@ -148,16 +151,5 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi this.Name ??= db.DisplayName; } } - - /// Get update keys based on the metadata. - public IEnumerable GetUpdateKeys() - { - if (this.NexusID.HasValue) - yield return $"Nexus:{this.NexusID}"; - if (this.ChucklefishID.HasValue) - yield return $"Chucklefish:{this.ChucklefishID}"; - if (this.GitHubRepo != null) - yield return $"GitHub:{this.GitHubRepo}"; - } } } -- cgit