public static IEnumerable <string> ParseRow(TextReader stream) { string line = Csv.ReadLine(stream); if (line != null) { int pos = 0; while (pos < line.Length) { string str1; if ((int)line[pos] == 34) { ++pos; string str2 = string.Empty; int startIndex = pos; while (pos < line.Length) { if ((int)line[pos] == 34) { ++pos; if (pos >= line.Length) { string str3 = Csv.ReadLine(stream); if (str3 == null) { --pos; break; } str2 = str2 + line.Substring(startIndex) + "\n"; line = str3; pos = startIndex = 0; continue; } if ((int)line[pos] != 34) { --pos; break; } } ++pos; if (pos >= line.Length) { string str3 = Csv.ReadLine(stream); if (str3 != null) { str2 = str2 + line.Substring(startIndex) + "\n"; line = str3; pos = startIndex = 0; } else { break; } } } str1 = (str2 + line.Substring(startIndex, pos - startIndex)).Replace("\"\"", "\""); } else { int startIndex = pos; while (pos < line.Length && (int)line[pos] != 44) { ++pos; } str1 = line.Substring(startIndex, pos - startIndex); } yield return(str1); while (pos < line.Length && (int)line[pos] != 44) { ++pos; } if (pos < line.Length) { ++pos; } } } }
public static IEnumerable <string> ParseRow(string text) { Invariant.ArgumentNotNull((object)text, "text"); return(Csv.ParseRow((TextReader) new StringReader(text))); }