Пример #1
0
        static void Main(string [] args)
        {
            //var method = GetProgramMethod ("Triangle1");
            AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(args[1]);
            TypeDefinition     type     = assembly.MainModule.GetType("TestCase");
            MethodDefinition   method   = GetMethod(type.Methods, "Main");

            var cfg = ControlFlowGraph.Create(method);

            FormatControlFlowGraph(Console.Out, cfg);

            Console.WriteLine("--------------------");

            var store = AnnotationStore.CreateStore(cfg, BlockOptimization.Detailed);

            PrintAnnotations(method, store);

            var language = CSharp.GetLanguage(CSharpVersion.V1);

            //var body = method.Body.Decompile (language);

            var writer = language.GetWriter(new PlainTextFormatter(Console.Out));

            writer.Write(method);

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string [] args)
        {
            var method = GetProgramMethod("Main");

            var cfg = ControlFlowGraph.Create(method);

            FormatControlFlowGraph(Console.Out, cfg);

            Console.WriteLine("--------------------");

            var store = AnnotationStore.CreateStore(cfg, BlockOptimization.Detailed);

            PrintAnnotations(method, store);

            var language = CSharp.GetLanguage(CSharpVersion.V1);

            var body = method.Body.Decompile(language);

            var writer = language.GetWriter(new PlainTextFormatter(Console.Out));

            writer.Write(method);
        }