From 0b2e46d55cb09a169c7bb64ade37c82fc8233cb3 Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Sun, 10 Jun 2018 15:05:59 -0700 Subject: refactor IModMetadata update info --- .../Framework/ModUpdateChecking/ModUpdateStatus.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs (limited to 'src/SMAPI/Framework/ModUpdateChecking') diff --git a/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs b/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs new file mode 100644 index 00000000..7f588b66 --- /dev/null +++ b/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs @@ -0,0 +1,32 @@ +namespace StardewModdingAPI.Framework.ModUpdateChecking +{ + /// Update status for a mod. + internal class ModUpdateStatus + { + /********* + ** Accessors + *********/ + /// The version that this mod can be updated to (if any). + public ISemanticVersion Version { get; } + + /// The error checking for updates of this mod (if any). + public string Error { get; } + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The version that this mod can be update to. + public ModUpdateStatus(ISemanticVersion version) + { + this.Version = version; + } + + /// Construct an instance. + /// The error checking for updates of this mod. + public ModUpdateStatus(string error) + { + this.Error = error; + } + } +} -- cgit From 468eea751dff9c7c70f0eb33eb91adf98b79cf9d Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Sun, 10 Jun 2018 15:17:44 -0700 Subject: set mods without updates to have no updates --- src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs | 5 +++++ src/SMAPI/Program.cs | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'src/SMAPI/Framework/ModUpdateChecking') diff --git a/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs b/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs index 7f588b66..efb32aef 100644 --- a/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs +++ b/src/SMAPI/Framework/ModUpdateChecking/ModUpdateStatus.cs @@ -28,5 +28,10 @@ namespace StardewModdingAPI.Framework.ModUpdateChecking { this.Error = error; } + + /// Construct an instance. + public ModUpdateStatus() + { + } } } diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 96061b2a..2ee18a29 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -716,6 +716,14 @@ namespace StardewModdingAPI } } + // set mods to have no updates + foreach (IModMetadata mod in results.Select(item => item.Mod) + .Where(item => !updatesByMod.ContainsKey(item))) + { + mod.SetUpdateStatus(new ModUpdateStatus()); + mod.SetPreviewUpdateStatus(new ModUpdateStatus()); + } + // output if (updatesByMod.Any()) { -- cgit