From 28d737288056f28838811ee564ec9e219b61269e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 18 Feb 2022 12:13:53 -0500 Subject: tweak types in content coordinator --- src/SMAPI/Framework/ContentCoordinator.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/SMAPI/Framework/ContentCoordinator.cs') diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs index 99091f3e..49578046 100644 --- a/src/SMAPI/Framework/ContentCoordinator.cs +++ b/src/SMAPI/Framework/ContentCoordinator.cs @@ -46,7 +46,7 @@ namespace StardewModdingAPI.Framework private readonly Action OnLoadingFirstAsset; /// The loaded content managers (including the ). - private readonly IList ContentManagers = new List(); + private readonly List ContentManagers = new(); /// The language code for language-agnostic mod assets. private readonly LocalizedContentManager.LanguageCode DefaultLanguage = Constants.DefaultLanguage; @@ -56,16 +56,16 @@ namespace StardewModdingAPI.Framework /// A lock used to prevent asynchronous changes to the content manager list. /// The game may add content managers in asynchronous threads (e.g. when populating the load screen). - private readonly ReaderWriterLockSlim ContentManagerLock = new ReaderWriterLockSlim(); + private readonly ReaderWriterLockSlim ContentManagerLock = new(); /// A cache of ordered tilesheet IDs used by vanilla maps. - private readonly IDictionary VanillaTilesheets = new Dictionary(StringComparer.OrdinalIgnoreCase); + private readonly Dictionary VanillaTilesheets = new(StringComparer.OrdinalIgnoreCase); /// An unmodified content manager which doesn't intercept assets, used to compare asset data. private readonly LocalizedContentManager VanillaContentManager; /// The language enum values indexed by locale code. - private Lazy> LocaleCodes; + private Lazy> LocaleCodes; /********* @@ -136,7 +136,7 @@ namespace StardewModdingAPI.Framework this.ContentManagers.Add(contentManagerForAssetPropagation); this.VanillaContentManager = new LocalizedContentManager(serviceProvider, rootDirectory); this.CoreAssets = new CoreAssetPropagator(this.MainContentManager, contentManagerForAssetPropagation, this.Monitor, reflection, aggressiveMemoryOptimizations); - this.LocaleCodes = new Lazy>(this.GetLocaleCodes); + this.LocaleCodes = new Lazy>(this.GetLocaleCodes); } /// Get a new content manager which handles reading files from the game content folder with support for interception. @@ -145,7 +145,7 @@ namespace StardewModdingAPI.Framework { return this.ContentManagerLock.InWriteLock(() => { - GameContentManager manager = new GameContentManager( + GameContentManager manager = new( name: name, serviceProvider: this.MainContentManager.ServiceProvider, rootDirectory: this.MainContentManager.RootDirectory, @@ -171,7 +171,7 @@ namespace StardewModdingAPI.Framework { return this.ContentManagerLock.InWriteLock(() => { - ModContentManager manager = new ModContentManager( + ModContentManager manager = new( name: name, gameContentManager: gameContentManager, serviceProvider: this.MainContentManager.ServiceProvider, @@ -200,7 +200,7 @@ namespace StardewModdingAPI.Framework public void OnLocaleChanged() { // rebuild locale cache (which may change due to custom mod languages) - this.LocaleCodes = new Lazy>(this.GetLocaleCodes); + this.LocaleCodes = new Lazy>(this.GetLocaleCodes); // reload affected content this.ContentManagerLock.InReadLock(() => @@ -359,7 +359,7 @@ namespace StardewModdingAPI.Framework ); // log summary - StringBuilder report = new StringBuilder(); + StringBuilder report = new(); { string[] invalidatedKeys = removedAssets.Keys.ToArray(); string[] propagatedKeys = propagated.Where(p => p.Value).Select(p => p.Key).ToArray(); @@ -486,9 +486,9 @@ namespace StardewModdingAPI.Framework } /// Get the language enums (like ) indexed by locale code (like ja-JP). - private IDictionary GetLocaleCodes() + private Dictionary GetLocaleCodes() { - IDictionary map = new Dictionary(); + var map = new Dictionary(); foreach (LocalizedContentManager.LanguageCode code in Enum.GetValues(typeof(LocalizedContentManager.LanguageCode))) { string locale = this.GetLocaleCode(code); -- cgit