本文整理汇总了C#中TypeDef.FindStaticConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDef.FindStaticConstructor方法的具体用法?C# TypeDef.FindStaticConstructor怎么用?C# TypeDef.FindStaticConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDef
的用法示例。
在下文中一共展示了TypeDef.FindStaticConstructor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckType
static MethodDef CheckType(TypeDef type) {
if (!new FieldTypes(type).Exactly(requiredFields))
return null;
if (type.FindStaticConstructor() == null)
return null;
return CheckMethods(type);
}
示例2: Check
bool Check(TypeDef type) {
if (type.NestedTypes.Count != 1)
return false;
if (type.Fields.Count != 3)
return false;
if (!new FieldTypes(type).All(requiredFields))
return false;
var cctor = type.FindStaticConstructor();
if (cctor == null)
return false;
var decryptMethodTmp = FindDecryptMethod(type);
if (decryptMethodTmp == null)
return false;
decryptMethod = decryptMethodTmp;
decrypterCctor = cctor;
decrypterType = type;
return true;
}
示例3: InitType
void InitType(TypeDef type) {
var cctor = type.FindStaticConstructor();
if (cctor == null)
return;
var info = GetStringInfo(cctor);
if (info == null)
return;
stringInfos.Add(info.field, info);
}
示例4: GetTokens
bool GetTokens(TypeDef delegateType, out int delegateToken, out int encMethodToken, out int encDeclaringTypeToken) {
delegateToken = 0;
encMethodToken = 0;
encDeclaringTypeToken = 0;
var cctor = delegateType.FindStaticConstructor();
if (cctor == null)
return false;
var instrs = cctor.Body.Instructions;
for (int i = 0; i < instrs.Count - 3; i++) {
var ldci4_1 = instrs[i];
if (!ldci4_1.IsLdcI4())
continue;
var ldci4_2 = instrs[i + 1];
if (!ldci4_2.IsLdcI4())
continue;
var ldci4_3 = instrs[i + 2];
if (!ldci4_3.IsLdcI4())
continue;
var call = instrs[i + 3];
if (call.OpCode.Code != Code.Call)
continue;
var calledMethod = call.Operand as MethodDef;
if (calledMethod == null)
continue;
if (calledMethod != decryptMethod)
continue;
delegateToken = ldci4_1.GetLdcI4Value();
encMethodToken = ldci4_2.GetLdcI4Value();
encDeclaringTypeToken = ldci4_3.GetLdcI4Value();
return true;
}
return false;
}
示例5: couldBeStringDecrypterClass
bool couldBeStringDecrypterClass(TypeDef type)
{
var fields = new FieldTypes(type);
if (fields.exists("System.Collections.Hashtable") ||
fields.exists("System.Collections.Generic.Dictionary`2<System.Int32,System.String>") ||
fields.exactly(fields3x)) {
if (type.FindStaticConstructor() == null)
return false;
}
else if (fields.exactly(fields1x) || fields.exactly(fields2x)) {
}
else
return false;
var methods = new List<MethodDef>(DotNetUtils.getNormalMethods(type));
if (methods.Count != 1)
return false;
var method = methods[0];
if (!DotNetUtils.isMethod(method, "System.String", "(System.Int32)"))
return false;
if (!method.IsStatic || !method.HasBody)
return false;
return true;
}