public async Task Start() { Reader fileReader = new Reader(); Writer fileWriter = new Writer(fFolder); var reader = new TransformBlock <string, string>(filename => fileReader.ReadFromFile(filename), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = fMaxDegreeOfParallelism }); var transformer = new TransformManyBlock <string, string>(data => GeneratorTestClasses.Start(data), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = fMaxDegreeOfParallelism }); var writer = new ActionBlock <string>(text => fileWriter.WritetoFile(text), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = fMaxDegreeOfParallelism }); var linkOptions = new DataflowLinkOptions { PropagateCompletion = true }; reader.LinkTo(transformer, linkOptions); transformer.LinkTo(writer, linkOptions); foreach (string filename in fFilenames) { await reader.SendAsync(filename); } reader.Complete(); writer.Completion.Wait(); }
public void Initialize() { roots = new List <CompilationUnitSyntax>(); filename = "SuperPuperMegaModule.cs"; Reader fileReader = new Reader(); string data = fileReader.ReadFromFile(filename).Result; codes = GeneratorTestClasses.Start(data); foreach (string code in codes) { SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(code); roots.Add(tree.GetCompilationUnitRoot()); } }