summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs
diff options
context:
space:
mode:
authorShockah <me@shockah.pl>2022-02-09 20:07:01 +0100
committerShockah <me@shockah.pl>2022-02-09 20:07:01 +0100
commit43ad219b75740ef71ad9bad496b00c076182619b (patch)
treebb65c4da0810f747cf4e2b9091b13556e52f89d4 /src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs
parent5a92b0cd357776eebb88e001384f9ca1ccdb7d5c (diff)
downloadSMAPI-43ad219b75740ef71ad9bad496b00c076182619b.tar.gz
SMAPI-43ad219b75740ef71ad9bad496b00c076182619b.tar.bz2
SMAPI-43ad219b75740ef71ad9bad496b00c076182619b.zip
support proxying return values in API proxies
Diffstat (limited to 'src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs')
-rw-r--r--src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs b/src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs
new file mode 100644
index 00000000..4e027252
--- /dev/null
+++ b/src/SMAPI/Framework/Reflection/InterfaceProxyGlue.cs
@@ -0,0 +1,18 @@
+namespace StardewModdingAPI.Framework.Reflection
+{
+ public sealed class InterfaceProxyGlue
+ {
+ private readonly InterfaceProxyFactory Factory;
+
+ internal InterfaceProxyGlue(InterfaceProxyFactory factory)
+ {
+ this.Factory = factory;
+ }
+
+ public object CreateInstanceForProxyTypeName(string proxyTypeName, object toProxy)
+ {
+ var builder = this.Factory.GetBuilderByProxyTypeName(proxyTypeName);
+ return builder.CreateInstance(toProxy, this.Factory);
+ }
+ }
+}