Ejemplo n.º 1
0
        public static IEnumerable <CodeInstruction> BackupAndCallTranspiler(ILGenerator generator, MethodBase originalMethod, IEnumerable <CodeInstruction> instructions)
        {
            if (originalMethod.DeclaringType == null)
            {
                return(instructions.AsEnumerable());
            }

            var codes = new List <CodeInstruction>(instructions);

            InstructionsBackup.AddOrUpdate(originalMethod, codes, (methodBase, oldCodes) => codes);

            var transpiler = new FieldChangeTranspiler(generator, originalMethod, codes);

            return(transpiler.Transpile());
        }
Ejemplo n.º 2
0
        public static IEnumerable <CodeInstruction> BackupAndCallTranspiler(ILGenerator generator, MethodBase originalMethod, IEnumerable <CodeInstruction> instructions)
        {
            if (originalMethod.DeclaringType == null)
            {
                return(instructions.AsEnumerable());
            }

            var codes = new List <CodeInstruction>(instructions);

            InstructionsBackup.Clear();
            InstructionsBackup.AddRange(codes);

            FieldChangeTranspiler.InitTranspiler(_customizationModule, generator, originalMethod, codes);

            return(FieldChangeTranspiler.Transpile());
        }