From 0629f19698c9920e2988d96f316d227f97932df8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 11 Nov 2022 01:22:45 -0500 Subject: change new fields to hash sets & simplify sorting This makes the mod IDs case-insensitive (like the 'SuppressUpdateChecks' field), fixes a build error in unit tests, and avoids re-scanning the mod list multiple times. --- src/SMAPI/Framework/Models/SConfig.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/SMAPI/Framework/Models') diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index 40d3450f..ee2dc18d 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -82,11 +82,11 @@ namespace StardewModdingAPI.Framework.Models /// The mod IDs SMAPI should ignore when performing update checks or validating update keys. public HashSet SuppressUpdateChecks { get; set; } - /// The mod IDs SMAPI should try to load early, before any other mods not included in this list. - public List ModsToLoadEarly { get; set; } + /// The mod IDs SMAPI should load before any other mods (except those needed to load them). + public HashSet ModsToLoadEarly { get; set; } - /// The mod IDs SMAPI should try to load late, after all other mods not included in this list. - public List ModsToLoadLate { get; set; } + /// The mod IDs SMAPI should load after any other mods. + public HashSet ModsToLoadLate { get; set; } /******** @@ -106,8 +106,8 @@ namespace StardewModdingAPI.Framework.Models /// The colors to use for text written to the SMAPI console. /// Whether to prevent mods from enabling Harmony's debug mode, which impacts performance and creates a file on your desktop. Debug mode should never be enabled by a released mod. /// The mod IDs SMAPI should ignore when performing update checks or validating update keys. - /// The mod IDs SMAPI should try to load early, before any other mods not included in this list. - /// The mod IDs SMAPI should try to load late, after all other mods not included in this list. + /// The mod IDs SMAPI should load before any other mods (except those needed to load them). + /// The mod IDs SMAPI should load after any other mods. public SConfig(bool developerMode, bool? checkForUpdates, bool? paranoidWarnings, bool? useBetaChannel, string gitHubProjectName, string webApiBaseUrl, string[]? verboseLogging, bool? rewriteMods, bool? useCaseInsensitivePaths, bool? logNetworkTraffic, ColorSchemeConfig consoleColors, bool? suppressHarmonyDebugMode, string[]? suppressUpdateChecks, string[]? modsToLoadEarly, string[]? modsToLoadLate) { this.DeveloperMode = developerMode; @@ -123,8 +123,8 @@ namespace StardewModdingAPI.Framework.Models this.ConsoleColors = consoleColors; this.SuppressHarmonyDebugMode = suppressHarmonyDebugMode ?? (bool)SConfig.DefaultValues[nameof(this.SuppressHarmonyDebugMode)]; this.SuppressUpdateChecks = new HashSet(suppressUpdateChecks ?? Array.Empty(), StringComparer.OrdinalIgnoreCase); - this.ModsToLoadEarly = new List(modsToLoadEarly ?? Array.Empty()); - this.ModsToLoadLate = new List(modsToLoadLate ?? Array.Empty()); + this.ModsToLoadEarly = new HashSet(modsToLoadEarly ?? Array.Empty(), StringComparer.OrdinalIgnoreCase); + this.ModsToLoadLate = new HashSet(modsToLoadLate ?? Array.Empty(), StringComparer.OrdinalIgnoreCase); } /// Override the value of . -- cgit