blob: 8d0d74a7d9ad92c6069bef9841641fc1e8b6062c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
namespace StardewModdingAPI.Framework.Reflection
{
/// <summary>Provides an interface for proxied types to create other proxied types.</summary>
public sealed class InterfaceProxyGlue
{
private readonly InterfaceProxyFactory Factory;
internal InterfaceProxyGlue(InterfaceProxyFactory factory)
{
this.Factory = factory;
}
/// <summary>Creates a new proxied instance by its type name.</summary>
/// <param name="proxyTypeName">The full name of the proxy type.</param>
/// <param name="toProxy">The target instance to proxy.</param>
public object CreateInstanceForProxyTypeName(string proxyTypeName, object toProxy)
{
var builder = this.Factory.GetBuilderByProxyTypeName(proxyTypeName);
return builder.CreateInstance(toProxy, this.Factory);
}
}
}
|