Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.             try
  2.             {
  3.                 string myFile = @"C:\Users\Gareth\SkyDrive\CODE\Bradaz.Utils\ConsoleApplication1\testfile.txt";
  4.                 CSVFile file = new CSVFile(myFile);
  5.          
  6.                 using (file.CSVStream = new CSVReader(file.FileNameAndPath))
  7.                 {
  8.                     file.ReadLines();
  9.  
  10.                     //sort so we get the Validated first.
  11.    
  12.                     foreach(CSVRow row in file.Rows)
  13.                     {
  14.                         Console.WriteLine("==========");
  15.                         Console.WriteLine("Row No: " + row.RowNumber + " has " + row.NumberOfColumns + " columns. The data is " + row.OriginalData);
  16.                         Console.WriteLine("Validation: ");
  17.                         Console.WriteLine("Row No: " + row.RowNumber + " " + row.State);
  18.  
  19.                         foreach (RowError error in row.Errors)
  20.                         {
  21.                             Console.WriteLine("Error: " + error);
  22.  
  23.                         }
  24.  
  25.                         if (row.NumberOfColumns > 0)
  26.                         {
  27.                             foreach(CSVColumn column in row.Columns)
  28.                             {
  29.                                 Console.WriteLine("Column No: " + column.ColumnNumber + " for row " + column.RowNumber + " " + column.ColumnValue);
  30.                             }
  31.                         }
  32.  
  33.                     }
  34.                    
  35.                 }
  36.             }
  37.             catch (Exception e)
  38.             {
  39.                 Console.WriteLine("Error reading file " + e.Message);
  40.             }