Move methods to DotNetUtils

This commit is contained in:
de4dot 2011-12-21 18:04:18 +01:00
parent 1fd7319b19
commit a6d8762d13
2 changed files with 20 additions and 4 deletions

View File

@ -131,6 +131,22 @@ namespace de4dot.blocks {
public static class DotNetUtils {
public static readonly TypeCaches typeCaches = new TypeCaches();
public static bool isLeave(Instruction instr) {
return instr.OpCode == OpCodes.Leave || instr.OpCode == OpCodes.Leave_S;
}
public static bool isBr(Instruction instr) {
return instr.OpCode == OpCodes.Br || instr.OpCode == OpCodes.Br_S;
}
public static bool isBrfalse(Instruction instr) {
return instr.OpCode == OpCodes.Brfalse || instr.OpCode == OpCodes.Brfalse_S;
}
public static bool isBrtrue(Instruction instr) {
return instr.OpCode == OpCodes.Brtrue || instr.OpCode == OpCodes.Brtrue_S;
}
public static bool isLdcI4(Instruction instruction) {
return isLdcI4(instruction.OpCode.Code);
}

View File

@ -128,19 +128,19 @@ namespace de4dot.blocks {
}
public bool isLeave() {
return OpCode == OpCodes.Leave || OpCode == OpCodes.Leave_S;
return DotNetUtils.isLeave(instruction);
}
public bool isBr() {
return OpCode == OpCodes.Br || OpCode == OpCodes.Br_S;
return DotNetUtils.isBr(instruction);
}
public bool isBrfalse() {
return OpCode == OpCodes.Brfalse || OpCode == OpCodes.Brfalse_S;
return DotNetUtils.isBrfalse(instruction);
}
public bool isBrtrue() {
return OpCode == OpCodes.Brtrue || OpCode == OpCodes.Brtrue_S;
return DotNetUtils.isBrtrue(instruction);
}
public bool isConditionalBranch() {