public TSWalker(TsItems.TsOutputer output, Input.TsContext context, SemanticModel model) { this.model = model; this.context = context; this.output = output; output.ResetIndent(); }
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); }