private static async Task RunAsync(Options option) { var cnbProvider = new CzechNationalBankProvider(); var kurzyCzProvider = new KurzyCzProvider(); var parser = new TransactionParser(); var transactions = new List <Transaction>(); var filePaths = ResolveFilePaths(option.StatementFilePaths); if (filePaths.Count == 0) { Console.WriteLine("No valid path to scan found. Check that file or directory exist."); return; } foreach (var file in filePaths) { Console.WriteLine($"Processing file: {file}"); var result = await parser.ParseAsync(file); if (result != null) { transactions.AddRange(result); } } Console.WriteLine("Downloading exchange rates ..."); var builder = new TransactionViewBuilder(kurzyCzProvider, cnbProvider); var transactionViews = await builder.BuildAsync(transactions); var summaryViews = CreateDividendSummaryViews(transactionViews); var views = new List <object>(transactionViews); views.AddRange(summaryViews); Print(option, views); }
private static async Task RunAsync(Options option) { var parser = new TransactionParser(); var transactions = new List <Transaction>(); var filePaths = ResolveFilePaths(option.StatementFilePaths); if (filePaths.Count == 0) { Console.WriteLine("No valid path to scan found. Check that file or directory exist."); return; } foreach (var file in filePaths) { Console.WriteLine($"Processing file: {file}"); var result = await parser.ParseAsync(file); if (result != null) { transactions.AddRange(result); } } var printer = new Output(); if (option.ShouldPrintAsJson) { printer.PrintAsJson(transactions); } else if (option.ExcelSheetPath != null) { printer.SaveAsExcelSheet(option.ExcelSheetPath, transactions); } else { printer.PrintAsPlainText(transactions); } }