static List <Instruction> GetOffsetCalcInstructions(MethodDef method) { var creator = new ReflectionToDNLibMethodCreator(method); creator.Create(); var instrs = creator.Instructions; int index = 0; index = FindInstruction(instrs, index, OpCodes.Conv_I4); if (index < 0) { return(null); } int startInstr = ++index; index = FindInstruction(instrs, index, OpCodes.Box); if (index < 0) { return(null); } int endInstr = index - 1; var transformInstructions = new List <Instruction>(); for (int i = startInstr; i <= endInstr; i++) { transformInstructions.Add(instrs[i]); } return(transformInstructions); }
static List<Instruction> GetOffsetCalcInstructions(MethodDef method) { var creator = new ReflectionToDNLibMethodCreator(method); creator.Create(); var instrs = creator.Instructions; int index = 0; index = FindInstruction(instrs, index, OpCodes.Conv_I4); if (index < 0) return null; int startInstr = ++index; index = FindInstruction(instrs, index, OpCodes.Box); if (index < 0) return null; int endInstr = index - 1; var transformInstructions = new List<Instruction>(); for (int i = startInstr; i <= endInstr; i++) transformInstructions.Add(instrs[i]); return transformInstructions; }