diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-11-09 21:18:06 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-11-09 21:18:06 -0500 |
commit | fd6a719b02d1d45d27509f44f09eefe52124ee20 (patch) | |
tree | 9ed0be2a6dcf68a54bc1de0e252670c178726887 /src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs | |
parent | 01db5e364d0db74f480dacd20877cc5d4728d60c (diff) | |
download | SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.tar.gz SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.tar.bz2 SMAPI-fd6a719b02d1d45d27509f44f09eefe52124ee20.zip |
overhaul update checks
This commit moves the core update-check logic serverside, and adds support for community-defined version mappings. For example, that means false update alerts can now be solved by the community for all players.
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs')
-rw-r--r-- | src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs new file mode 100644 index 00000000..73698173 --- /dev/null +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs @@ -0,0 +1,52 @@ +using System.Linq; +using StardewModdingAPI.Toolkit.Utilities; + +namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi +{ + /// <summary>Specifies mods whose update-check info to fetch.</summary> + public class ModSearchModel + { + /********* + ** Accessors + *********/ + /// <summary>The mods for which to find data.</summary> + public ModSearchEntryModel[] Mods { get; set; } + + /// <summary>Whether to include extended metadata for each mod.</summary> + public bool IncludeExtendedMetadata { get; set; } + + /// <summary>The SMAPI version installed by the player. This is used for version mapping in some cases.</summary> + public ISemanticVersion ApiVersion { get; set; } + + /// <summary>The Stardew Valley version installed by the player.</summary> + public ISemanticVersion GameVersion { get; set; } + + /// <summary>The OS on which the player plays.</summary> + public Platform? Platform { get; set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an empty instance.</summary> + public ModSearchModel() + { + // needed for JSON deserializing + } + + /// <summary>Construct an instance.</summary> + /// <param name="mods">The mods to search.</param> + /// <param name="apiVersion">The SMAPI version installed by the player. If this is null, the API won't provide a recommended update.</param> + /// <param name="gameVersion">The Stardew Valley version installed by the player.</param> + /// <param name="platform">The OS on which the player plays.</param> + /// <param name="includeExtendedMetadata">Whether to include extended metadata for each mod.</param> + public ModSearchModel(ModSearchEntryModel[] mods, ISemanticVersion apiVersion, ISemanticVersion gameVersion, Platform platform, bool includeExtendedMetadata) + { + this.Mods = mods.ToArray(); + this.ApiVersion = apiVersion; + this.GameVersion = gameVersion; + this.Platform = platform; + this.IncludeExtendedMetadata = includeExtendedMetadata; + } + } +} |