Add hasInteger() method

This commit is contained in:
de4dot 2012-02-11 23:11:41 +01:00
parent d44db9871e
commit bffbe419d5

View File

@ -162,5 +162,19 @@ namespace de4dot.code.deobfuscators {
((int)reader.ReadByte() << 8) +
reader.ReadByte();
}
public static bool hasInteger(MethodDefinition method, uint value) {
return hasInteger(method, (int)value);
}
public static bool hasInteger(MethodDefinition method, int value) {
foreach (var instr in method.Body.Instructions) {
if (!DotNetUtils.isLdcI4(instr))
continue;
if (DotNetUtils.getLdcI4Value(instr) == value)
return true;
}
return false;
}
}
}