Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Simple Add:");

            foreach (MSIL.Instruction instruction in MSIL.ReadMethod(typeof(Program).GetMethod("simpleAdd")))
            {
                Console.WriteLine(instruction.ToString());
            }
        }
        public StudyPage()
        {
            InitializeComponent();

            #region AnimationsInit
            Task.WhenAll(
                CSharpDef.FadeTo(0, 1),
                definitions.FadeTo(0, 1),
                progLang.FadeTo(0, 1),
                OOP.FadeTo(0, 1),
                DotNETFramework.FadeTo(0, 1),
                clr.FadeTo(0, 1),
                cls.FadeTo(0, 1),
                cts.FadeTo(0, 1),
                MSIL.FadeTo(0, 1),
                JIT.FadeTo(0, 1),
                Compiler.FadeTo(0, 1),
                SourceCode.FadeTo(0, 1),
                ExecutableCode.FadeTo(0, 1),
                boxview1.FadeTo(0, 1),
                generalProgTerms.FadeTo(0, 1),
                Variables.FadeTo(0, 1),
                DataType.FadeTo(0, 1),
                Keywords.FadeTo(0, 1),
                Operators.FadeTo(0, 1),
                Expression.FadeTo(0, 1),
                TypeCasting.FadeTo(0, 1),
                Arrays.FadeTo(0, 1),
                Function.FadeTo(0, 1),
                Class.FadeTo(0, 1),
                Object.FadeTo(0, 1),
                Constructor.FadeTo(0, 1),
                Destructor.FadeTo(0, 1),
                Namespaces.FadeTo(0, 1),
                Exceptions.FadeTo(0, 1),
                ExceptionHandling.FadeTo(0, 1),
                boxview2.FadeTo(0, 1),
                oopProgTerms.FadeTo(0, 1),
                Inheritance.FadeTo(0, 1),
                BaseClass.FadeTo(0, 1),
                DerivedClass.FadeTo(0, 1),
                AbstractClass.FadeTo(0, 1),
                MultilevelInheritance.FadeTo(0, 1),
                HierarchicalInheritance.FadeTo(0, 1),
                SingleInheritance.FadeTo(0, 1),
                Interface.FadeTo(0, 1),
                Polymorphism.FadeTo(0, 1),
                Overriding.FadeTo(0, 1),
                Encapsulation.FadeTo(0, 1),
                Abstraction.FadeTo(0, 1),
                Overloading.FadeTo(0, 1));
            #endregion


            // App.adCounter = 0;
        }
        protected async override void OnAppearing()
        {
            #region AnimationsFadeIn
            await Task.WhenAll(
                CSharpDef.FadeTo(1, 500),
                definitions.FadeTo(1, 500),
                progLang.FadeTo(1, 500),
                OOP.FadeTo(1, 500),
                DotNETFramework.FadeTo(1, 500),
                clr.FadeTo(1, 500),
                cls.FadeTo(1, 500),
                cts.FadeTo(1, 500),
                MSIL.FadeTo(1, 500),
                JIT.FadeTo(1, 500),
                Compiler.FadeTo(1, 500),
                SourceCode.FadeTo(1, 500),
                ExecutableCode.FadeTo(1, 500),
                boxview1.FadeTo(1, 500),
                generalProgTerms.FadeTo(1, 500),
                Variables.FadeTo(1, 500),
                DataType.FadeTo(1, 500),
                Keywords.FadeTo(1, 500),
                Operators.FadeTo(1, 500),
                Expression.FadeTo(1, 500),
                TypeCasting.FadeTo(1, 500),
                Arrays.FadeTo(1, 500),
                Function.FadeTo(1, 500),
                Class.FadeTo(1, 500),
                Object.FadeTo(1, 500),
                Constructor.FadeTo(1, 500),
                Destructor.FadeTo(1, 500),
                Namespaces.FadeTo(1, 500),
                Exceptions.FadeTo(1, 500),
                ExceptionHandling.FadeTo(1, 500),
                boxview2.FadeTo(1, 500),
                oopProgTerms.FadeTo(1, 500),
                Inheritance.FadeTo(1, 500),
                BaseClass.FadeTo(1, 500),
                DerivedClass.FadeTo(1, 500),
                AbstractClass.FadeTo(1, 500),
                MultilevelInheritance.FadeTo(1, 500),
                HierarchicalInheritance.FadeTo(1, 500),
                SingleInheritance.FadeTo(1, 500),
                Interface.FadeTo(1, 500),
                Polymorphism.FadeTo(1, 500),
                Overriding.FadeTo(1, 500),
                Encapsulation.FadeTo(1, 500),
                Abstraction.FadeTo(1, 500),
                Overloading.FadeTo(1, 500));

            #endregion
        }
Exemple #4
0
        static void Main(string[] args)
        {
            System.Reflection.Emit.AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new System.Reflection.AssemblyName("Patch"), System.Reflection.Emit.AssemblyBuilderAccess.Run, (string)null);
            System.Reflection.Emit.ModuleBuilder   moduleBuilder   = assemblyBuilder.DefineDynamicModule("module");
            System.Reflection.Emit.TypeBuilder     typeBuilder     = moduleBuilder.DefineType("program", System.Reflection.TypeAttributes.Public);
            System.Reflection.Emit.MethodBuilder   methodBuilder   = typeBuilder.DefineMethod("simpleSub", System.Reflection.MethodAttributes.Static | System.Reflection.MethodAttributes.Public | System.Reflection.MethodAttributes.HideBySig, typeof(int), new Type[] { typeof(int), typeof(int) });

            List <MSIL.Instruction> patchedMethod = new List <MSIL.Instruction>();

            foreach (MSIL.Instruction instruction in MSIL.ReadMethod(typeof(Program).GetMethod("simpleAdd")))
            {
                if (instruction.OpCode == System.Reflection.Emit.OpCodes.Add)
                {
                    instruction.OpCode = System.Reflection.Emit.OpCodes.Sub;
                }
                patchedMethod.Add(instruction);
            }
            MSIL.EmitMethod(patchedMethod, methodBuilder);

            Type type = typeBuilder.CreateType();

            System.Reflection.MethodInfo pathedMethod = type.GetMethod("simpleSub");
            System.Console.WriteLine("result: " + (int)pathedMethod.Invoke(null, new object[] { 3, 1 }));
        }