diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-24 18:33:56 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-24 18:33:56 -0400 |
commit | 80ff10c5ccbaec29f35dc720e254218469157b6b (patch) | |
tree | 80ac9ee52911ba2052bed44bce8a40415da328a2 /src | |
parent | 93274deb4aba6eb60b5471a81819eb92e23de30b (diff) | |
download | SMAPI-80ff10c5ccbaec29f35dc720e254218469157b6b.tar.gz SMAPI-80ff10c5ccbaec29f35dc720e254218469157b6b.tar.bz2 SMAPI-80ff10c5ccbaec29f35dc720e254218469157b6b.zip |
add option to locally suppress update checks for a specific mod
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Framework/Models/SConfig.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 16 | ||||
-rw-r--r-- | src/SMAPI/StardewModdingAPI.config.json | 10 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index e201e966..98614933 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -28,5 +28,8 @@ namespace StardewModdingAPI.Framework.Models /// <summary>The console color scheme to use.</summary> public MonitorColorScheme ColorScheme { get; set; } + + /// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary> + public string[] SuppressUpdateChecks { get; set; } } } diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 6aff6dc6..2dcf67e4 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -97,13 +97,6 @@ namespace StardewModdingAPI new Regex(@"^DebugOutput: added CLOUD", RegexOptions.Compiled | RegexOptions.CultureInvariant) }; - /// <summary>The mod IDs for which to not show missing update key warnings.</summary> - private readonly string[] AllowMissingUpdateKeys = - { - "SMAPI.ConsoleCommands", - "SMAPI.SaveBackup" - }; - /// <summary>Encapsulates SMAPI's JSON file parsing.</summary> private readonly JsonHelper JsonHelper = new JsonHelper(); @@ -615,11 +608,15 @@ namespace StardewModdingAPI { try { + HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.InvariantCultureIgnoreCase); + // prepare update keys Dictionary<string, IModMetadata[]> modsByKey = ( from mod in mods - where mod.Manifest?.UpdateKeys != null + where + mod.Manifest?.UpdateKeys != null + && !suppressUpdateChecks.Contains(mod.Manifest.UniqueID) from key in mod.Manifest.UpdateKeys select new { key, mod } ) @@ -732,6 +729,7 @@ namespace StardewModdingAPI { this.Monitor.Log("Loading mods...", LogLevel.Trace); + HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.InvariantCultureIgnoreCase); IDictionary<IModMetadata, string[]> skippedMods = new Dictionary<IModMetadata, string[]>(); void TrackSkip(IModMetadata mod, string userReasonPhrase, string devReasonPhrase = null) => skippedMods[mod] = new[] { userReasonPhrase, devReasonPhrase }; @@ -790,7 +788,7 @@ namespace StardewModdingAPI : $" {metadata.DisplayName}...", LogLevel.Trace); // show warnings - if (metadata.HasManifest() && !metadata.HasUpdateKeys() && !this.AllowMissingUpdateKeys.Contains(metadata.Manifest.UniqueID)) + if (metadata.HasManifest() && !metadata.HasUpdateKeys() && !suppressUpdateChecks.Contains(metadata.Manifest.UniqueID)) metadata.SetWarning(ModWarning.NoUpdateKeys); // validate status diff --git a/src/SMAPI/StardewModdingAPI.config.json b/src/SMAPI/StardewModdingAPI.config.json index 6725dbbd..7aac6e4c 100644 --- a/src/SMAPI/StardewModdingAPI.config.json +++ b/src/SMAPI/StardewModdingAPI.config.json @@ -50,5 +50,13 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha * - LightBackground: use darker text colors that look better on a white or light background. * - DarkBackground: use lighter text colors that look better on a black or dark background. */ - "ColorScheme": "AutoDetect" + "ColorScheme": "AutoDetect", + + /** + * The mod IDs SMAPI should ignore when performing update checks or validating update keys. + */ + "SuppressUpdateChecks": [ + "SMAPI.ConsoleCommands", + "SMAPI.SaveBackup" + ] } |