public void ProcessFile() { if (File.Exists(_inputFileName)) { using (var reader = new StreamReader(_inputFileName, Encoding.UTF8)) { string headerLine = reader.ReadLine(); bool firstValueFound = false; DataTable table = new DataTable(); DataTable outputTable = new DataTable(); while (!reader.EndOfStream) { string[] values = _textParser.ParseFileLine(reader.ReadLine()); if (values.Any(v => !string.IsNullOrEmpty(v))) { if (!firstValueFound) { _columnBuilder.BuildInputColumns(table, headerLine, values); _columnBuilder.BuildOutputColumns(outputTable, table); firstValueFound = true; } DataRow resultRow = _textParser.FillDataFromString(table.NewRow(), values); ICollection <DataRow> rowsToWrite = FormOutputRow(resultRow, outputTable); _writer.PrepareOutputForSaving(rowsToWrite); } } } _writer.WriteOutputFile(); } else { Debug.Fail("input file not found. Please check your setup"); } }