summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-06 20:58:19 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-06 20:58:19 -0400
commite7e6327b3c85d52ab666aad2a054fbbdbd9431da (patch)
tree436b963d47bd8062ab38b676f57cbfb5c4e99821 /src/SMAPI/Framework/ContentManagers/ModContentManager.cs
parentc8ad50dad1d706a1901798f9396f6becfea36c0e (diff)
parentb45f50b57e3895620a682e2c7a438391dce0c5dd (diff)
downloadSMAPI-e7e6327b3c85d52ab666aad2a054fbbdbd9431da.tar.gz
SMAPI-e7e6327b3c85d52ab666aad2a054fbbdbd9431da.tar.bz2
SMAPI-e7e6327b3c85d52ab666aad2a054fbbdbd9431da.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/ContentManagers/ModContentManager.cs')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index 8f64c5a8..65dffd8b 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -10,6 +10,7 @@ using StardewModdingAPI.Framework.Exceptions;
using StardewModdingAPI.Framework.Reflection;
using StardewModdingAPI.Toolkit.Serialization;
using StardewModdingAPI.Toolkit.Utilities;
+using StardewModdingAPI.Toolkit.Utilities.PathLookups;
using StardewValley;
using xTile;
using xTile.Format;
@@ -32,8 +33,8 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <summary>The game content manager used for map tilesheets not provided by the mod.</summary>
private readonly IContentManager GameContentManager;
- /// <summary>A case-insensitive lookup of relative paths within the <see cref="ContentManager.RootDirectory"/>.</summary>
- private readonly CaseInsensitivePathLookup RelativePathCache;
+ /// <summary>A lookup for relative paths within the <see cref="ContentManager.RootDirectory"/>.</summary>
+ private readonly IFilePathLookup RelativePathLookup;
/// <summary>If a map tilesheet's image source has no file extensions, the file extensions to check for in the local mod folder.</summary>
private readonly string[] LocalTilesheetExtensions = { ".png", ".xnb" };
@@ -54,13 +55,12 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <param name="reflection">Simplifies access to private code.</param>
/// <param name="jsonHelper">Encapsulates SMAPI's JSON file parsing.</param>
/// <param name="onDisposing">A callback to invoke when the content manager is being disposed.</param>
- /// <param name="aggressiveMemoryOptimizations">Whether to enable more aggressive memory optimizations.</param>
- /// <param name="relativePathCache">A case-insensitive lookup of relative paths within the <paramref name="rootDirectory"/>.</param>
- public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> onDisposing, bool aggressiveMemoryOptimizations, CaseInsensitivePathLookup relativePathCache)
- : base(name, serviceProvider, rootDirectory, currentCulture, coordinator, monitor, reflection, onDisposing, isNamespaced: true, aggressiveMemoryOptimizations: aggressiveMemoryOptimizations)
+ /// <param name="relativePathLookup">A lookup for relative paths within the <paramref name="rootDirectory"/>.</param>
+ public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> onDisposing, IFilePathLookup relativePathLookup)
+ : base(name, serviceProvider, rootDirectory, currentCulture, coordinator, monitor, reflection, onDisposing, isNamespaced: true)
{
this.GameContentManager = gameContentManager;
- this.RelativePathCache = relativePathCache;
+ this.RelativePathLookup = relativePathLookup;
this.JsonHelper = jsonHelper;
this.ModName = modName;
@@ -257,7 +257,7 @@ namespace StardewModdingAPI.Framework.ContentManagers
private FileInfo GetModFile(string path)
{
// map to case-insensitive path if needed
- path = this.RelativePathCache.GetFilePath(path);
+ path = this.RelativePathLookup.GetFilePath(path);
// try exact match
FileInfo file = new(Path.Combine(this.FullRootDirectory, path));