diff options
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/Content/ContentCache.cs | 1 | ||||
-rw-r--r-- | src/SMAPI/Framework/ContentCoordinator.cs | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs index f33ff84d..b0933ac6 100644 --- a/src/SMAPI/Framework/Content/ContentCache.cs +++ b/src/SMAPI/Framework/Content/ContentCache.cs @@ -4,7 +4,6 @@ using System.Diagnostics.Contracts; using System.Linq; using Microsoft.Xna.Framework; using StardewModdingAPI.Framework.Reflection; -using StardewModdingAPI.Internal; using StardewModdingAPI.Toolkit.Utilities; using StardewValley; diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs index b2bacea6..b60483f1 100644 --- a/src/SMAPI/Framework/ContentCoordinator.cs +++ b/src/SMAPI/Framework/ContentCoordinator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; @@ -251,6 +252,23 @@ namespace StardewModdingAPI.Framework return removedAssets.Keys; } + /// <summary>Get all loaded instances of an asset name.</summary> + /// <param name="assetName">The asset name.</param> + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This method is provided for Content Patcher.")] + public IEnumerable<object> GetLoadedValues(string assetName) + { + return this.ContentManagerLock.InReadLock(() => + { + List<object> values = new List<object>(); + foreach (IContentManager content in this.ContentManagers.Where(p => !p.IsNamespaced && p.IsLoaded(assetName))) + { + object value = content.Load<object>(assetName, this.Language, useCache: true); + values.Add(value); + } + return values; + }); + } + /// <summary>Dispose held resources.</summary> public void Dispose() { |