obfuz/Editor/ProxyCall/ConfigDynamicProxyPolicy.cs

31 lines
821 B
C#
Raw Normal View History

2025-04-24 11:58:22 +08:00
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.DynamicProxy
{
public class ConfigDynamicProxyPolicy : DynamicProxyPolicyBase
{
public override bool NeedDynamicProxyCallInMethod(MethodDef method)
{
return true;
}
public override bool NeedDynamicProxyCalledMethod(IMethod method, bool callVir)
{
2025-04-28 11:37:48 +08:00
ITypeDefOrRef declaringType = method.DeclaringType;
TypeDef typeDef = declaringType.ResolveTypeDef();
// doesn't proxy call if the method is a delegate
if (typeDef != null && typeDef.IsDelegate)
{
return false;
}
2025-04-24 11:58:22 +08:00
return true;
}
}
}