mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Fix CSV/TSV read and write
This commit is contained in:
@@ -905,7 +905,7 @@ namespace SabreTools.Library.Dats
|
||||
string[] parsedColumns = line.Split(delim);
|
||||
foreach (string parsed in parsedColumns)
|
||||
{
|
||||
switch (parsed.ToLowerInvariant())
|
||||
switch (parsed.ToLowerInvariant().Trim('"'))
|
||||
{
|
||||
case "file":
|
||||
case "filename":
|
||||
@@ -982,6 +982,9 @@ namespace SabreTools.Library.Dats
|
||||
case "item status":
|
||||
columns.Add("DatItem.Nodump");
|
||||
break;
|
||||
default:
|
||||
columns.Add("INVALID");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,7 +1011,7 @@ namespace SabreTools.Library.Dats
|
||||
// Now we loop through and get values for everything
|
||||
for (int i = 0; i < columns.Count; i++)
|
||||
{
|
||||
string value = parsedLine[i];
|
||||
string value = parsedLine[i].Trim('"');
|
||||
switch (columns[i])
|
||||
{
|
||||
case "DatFile.FileName":
|
||||
@@ -1051,7 +1054,7 @@ namespace SabreTools.Library.Dats
|
||||
break;
|
||||
case "Rom.Name":
|
||||
case "Disk.Name":
|
||||
name = value;
|
||||
name = value == "" ? name : value;
|
||||
break;
|
||||
case "DatItem.Size":
|
||||
if (!Int64.TryParse(value, out size))
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace SabreTools.Library.Dats
|
||||
break;
|
||||
case DatFormat.CSV:
|
||||
header = "\"File Name\",\"Internal Name\",\"Description\",\"Game Name\",\"Game Description\",\"Type\",\"" +
|
||||
"Rom Name\",\"Disk Name\",\"Size\",\"CRC\",\"MD5\",\"SHA1\"\"SHA256\",\"Nodump\"\n";
|
||||
"Rom Name\",\"Disk Name\",\"Size\",\"CRC\",\"MD5\",\"SHA1\",\"SHA256\",\"Nodump\"\n";
|
||||
break;
|
||||
case DatFormat.DOSCenter:
|
||||
header = "DOSCenter (\n" +
|
||||
|
||||
Reference in New Issue
Block a user