From 04d3f9b5899f0e7c0fe4d9c8247ba209c710bf2e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 25 Jan 2020 15:19:47 -0500 Subject: add internal method for Content Patcher --- src/SMAPI/Framework/Content/ContentCache.cs | 1 - src/SMAPI/Framework/ContentCoordinator.cs | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/SMAPI') 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; } + /// Get all loaded instances of an asset name. + /// The asset name. + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This method is provided for Content Patcher.")] + public IEnumerable GetLoadedValues(string assetName) + { + return this.ContentManagerLock.InReadLock(() => + { + List values = new List(); + foreach (IContentManager content in this.ContentManagers.Where(p => !p.IsNamespaced && p.IsLoaded(assetName))) + { + object value = content.Load(assetName, this.Language, useCache: true); + values.Add(value); + } + return values; + }); + } + /// Dispose held resources. public void Dispose() { -- cgit