Exemple #1
0
        static void Main(string[] args)
        {
            string strFileName;

            if (args.Length > 0)
            {
                strFileName = args[0];
            }
            else
            {
                return;
            }

            using (var host = new HostEnvironment()) {
                IUnit unit = host.LoadUnitFrom(strFileName);

                CSharpSourceEmitter.SourceEmitterOutputString sourceEmitterOutput = new CSharpSourceEmitter.SourceEmitterOutputString();
                CSharpSourceEmitter.SourceEmitter             CSSourceEmitter     = new CSharpSourceEmitter.SourceEmitter(sourceEmitterOutput);

                CSSourceEmitter.Traverse(unit.UnitNamespaceRoot);

                Console.WriteLine(sourceEmitterOutput.Data);
            }
            Console.ReadLine();
        }
Exemple #2
0
 public static void DumpCCI(Microsoft.Cci.MutableCodeModel.Assembly assembly, string filename = "CCI2Code.cs", string path = @"c:\\tmp\\Roslyn\\")
 {
     if (assembly == null) return;
     try
     {
         System.IO.Directory.CreateDirectory(path);
         using (var dump = new StreamWriter(Path.Combine(path, filename)))
         {
             var ce = new CSharpSourceEmitter.SourceEmitterOutputTextWriter(dump);
             CSharpSourceEmitter.SourceEmitter csse = new CSharpSourceEmitter.SourceEmitter(ce);
             csse.Traverse(assembly);
         }
     }
     catch { }
 }
Exemple #3
0
 public static void DumpCCI(Microsoft.Cci.MutableCodeModel.Assembly assembly, string filename = "CCI2Code.cs", string path = @"c:\\tmp\\Roslyn\\")
 {
     if (assembly == null)
     {
         return;
     }
     try
     {
         System.IO.Directory.CreateDirectory(path);
         using (var dump = new StreamWriter(Path.Combine(path, filename)))
         {
             var ce = new CSharpSourceEmitter.SourceEmitterOutputTextWriter(dump);
             CSharpSourceEmitter.SourceEmitter csse = new CSharpSourceEmitter.SourceEmitter(ce);
             csse.Traverse(assembly);
         }
     }
     catch { }
 }