Beispiel #1
0
        static List <Instruction> getOffsetCalcInstructions(MethodDefinition method)
        {
            var creator = new ReflectionToCecilMethodCreator(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);
        }
Beispiel #2
0
        static List<Instruction> getOffsetCalcInstructions(MethodDefinition method)
        {
            var creator = new ReflectionToCecilMethodCreator(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;
        }