diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-06-06 21:28:57 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-06-06 21:28:57 -0400 |
commit | fdb74df8a4c899b81009c7e04659be9007545788 (patch) | |
tree | 00a71713bc74e8a8729c04766a9cf7f3cd853744 /src/SMAPI/Framework | |
parent | e10147e7bda94a8fbc58684246628a6520d2c6b8 (diff) | |
download | SMAPI-fdb74df8a4c899b81009c7e04659be9007545788.tar.gz SMAPI-fdb74df8a4c899b81009c7e04659be9007545788.tar.bz2 SMAPI-fdb74df8a4c899b81009c7e04659be9007545788.zip |
simplify repeated hash set creation
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/Models/SConfig.cs | 7 | ||||
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index 1c7cd3ed..316f7ac3 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -76,7 +76,7 @@ namespace StardewModdingAPI.Framework.Models public ColorSchemeConfig ConsoleColors { get; } /// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary> - public string[] SuppressUpdateChecks { get; } + public HashSet<string> SuppressUpdateChecks { get; } /******** @@ -110,7 +110,7 @@ namespace StardewModdingAPI.Framework.Models this.UseCaseInsensitivePaths = useCaseInsensitivePaths ?? (bool)SConfig.DefaultValues[nameof(this.UseCaseInsensitivePaths)]; this.LogNetworkTraffic = logNetworkTraffic ?? (bool)SConfig.DefaultValues[nameof(this.LogNetworkTraffic)]; this.ConsoleColors = consoleColors; - this.SuppressUpdateChecks = suppressUpdateChecks ?? Array.Empty<string>(); + this.SuppressUpdateChecks = new HashSet<string>(suppressUpdateChecks ?? Array.Empty<string>(), StringComparer.OrdinalIgnoreCase); } /// <summary>Override the value of <see cref="DeveloperMode"/>.</summary> @@ -132,8 +132,7 @@ namespace StardewModdingAPI.Framework.Models custom[name] = value; } - HashSet<string> curSuppressUpdateChecks = new(this.SuppressUpdateChecks, StringComparer.OrdinalIgnoreCase); - if (SConfig.DefaultSuppressUpdateChecks.Count != curSuppressUpdateChecks.Count || SConfig.DefaultSuppressUpdateChecks.Any(p => !curSuppressUpdateChecks.Contains(p))) + if (!this.SuppressUpdateChecks.SetEquals(SConfig.DefaultSuppressUpdateChecks)) custom[nameof(this.SuppressUpdateChecks)] = "[" + string.Join(", ", this.SuppressUpdateChecks) + "]"; return custom; diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 731731d4..fa217f20 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1507,7 +1507,7 @@ namespace StardewModdingAPI.Framework { try { - HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.OrdinalIgnoreCase); + HashSet<string> suppressUpdateChecks = this.Settings.SuppressUpdateChecks; // prepare search model List<ModSearchEntryModel> searchMods = new List<ModSearchEntryModel>(); @@ -1608,7 +1608,7 @@ namespace StardewModdingAPI.Framework using (AssemblyLoader modAssemblyLoader = new(Constants.Platform, this.Monitor, this.Settings.ParanoidWarnings, this.Settings.RewriteMods)) { // init - HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.OrdinalIgnoreCase); + HashSet<string> suppressUpdateChecks = this.Settings.SuppressUpdateChecks; IInterfaceProxyFactory proxyFactory = this.Settings.UsePintail ? new InterfaceProxyFactory() : new OriginalInterfaceProxyFactory(); |