public ParseTransactionResult Parse(Stream parsingContent) { try { var result = TryParse(parsingContent); return(result); } catch (Exception ex) { return(ParseTransactionResult.Error(ex.Message)); } }
protected override ParseTransactionResult TryParse(Stream parsingContent) { using (TextReader reader = new StreamReader(parsingContent)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.HasHeaderRecord = false; csv.Configuration.IgnoreBlankLines = true; var records = csv.GetRecords <CsvParseRecords>().ToList(); var transactions = records.Select(ToTransaction).ToList(); return(ParseTransactionResult.Success(transactions)); } }