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);
|
string[] parsedColumns = line.Split(delim);
|
||||||
foreach (string parsed in parsedColumns)
|
foreach (string parsed in parsedColumns)
|
||||||
{
|
{
|
||||||
switch (parsed.ToLowerInvariant())
|
switch (parsed.ToLowerInvariant().Trim('"'))
|
||||||
{
|
{
|
||||||
case "file":
|
case "file":
|
||||||
case "filename":
|
case "filename":
|
||||||
@@ -982,6 +982,9 @@ namespace SabreTools.Library.Dats
|
|||||||
case "item status":
|
case "item status":
|
||||||
columns.Add("DatItem.Nodump");
|
columns.Add("DatItem.Nodump");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
columns.Add("INVALID");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1008,7 +1011,7 @@ namespace SabreTools.Library.Dats
|
|||||||
// Now we loop through and get values for everything
|
// Now we loop through and get values for everything
|
||||||
for (int i = 0; i < columns.Count; i++)
|
for (int i = 0; i < columns.Count; i++)
|
||||||
{
|
{
|
||||||
string value = parsedLine[i];
|
string value = parsedLine[i].Trim('"');
|
||||||
switch (columns[i])
|
switch (columns[i])
|
||||||
{
|
{
|
||||||
case "DatFile.FileName":
|
case "DatFile.FileName":
|
||||||
@@ -1051,7 +1054,7 @@ namespace SabreTools.Library.Dats
|
|||||||
break;
|
break;
|
||||||
case "Rom.Name":
|
case "Rom.Name":
|
||||||
case "Disk.Name":
|
case "Disk.Name":
|
||||||
name = value;
|
name = value == "" ? name : value;
|
||||||
break;
|
break;
|
||||||
case "DatItem.Size":
|
case "DatItem.Size":
|
||||||
if (!Int64.TryParse(value, out size))
|
if (!Int64.TryParse(value, out size))
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ namespace SabreTools.Library.Dats
|
|||||||
break;
|
break;
|
||||||
case DatFormat.CSV:
|
case DatFormat.CSV:
|
||||||
header = "\"File Name\",\"Internal Name\",\"Description\",\"Game Name\",\"Game Description\",\"Type\",\"" +
|
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;
|
break;
|
||||||
case DatFormat.DOSCenter:
|
case DatFormat.DOSCenter:
|
||||||
header = "DOSCenter (\n" +
|
header = "DOSCenter (\n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user