diff options
Diffstat (limited to 'src/SMAPI')
27 files changed, 55 insertions, 48 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index a7e44de6..c1c99150 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -20,7 +20,7 @@ namespace StardewModdingAPI ** Public ****/ /// <summary>SMAPI's current semantic version.</summary> - public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.6.1"); + public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.6.2"); /// <summary>The minimum supported version of Stardew Valley.</summary> public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.1"); diff --git a/src/SMAPI/Framework/CommandManager.cs b/src/SMAPI/Framework/CommandManager.cs index eaa91c86..2b91d394 100644 --- a/src/SMAPI/Framework/CommandManager.cs +++ b/src/SMAPI/Framework/CommandManager.cs @@ -13,7 +13,7 @@ namespace StardewModdingAPI.Framework ** Fields *********/ /// <summary>The commands registered with SMAPI.</summary> - private readonly IDictionary<string, Command> Commands = new Dictionary<string, Command>(StringComparer.InvariantCultureIgnoreCase); + private readonly IDictionary<string, Command> Commands = new Dictionary<string, Command>(StringComparer.OrdinalIgnoreCase); /********* diff --git a/src/SMAPI/Framework/Content/AssetDataForMap.cs b/src/SMAPI/Framework/Content/AssetDataForMap.cs index f66013ba..dee5b034 100644 --- a/src/SMAPI/Framework/Content/AssetDataForMap.cs +++ b/src/SMAPI/Framework/Content/AssetDataForMap.cs @@ -67,7 +67,7 @@ namespace StardewModdingAPI.Framework.Content { // change ID if needed so new tilesheets are added after vanilla ones (to avoid errors in hardcoded game logic) string id = sourceSheet.Id; - if (!id.StartsWith("z_", StringComparison.InvariantCultureIgnoreCase)) + if (!id.StartsWith("z_", StringComparison.OrdinalIgnoreCase)) id = $"z_{id}"; // change ID if it conflicts with an existing tilesheet diff --git a/src/SMAPI/Framework/Content/AssetInfo.cs b/src/SMAPI/Framework/Content/AssetInfo.cs index 9b685e72..ed009499 100644 --- a/src/SMAPI/Framework/Content/AssetInfo.cs +++ b/src/SMAPI/Framework/Content/AssetInfo.cs @@ -47,7 +47,7 @@ namespace StardewModdingAPI.Framework.Content public bool AssetNameEquals(string path) { path = this.GetNormalizedPath(path); - return this.AssetName.Equals(path, StringComparison.InvariantCultureIgnoreCase); + return this.AssetName.Equals(path, StringComparison.OrdinalIgnoreCase); } diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs index b0933ac6..2052f6bf 100644 --- a/src/SMAPI/Framework/Content/ContentCache.cs +++ b/src/SMAPI/Framework/Content/ContentCache.cs @@ -89,7 +89,7 @@ namespace StardewModdingAPI.Framework.Content public string NormalizeKey(string key) { key = this.NormalizePathSeparators(key); - return key.EndsWith(".xnb", StringComparison.InvariantCultureIgnoreCase) + return key.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase) ? key.Substring(0, key.Length - 4) : this.NormalizeAssetNameForPlatform(key); } diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs index 47ef30d4..479ffa7f 100644 --- a/src/SMAPI/Framework/ContentCoordinator.cs +++ b/src/SMAPI/Framework/ContentCoordinator.cs @@ -229,7 +229,7 @@ namespace StardewModdingAPI.Framework public IEnumerable<string> InvalidateCache(Func<string, Type, bool> predicate, bool dispose = false) { // invalidate cache & track removed assets - IDictionary<string, Type> removedAssets = new Dictionary<string, Type>(StringComparer.InvariantCultureIgnoreCase); + IDictionary<string, Type> removedAssets = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase); this.ContentManagerLock.InReadLock(() => { // cached assets @@ -263,7 +263,7 @@ namespace StardewModdingAPI.Framework if (removedAssets.Any()) { IDictionary<string, bool> propagated = this.CoreAssets.Propagate(this.MainContentManager, removedAssets.ToDictionary(p => p.Key, p => p.Value)); // use an intercepted content manager - this.Monitor.Log($"Invalidated {removedAssets.Count} asset names ({string.Join(", ", removedAssets.Keys.OrderBy(p => p, StringComparer.InvariantCultureIgnoreCase))}); propagated {propagated.Count(p => p.Value)} core assets.", LogLevel.Trace); + this.Monitor.Log($"Invalidated {removedAssets.Count} asset names ({string.Join(", ", removedAssets.Keys.OrderBy(p => p, StringComparer.OrdinalIgnoreCase))}); propagated {propagated.Count(p => p.Value)} core assets.", LogLevel.Trace); } else this.Monitor.Log("Invalidated 0 cache entries.", LogLevel.Trace); diff --git a/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs b/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs index 36f2f650..a8de013a 100644 --- a/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs @@ -87,7 +87,7 @@ namespace StardewModdingAPI.Framework.ContentManagers this.IsNamespaced = isNamespaced; // get asset data - this.LanguageCodes = this.GetKeyLocales().ToDictionary(p => p.Value, p => p.Key, StringComparer.InvariantCultureIgnoreCase); + this.LanguageCodes = this.GetKeyLocales().ToDictionary(p => p.Value, p => p.Key, StringComparer.OrdinalIgnoreCase); this.BaseDisposableReferences = reflection.GetField<List<IDisposable>>(this, "disposableAssets").GetValue(); } @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Framework.ContentManagers /// <returns>Returns the invalidated asset names and instances.</returns> public IDictionary<string, object> InvalidateCache(Func<string, Type, bool> predicate, bool dispose = false) { - IDictionary<string, object> removeAssets = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase); + IDictionary<string, object> removeAssets = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); this.Cache.Remove((key, asset) => { this.ParseCacheKey(key, out string assetName, out _); @@ -295,7 +295,7 @@ namespace StardewModdingAPI.Framework.ContentManagers // handle localized key if (!string.IsNullOrWhiteSpace(cacheKey)) { - int lastSepIndex = cacheKey.LastIndexOf(".", StringComparison.InvariantCulture); + int lastSepIndex = cacheKey.LastIndexOf(".", StringComparison.Ordinal); if (lastSepIndex >= 0) { string suffix = cacheKey.Substring(lastSepIndex + 1, cacheKey.Length - lastSepIndex - 1); diff --git a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs index eaaf0e6f..f20580e1 100644 --- a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs @@ -123,7 +123,7 @@ namespace StardewModdingAPI.Framework.ContentManagers base.OnLocaleChanged(); // find assets for which a translatable version was loaded - HashSet<string> removeAssetNames = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + HashSet<string> removeAssetNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string key in this.IsLocalizableLookup.Where(p => p.Value).Select(p => p.Key)) removeAssetNames.Add(this.TryParseExplicitLanguageAssetKey(key, out string assetName, out _) ? assetName : key); @@ -134,7 +134,7 @@ namespace StardewModdingAPI.Framework.ContentManagers || (this.TryParseExplicitLanguageAssetKey(key, out string assetName, out _) && removeAssetNames.Contains(assetName)) ) .Select(p => p.Key) - .OrderBy(p => p, StringComparer.InvariantCultureIgnoreCase) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase) .ToArray(); if (invalidated.Any()) this.Monitor.Log($"Invalidated {invalidated.Length} asset names: {string.Join(", ", invalidated)} for locale change.", LogLevel.Trace); diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index cfda55b9..26ddb067 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -372,7 +372,7 @@ namespace StardewModdingAPI.Framework.ContentManagers break; } } - if (contentKey.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase)) + if (contentKey.EndsWith(".png", StringComparison.OrdinalIgnoreCase)) contentKey = contentKey.Substring(0, contentKey.Length - 4); try diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs index 636b1979..11fae0b2 100644 --- a/src/SMAPI/Framework/DeprecationManager.cs +++ b/src/SMAPI/Framework/DeprecationManager.cs @@ -11,7 +11,7 @@ namespace StardewModdingAPI.Framework ** Fields *********/ /// <summary>The deprecations which have already been logged (as 'mod name::noun phrase::version').</summary> - private readonly HashSet<string> LoggedDeprecations = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + private readonly HashSet<string> LoggedDeprecations = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /// <summary>Encapsulates monitoring and logging for a given module.</summary> private readonly IMonitor Monitor; diff --git a/src/SMAPI/Framework/Events/ManagedEvent.cs b/src/SMAPI/Framework/Events/ManagedEvent.cs index 08ac1131..8b25a9b5 100644 --- a/src/SMAPI/Framework/Events/ManagedEvent.cs +++ b/src/SMAPI/Framework/Events/ManagedEvent.cs @@ -106,19 +106,20 @@ namespace StardewModdingAPI.Framework.Events // update cached data // (This is debounced here to avoid repeatedly sorting when handlers are added/removed, // and keeping a separate cached list allows changes during enumeration.) - if (this.CachedHandlers == null) + var handlers = this.CachedHandlers; // iterate local copy in case a mod adds/removes a handler while handling the event + if (handlers == null) { if (this.HasNewHandlers && this.Handlers.Any(p => p.Priority != EventPriority.Normal)) this.Handlers.Sort(); - this.CachedHandlers = this.Handlers.ToArray(); + this.CachedHandlers = handlers = this.Handlers.ToArray(); this.HasNewHandlers = false; } // raise event this.PerformanceMonitor.Track(this.EventName, () => { - foreach (ManagedEventHandler<TEventArgs> handler in this.CachedHandlers) + foreach (ManagedEventHandler<TEventArgs> handler in handlers) { if (match != null && !match(handler.SourceMod)) continue; diff --git a/src/SMAPI/Framework/GameVersion.cs b/src/SMAPI/Framework/GameVersion.cs index 07957624..3ed60920 100644 --- a/src/SMAPI/Framework/GameVersion.cs +++ b/src/SMAPI/Framework/GameVersion.cs @@ -10,7 +10,7 @@ namespace StardewModdingAPI.Framework ** Private methods *********/ /// <summary>A mapping of game to semantic versions.</summary> - private static readonly IDictionary<string, string> VersionMap = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) + private static readonly IDictionary<string, string> VersionMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { ["1.0"] = "1.0.0", ["1.01"] = "1.0.1", @@ -64,7 +64,7 @@ namespace StardewModdingAPI.Framework { foreach (var mapping in GameVersion.VersionMap) { - if (mapping.Value.Equals(semanticVersion, StringComparison.InvariantCultureIgnoreCase)) + if (mapping.Value.Equals(semanticVersion, StringComparison.OrdinalIgnoreCase)) return mapping.Key; } diff --git a/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs b/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs index 79fb45b8..fde37d68 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs @@ -18,7 +18,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework public ISet<InstructionHandleResult> Flags { get; } = new HashSet<InstructionHandleResult>(); /// <summary>The brief noun phrases indicating what the handler matched for the current module.</summary> - public ISet<string> Phrases { get; } = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + public ISet<string> Phrases { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase); /********* diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index 30701552..3ad1bd38 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -173,7 +173,7 @@ namespace StardewModdingAPI.Framework.ModLoading { return this.HasID() - && string.Equals(this.Manifest.UniqueID.Trim(), id?.Trim(), StringComparison.InvariantCultureIgnoreCase); + && string.Equals(this.Manifest.UniqueID.Trim(), id?.Trim(), StringComparison.OrdinalIgnoreCase); } /// <summary>Get the defined update keys.</summary> @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Framework.ModLoading /// <param name="includeOptional">Whether to include optional dependencies.</param> public IEnumerable<string> GetRequiredModIds(bool includeOptional = false) { - HashSet<string> required = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + HashSet<string> required = new HashSet<string>(StringComparer.OrdinalIgnoreCase); // yield dependencies if (this.Manifest?.Dependencies != null) diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index e73bc47d..8bbeb2a3 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -190,7 +190,7 @@ namespace StardewModdingAPI.Framework.ModLoading // validate IDs are unique { var duplicatesByID = mods - .GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.InvariantCultureIgnoreCase) + .GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.OrdinalIgnoreCase) .Where(p => p.Count() > 1); foreach (var group in duplicatesByID) { diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index a98d8c54..1c682f96 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -25,7 +25,7 @@ namespace StardewModdingAPI.Framework.Models }; /// <summary>The default values for <see cref="SuppressUpdateChecks"/>, to log changes if different.</summary> - private static readonly HashSet<string> DefaultSuppressUpdateChecks = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase) + private static readonly HashSet<string> DefaultSuppressUpdateChecks = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "SMAPI.ConsoleCommands", "SMAPI.SaveBackup" @@ -84,7 +84,7 @@ namespace StardewModdingAPI.Framework.Models custom[pair.Key] = value; } - HashSet<string> curSuppressUpdateChecks = new HashSet<string>(this.SuppressUpdateChecks ?? new string[0], StringComparer.InvariantCultureIgnoreCase); + HashSet<string> curSuppressUpdateChecks = new HashSet<string>(this.SuppressUpdateChecks ?? new string[0], StringComparer.OrdinalIgnoreCase); if (SConfig.DefaultSuppressUpdateChecks.Count != curSuppressUpdateChecks.Count || SConfig.DefaultSuppressUpdateChecks.Any(p => !curSuppressUpdateChecks.Contains(p))) custom[nameof(this.SuppressUpdateChecks)] = "[" + string.Join(", ", this.SuppressUpdateChecks ?? new string[0]) + "]"; diff --git a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs index b4e39379..6b45b04a 100644 --- a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs +++ b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs @@ -71,7 +71,7 @@ namespace StardewModdingAPI.Framework.Networking return null; id = id.Trim(); - return this.Mods.FirstOrDefault(mod => mod.ID != null && mod.ID.Equals(id, StringComparison.InvariantCultureIgnoreCase)); + return this.Mods.FirstOrDefault(mod => mod.ID != null && mod.ID.Equals(id, StringComparison.OrdinalIgnoreCase)); } /// <summary>Send a message to the given peer, bypassing the game's normal validation to allow messages before the connection is approved.</summary> diff --git a/src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterCollection.cs b/src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterCollection.cs index 0bb78c74..29a06794 100644 --- a/src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterCollection.cs +++ b/src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterCollection.cs @@ -189,7 +189,7 @@ namespace StardewModdingAPI.Framework.PerformanceMonitoring public void ResetSource(string source) { foreach (var i in this.PerformanceCounters) - if (i.Value.Source.Equals(source, StringComparison.InvariantCultureIgnoreCase)) + if (i.Value.Source.Equals(source, StringComparison.OrdinalIgnoreCase)) i.Value.Reset(); } diff --git a/src/SMAPI/Framework/PerformanceMonitoring/PerformanceMonitor.cs b/src/SMAPI/Framework/PerformanceMonitoring/PerformanceMonitor.cs index dfc4f31a..3f2608aa 100644 --- a/src/SMAPI/Framework/PerformanceMonitoring/PerformanceMonitor.cs +++ b/src/SMAPI/Framework/PerformanceMonitoring/PerformanceMonitor.cs @@ -23,7 +23,7 @@ namespace StardewModdingAPI.Framework.PerformanceMonitoring private readonly Stopwatch InvocationStopwatch = new Stopwatch(); /// <summary>The underlying performance counter collections.</summary> - private readonly IDictionary<string, PerformanceCounterCollection> Collections = new Dictionary<string, PerformanceCounterCollection>(StringComparer.InvariantCultureIgnoreCase); + private readonly IDictionary<string, PerformanceCounterCollection> Collections = new Dictionary<string, PerformanceCounterCollection>(StringComparer.OrdinalIgnoreCase); /********* diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 2b04b1dc..72ef9095 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -451,7 +451,7 @@ namespace StardewModdingAPI.Framework { string[] looseFiles = new DirectoryInfo(this.ModsPath).GetFiles().Select(p => p.Name).ToArray(); if (looseFiles.Any()) - this.Monitor.Log($" Ignored loose files: {string.Join(", ", looseFiles.OrderBy(p => p, StringComparer.InvariantCultureIgnoreCase))}", LogLevel.Trace); + this.Monitor.Log($" Ignored loose files: {string.Join(", ", looseFiles.OrderBy(p => p, StringComparer.OrdinalIgnoreCase))}", LogLevel.Trace); } // load manifests @@ -650,7 +650,7 @@ namespace StardewModdingAPI.Framework { try { - HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.OrdinalIgnoreCase); // prepare search model List<ModSearchEntryModel> searchMods = new List<ModSearchEntryModel>(); @@ -756,7 +756,7 @@ namespace StardewModdingAPI.Framework using (AssemblyLoader modAssemblyLoader = new AssemblyLoader(Constants.Platform, this.Monitor, this.Settings.ParanoidWarnings)) { // init - HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.OrdinalIgnoreCase); InterfaceProxyFactory proxyFactory = new InterfaceProxyFactory(); void LogSkip(IModMetadata mod, string errorPhrase, string errorDetails) { @@ -1103,8 +1103,8 @@ namespace StardewModdingAPI.Framework // find skipped dependencies KeyValuePair<IModMetadata, Tuple<string, string>>[] skippedDependencies; { - HashSet<string> skippedDependencyIds = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); - HashSet<string> skippedModIds = new HashSet<string>(from mod in skippedMods where mod.Key.HasID() select mod.Key.Manifest.UniqueID, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> skippedDependencyIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase); + HashSet<string> skippedModIds = new HashSet<string>(from mod in skippedMods where mod.Key.HasID() select mod.Key.Manifest.UniqueID, StringComparer.OrdinalIgnoreCase); foreach (IModMetadata mod in skippedMods.Keys) { foreach (string requiredId in skippedModIds.Intersect(mod.GetRequiredModIds())) @@ -1351,8 +1351,8 @@ namespace StardewModdingAPI.Framework foreach (string locale in translations.Keys.ToArray()) { // handle duplicates - HashSet<string> keys = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); - HashSet<string> duplicateKeys = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase); + HashSet<string> keys = new HashSet<string>(StringComparer.OrdinalIgnoreCase); + HashSet<string> duplicateKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string key in translations[locale].Keys.ToArray()) { if (!keys.Add(key)) @@ -1458,7 +1458,7 @@ namespace StardewModdingAPI.Framework foreach (FileInfo logFile in logsDir.EnumerateFiles()) { // skip non-SMAPI file - if (!logFile.Name.StartsWith(Constants.LogNamePrefix, StringComparison.InvariantCultureIgnoreCase)) + if (!logFile.Name.StartsWith(Constants.LogNamePrefix, StringComparison.OrdinalIgnoreCase)) continue; // skip crash log diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 4d310185..abb766f2 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -197,8 +197,14 @@ namespace StardewModdingAPI.Framework /// <summary>Load content when the game is launched.</summary> protected override void LoadContent() { + // load content base.LoadContent(); Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, this.GraphicsDevice); + + // log GPU info +#if SMAPI_FOR_WINDOWS + this.Monitor.Log($"Running on GPU: {this.GraphicsDevice?.Adapter?.Description ?? "<unknown>"}"); +#endif } /// <summary>Initialize just before the game's first update tick.</summary> @@ -235,7 +241,7 @@ namespace StardewModdingAPI.Framework private void OnModMessageReceived(ModMessageModel message) { // get mod IDs to notify - HashSet<string> modIDs = new HashSet<string>(message.ToModIDs ?? this.ModRegistry.GetAll().Select(p => p.Manifest.UniqueID), StringComparer.InvariantCultureIgnoreCase); + HashSet<string> modIDs = new HashSet<string>(message.ToModIDs ?? this.ModRegistry.GetAll().Select(p => p.Manifest.UniqueID), StringComparer.OrdinalIgnoreCase); if (message.FromPlayerID == Game1.player?.UniqueMultiplayerID) modIDs.Remove(message.FromModID); // don't send a broadcast back to the sender diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs index 8c444e45..f3b5e9b9 100644 --- a/src/SMAPI/Framework/SMultiplayer.cs +++ b/src/SMAPI/Framework/SMultiplayer.cs @@ -373,7 +373,7 @@ namespace StardewModdingAPI.Framework // filter by mod ID if (toModIDs != null) { - HashSet<string> sendToMods = new HashSet<string>(toModIDs, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> sendToMods = new HashSet<string>(toModIDs, StringComparer.OrdinalIgnoreCase); if (sendToSelf && toModIDs.All(id => this.ModRegistry.Get(id) == null)) sendToSelf = false; diff --git a/src/SMAPI/Framework/Translator.cs b/src/SMAPI/Framework/Translator.cs index f2738633..11ec983b 100644 --- a/src/SMAPI/Framework/Translator.cs +++ b/src/SMAPI/Framework/Translator.cs @@ -12,7 +12,7 @@ namespace StardewModdingAPI.Framework ** Fields *********/ /// <summary>The translations for each locale.</summary> - private readonly IDictionary<string, IDictionary<string, string>> All = new Dictionary<string, IDictionary<string, string>>(StringComparer.InvariantCultureIgnoreCase); + private readonly IDictionary<string, IDictionary<string, string>> All = new Dictionary<string, IDictionary<string, string>>(StringComparer.OrdinalIgnoreCase); /// <summary>The translations for the current locale, with locale fallback taken into account.</summary> private IDictionary<string, Translation> ForLocale; @@ -45,7 +45,7 @@ namespace StardewModdingAPI.Framework this.Locale = locale.ToLower().Trim(); this.LocaleEnum = localeEnum; - this.ForLocale = new Dictionary<string, Translation>(StringComparer.InvariantCultureIgnoreCase); + this.ForLocale = new Dictionary<string, Translation>(StringComparer.OrdinalIgnoreCase); foreach (string next in this.GetRelevantLocales(this.Locale)) { // skip if locale not defined @@ -90,7 +90,7 @@ namespace StardewModdingAPI.Framework // reset translations this.All.Clear(); foreach (var pair in translations) - this.All[pair.Key] = new Dictionary<string, string>(pair.Value, StringComparer.InvariantCultureIgnoreCase); + this.All[pair.Key] = new Dictionary<string, string>(pair.Value, StringComparer.OrdinalIgnoreCase); // rebuild cache this.SetLocale(this.Locale, this.LocaleEnum); diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index fa6541cb..5c77bf66 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -84,7 +84,7 @@ namespace StardewModdingAPI.Metadata }); // reload assets - IDictionary<string, bool> propagated = assets.ToDictionary(p => p.Key, p => false, StringComparer.InvariantCultureIgnoreCase); + IDictionary<string, bool> propagated = assets.ToDictionary(p => p.Key, p => false, StringComparer.OrdinalIgnoreCase); foreach (var bucket in buckets) { switch (bucket.Key) @@ -779,7 +779,7 @@ namespace StardewModdingAPI.Metadata private void ReloadNpcSprites(LocalizedContentManager content, IEnumerable<string> keys, IDictionary<string, bool> propagated) { // get NPCs - HashSet<string> lookup = new HashSet<string>(keys, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> lookup = new HashSet<string>(keys, StringComparer.OrdinalIgnoreCase); var characters = ( from npc in this.GetCharacters() @@ -806,7 +806,7 @@ namespace StardewModdingAPI.Metadata private void ReloadNpcPortraits(LocalizedContentManager content, IEnumerable<string> keys, IDictionary<string, bool> propagated) { // get NPCs - HashSet<string> lookup = new HashSet<string>(keys, StringComparer.InvariantCultureIgnoreCase); + HashSet<string> lookup = new HashSet<string>(keys, StringComparer.OrdinalIgnoreCase); var characters = ( from npc in this.GetCharacters() @@ -1031,7 +1031,7 @@ namespace StardewModdingAPI.Metadata if (string.IsNullOrWhiteSpace(key) || string.IsNullOrWhiteSpace(rawSubstring)) return false; - return key.StartsWith(this.NormalizeAssetNameIgnoringEmpty(rawSubstring), StringComparison.InvariantCultureIgnoreCase); + return key.StartsWith(this.NormalizeAssetNameIgnoringEmpty(rawSubstring), StringComparison.OrdinalIgnoreCase); } /// <summary>Get whether a normalized asset key is in the given folder.</summary> diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 9438f11e..6f3c8c55 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -67,7 +67,7 @@ namespace StardewModdingAPI AssemblyName name = new AssemblyName(e.Name); foreach (FileInfo dll in new DirectoryInfo(Program.DllSearchPath).EnumerateFiles("*.dll")) { - if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase)) + if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.OrdinalIgnoreCase)) return Assembly.LoadFrom(dll.FullName); } return null; diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index 4af4527b..a3dbf52f 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -13,7 +13,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="LargeAddressAware" Version="1.0.4" /> + <PackageReference Include="LargeAddressAware" Version="1.0.5" /> <PackageReference Include="Mono.Cecil" Version="0.11.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Platonymous.TMXTile" Version="1.3.8" /> diff --git a/src/SMAPI/Translation.cs b/src/SMAPI/Translation.cs index 2196c8a5..149f6728 100644 --- a/src/SMAPI/Translation.cs +++ b/src/SMAPI/Translation.cs @@ -67,7 +67,7 @@ namespace StardewModdingAPI return this; // get dictionary of tokens - IDictionary<string, string> tokenLookup = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); + IDictionary<string, string> tokenLookup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); { // from dictionary if (tokens is IDictionary inputLookup) |