private static ParseResult <TransactionFileRecordModel> ParseFile(Stream stream) { var parser = new CsvFileParser <TransactionFileRecordModel, TransactionFileRecordMap> { Delimiter = ";" }; using (stream) { return(parser.Parse(stream)); } }
private static void Main(string[] args) { fileParser = Initialize(); try { fileParser.Parse(); } catch (Exception e) { Console.WriteLine(e.Message); } finally { fileParser.Cleanup(); } Console.WriteLine($"{Environment.NewLine}Program zakonczyl dzialanie. Nacisnij dowolny przycisk by zamknac okno..."); Console.ReadKey(); }
public void RunTest_TabularItem() { var csvStringBuilder = new StringBuilder(); csvStringBuilder.AppendLine("12, 9,7,6,4"); csvStringBuilder.AppendLine("12,11,8,7,5"); csvStringBuilder.AppendLine("13,10,9,6,3"); csvStringBuilder.Append("12,8,6,4,2"); var csvString = csvStringBuilder.ToString(); var csvStringReader = new StringReader(csvString); var parser = new IntegerParser <string>(); var csvParser = new CsvFileParser <ITabularItem, int, string, string>( "new_line", "comma", (i, j) => parser); csvParser.AddIgnoreType("space"); csvParser.AddIgnoreType("carriage_return"); var csvSymbolReader = new StringSymbolReader(csvStringReader, true, false); var adder = new TabularItemAdder <int>(); var tabularItem = new TabularListsItem(); csvParser.Parse(csvSymbolReader, tabularItem, adder); var integerDomain = new IntegerDomain(); var numberTdecomposition = new IntegerMinWeightTdecomposition <int>( Comparer <int> .Default, integerDomain); var result = numberTdecomposition.Run(18, tabularItem); var expectedMedians = new List <int>() { 3, 5, 5, 5 }; Assert.AreEqual(17, result.Cost); CollectionAssert.AreEquivalent(expectedMedians, result.Medians.ToList()); }
public TResultSet GetAll() { return(CsvFileParser.Parse(ResultSet)); }