Add isEmptyObfuscated() method

This commit is contained in:
de4dot 2011-11-24 10:35:42 +01:00
parent eee2c509be
commit 1d8fe39f59

View File

@ -241,7 +241,7 @@ namespace de4dot.blocks {
}
public static bool isEmpty(MethodDefinition method) {
if (!method.HasBody)
if (method.Body == null)
return false;
foreach (var instr in method.Body.Instructions) {
var code = instr.OpCode.Code;
@ -251,6 +251,17 @@ namespace de4dot.blocks {
return true;
}
public static bool isEmptyObfuscated(MethodDefinition method) {
if (method.Body == null)
return false;
int index = 0;
var instr = getInstruction(method.Body.Instructions, ref index);
if (instr == null || instr.OpCode.Code != Code.Ret)
return false;
return true;
}
public static FieldDefinition findFieldType(TypeDefinition typeDefinition, string typeName, bool isStatic) {
if (typeDefinition == null)
return null;