Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion WDBXEditor/Storage/DBEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,30 @@ public bool ImportCSV(string filename, bool headerrow, UpdateMode mode, out stri

while (!sr.EndOfStream)
{
string line = sr.ReadLine();
string line = "";

// if it's not the end of the file, read the 2 first char
if (sr.EndOfStream)
{
break;
}
line += (char)sr.Read();

if (sr.EndOfStream)
{
break;
}
line += (char)sr.Read();

// while it's not the end of a row (marked by \r\n), neither the end of the file, append the chars to the line
while (line.Substring(line.Length-2) != "\r\n" && !sr.EndOfStream)
{
line += (char)sr.Read(); ;
}

// remove the \r\n last chars as the old code don't expect them
line = line.Remove(line.Length - 2);

string[] rows = Regex.Split(line, ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))", RegexOptions.Compiled);
DataRow dr = importTable.NewRow();

Expand Down