Exemplo n.º 1
0
 public TSWalker(TsItems.TsOutputer output, Input.TsContext context, SemanticModel model)
 {
     this.model   = model;
     this.context = context;
     this.output  = output;
     output.ResetIndent();
 }
Exemplo n.º 2
0
        void DoWork()
        {
            var workspace = MSBuildWorkspace.Create();
            var project = workspace.OpenProjectAsync(@"../../../ATestProject/ATestProject.csproj").Result;

            var compUnit = project.GetCompilationAsync().Result;
            var context = new Input.TsContext();

            var output = new TsItems.TsOutputer();
            foreach (var st in compUnit.SyntaxTrees)
            {

                var semanticModel = compUnit.GetSemanticModel(st);
                var root = st.GetRoot();
                var tsw = new TSWalker(output, context, semanticModel);
                tsw.Visit(root);
                Console.WriteLine(st.FilePath);
            }

            System.IO.File.WriteAllText("output.ts", output.GetContent(), Encoding.UTF8);
        }
Exemplo n.º 3
0
        void DoWork()
        {
            var workspace = MSBuildWorkspace.Create();
            var project   = workspace.OpenProjectAsync(@"../../../ATestProject/ATestProject.csproj").Result;



            var compUnit = project.GetCompilationAsync().Result;
            var context  = new Input.TsContext();

            var output = new TsItems.TsOutputer();

            foreach (var st in compUnit.SyntaxTrees)
            {
                var semanticModel = compUnit.GetSemanticModel(st);
                var root          = st.GetRoot();
                var tsw           = new TSWalker(output, context, semanticModel);
                tsw.Visit(root);
                Console.WriteLine(st.FilePath);
            }


            System.IO.File.WriteAllText("output.ts", output.GetContent(), Encoding.UTF8);
        }