diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-01-25 15:19:47 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-01-25 15:19:47 -0500 |
commit | 04d3f9b5899f0e7c0fe4d9c8247ba209c710bf2e (patch) | |
tree | fefd4d6f6ee54055f0a8e3c1a3b6e06dc8f8a517 /src/SMAPI | |
parent | 4db7ca28f68be2e25b565a1b98e2c05fb42a5a88 (diff) | |
download | SMAPI-04d3f9b5899f0e7c0fe4d9c8247ba209c710bf2e.tar.gz SMAPI-04d3f9b5899f0e7c0fe4d9c8247ba209c710bf2e.tar.bz2 SMAPI-04d3f9b5899f0e7c0fe4d9c8247ba209c710bf2e.zip |
add internal method for Content Patcher
Diffstat (limited to 'src/SMAPI')
-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() { |