本文整理汇总了C#中TypeDef.FindMethod方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDef.FindMethod方法的具体用法?C# TypeDef.FindMethod怎么用?C# TypeDef.FindMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDef
的用法示例。
在下文中一共展示了TypeDef.FindMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsResourceType
static bool IsResourceType(TypeDef type, string baseTypeName) {
if (type.BaseType == null || type.BaseType.FullName != baseTypeName)
return false;
if (type.HasProperties || type.HasEvents || type.HasFields)
return false;
if (type.Interfaces.Count > 0)
return false;
var method = type.FindMethod("GetResourceFileName");
if (!DotNetUtils.IsMethod(method, "System.String", "(System.Globalization.CultureInfo)"))
return false;
return true;
}
示例2: GetMethod
public static MethodDef GetMethod(TypeDef type, IMethod methodRef) {
if (type == null || methodRef == null)
return null;
if (methodRef is MethodDef)
return (MethodDef)methodRef;
return type.FindMethod(methodRef.Name, methodRef.MethodSig);
}
示例3: CheckDelegateType
bool CheckDelegateType(TypeDef type) {
if (!DotNetUtils.DerivesFromDelegate(type))
return false;
var invoke = type.FindMethod("Invoke");
if (invoke == null)
return false;
return CheckDelegateInvokeMethod(invoke);
}
示例4: CheckNested
IDecrypterInfo CheckNested(TypeDef type, TypeDef nested) {
if (nested.HasProperties || nested.HasEvents)
return null;
if (nested.FindMethod(".ctor") == null)
return null;
if (nested.Fields.Count == 1 || nested.Fields.Count == 3) {
// 4.0+
if (!HasFieldType(nested.Fields, nested))
return null;
var decrypterBuilderMethod = DotNetUtils.GetMethod(nested, "System.Reflection.Emit.MethodBuilder", "(System.Reflection.Emit.TypeBuilder)");
if (decrypterBuilderMethod == null)
return null;
resourceDecrypter.DecryptMethod = ResourceDecrypter.FindDecrypterMethod(nested.FindMethod(".ctor"));
var nestedDecrypter = DotNetUtils.GetMethod(nested, "System.String", "(System.Int32)");
if (nestedDecrypter == null || nestedDecrypter.IsStatic)
return null;
var decrypter = DotNetUtils.GetMethod(type, "System.String", "(System.Int32)");
if (decrypter == null || !decrypter.IsStatic)
return null;
simpleDeobfuscator.Deobfuscate(decrypterBuilderMethod);
return new DecrypterInfoV3(resourceDecrypter) {
Decrypter = decrypter,
OffsetCalcInstructions = GetOffsetCalcInstructions(decrypterBuilderMethod),
};
}
else if (nested.Fields.Count == 2) {
// 3.0 - 3.5
if (CheckFields(nested, "System.Collections.Hashtable", nested)) {
// 3.0 - 3.5
var nestedDecrypter = DotNetUtils.GetMethod(nested, "System.String", "(System.Int32)");
if (nestedDecrypter == null || nestedDecrypter.IsStatic)
return null;
var decrypter = DotNetUtils.GetMethod(type, "System.String", "(System.Int32)");
if (decrypter == null || !decrypter.IsStatic)
return null;
resourceDecrypter.DecryptMethod = ResourceDecrypter.FindDecrypterMethod(nested.FindMethod(".ctor"));
return new DecrypterInfoV3(resourceDecrypter) { Decrypter = decrypter };
}
else if (CheckFields(nested, "System.Byte[]", nested)) {
// 3.0
var nestedDecrypter = DotNetUtils.GetMethod(nested, "System.String", "(System.String,System.Int32)");
if (nestedDecrypter == null || nestedDecrypter.IsStatic)
return null;
var decrypter = DotNetUtils.GetMethod(type, "System.String", "(System.String,System.Int32)");
if (decrypter == null || !decrypter.IsStatic)
return null;
return new DecrypterInfoV2 { Decrypter = decrypter };
}
else
return null;
}
return null;
}
示例5: CreateBridge
private MethodDef CreateBridge(RPContext ctx, TypeDef delegateType, FieldDef field, MethodSig sig)
{
var method = new MethodDefUser(ctx.Name.RandomName(), sig);
method.Attributes = MethodAttributes.PrivateScope | MethodAttributes.Static;
method.ImplAttributes = MethodImplAttributes.Managed | MethodImplAttributes.IL;
method.Body = new CilBody();
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldsfld, field));
for (int i = 0; i < method.Parameters.Count; i++)
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg, method.Parameters[i]));
method.Body.Instructions.Add(Instruction.Create(OpCodes.Call, delegateType.FindMethod("Invoke")));
method.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
delegateType.Methods.Add(method);
ctx.Context.Registry.GetService<IMarkerService>().Mark(method);
ctx.Name.SetCanRename(method, false);
return method;
}
示例6: methodDef
private MethodDef methodDef(TypeDef tDef, string name)
{
var importmeType = tDef.FindMethod(name);
return importmeType;
}