summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-02-25 23:21:45 -0500
committerGitHub <noreply@github.com>2022-02-25 23:21:45 -0500
commit512c2b9fb761838a852fb4c8fe8dff40bab5f31e (patch)
treeaee12f1ea75e3ed67918573531e999d0643fd811 /src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
parent6fc3be52bc2faaa85bea2febe6953fb5b51dac3a (diff)
parent5e3237d000aba8a4d3c7e40d5791a476fb5d6a65 (diff)
downloadSMAPI-512c2b9fb761838a852fb4c8fe8dff40bab5f31e.tar.gz
SMAPI-512c2b9fb761838a852fb4c8fe8dff40bab5f31e.tar.bz2
SMAPI-512c2b9fb761838a852fb4c8fe8dff40bab5f31e.zip
Merge pull request #830 from Shockah/api-proxy-tryproxy-object
API proxy improvements
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs')
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
index ef1ad30c..93ea6028 100644
--- a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Nanoray.Pintail;
using StardewModdingAPI.Framework.Reflection;
namespace StardewModdingAPI.Framework.ModHelpers
@@ -19,7 +20,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
private readonly HashSet<string> AccessedModApis = new HashSet<string>();
/// <summary>Generates proxy classes to access mod APIs through an arbitrary interface.</summary>
- private readonly InterfaceProxyFactory ProxyFactory;
+ private readonly IProxyManager<string> ProxyManager;
/*********
@@ -28,13 +29,13 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <summary>Construct an instance.</summary>
/// <param name="modID">The unique ID of the relevant mod.</param>
/// <param name="registry">The underlying mod registry.</param>
- /// <param name="proxyFactory">Generates proxy classes to access mod APIs through an arbitrary interface.</param>
+ /// <param name="proxyManager">Generates proxy classes to access mod APIs through an arbitrary interface.</param>
/// <param name="monitor">Encapsulates monitoring and logging for the mod.</param>
- public ModRegistryHelper(string modID, ModRegistry registry, InterfaceProxyFactory proxyFactory, IMonitor monitor)
+ public ModRegistryHelper(string modID, ModRegistry registry, IProxyManager<string> proxyManager, IMonitor monitor)
: base(modID)
{
this.Registry = registry;
- this.ProxyFactory = proxyFactory;
+ this.ProxyManager = proxyManager;
this.Monitor = monitor;
}
@@ -96,7 +97,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
// get API of type
if (api is TInterface castApi)
return castApi;
- return this.ProxyFactory.CreateProxy<TInterface>(api, this.ModID, uniqueID);
+ return this.ProxyManager.ObtainProxy<string, TInterface>(api, this.ModID, uniqueID);
}
}
}