public static List <string> CheckFileDefault(string csvFile) { List <string> errors = new List <string>(); if (!File.Exists(csvFile)) { return(errors); } string[] lines = File.ReadAllLines(csvFile); for (int i = 0; i < lines.Length; i++) { List <string> items = JwCSV.GetLineItems(lines[i]); if (items.Count < 20) { errors.Add("Not enought items in line " + i.ToString()); continue; } // skip 1st line if (items[0] == "code") { continue; } // check code (0) is not blank if (items[0] == String.Empty) { errors.Add("line " + i.ToString() + ": code is blank"); } // check correct_choice (2) starts with "choice_" if (!items[2].StartsWith("choice_")) { errors.Add("line " + i.ToString() + ": cell 3 should start with 'choice_'"); } // check 13 = Open if (items[13] != "Open") { errors.Add("line " + i.ToString() + ": cell 14 should be 'Open'"); } // check 14 = L1 if (items[14] != "L1") { errors.Add("line " + i.ToString() + ": cell 15 should be 'L1'"); } } return(errors); }
public static List <string> CheckFileMResponse(string csvFile) { List <string> errors = new List <string>(); if (!File.Exists(csvFile)) { return(errors); } string[] lines = File.ReadAllLines(csvFile); for (int i = 0; i < lines.Length; i++) { List <string> items = JwCSV.GetLineItems(lines[i]); if (items.Count < 27) { errors.Add("Not enought items in line " + i.ToString()); continue; } // skip 1st line if (items[0] == "code") { continue; } // check code (0) is not blank if (items[0] == String.Empty) { errors.Add("line " + i.ToString() + ": code is blank"); } // check 22 = Open if (items[22] != "Open") { errors.Add("line " + i.ToString() + ": cell 23 should be 'Open'"); } // check 23 = L1 if (items[23] != "L1") { errors.Add("line " + i.ToString() + ": cell 24 should be 'L1'"); } } return(errors); }