[SabreTools, Flags, DatFile, Utilities] Add SSV in/out

This commit is contained in:
Matt Nadareski
2018-01-08 18:02:50 -08:00
parent c4bacd67c3
commit f366e32c48
6 changed files with 67 additions and 5 deletions

View File

@@ -2347,7 +2347,9 @@ namespace SabreTools.Library.DatFiles
DatFile innerDatdata = new DatFile(this);
Globals.Logger.User("Processing '{0}'", Path.GetFileName(file.Split('¬')[0]));
innerDatdata.Parse(file, 0, 0, splitType, keep: true, clean: clean, remUnicode: remUnicode, descAsName: descAsName,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0
|| (innerDatdata.DatFormat & DatFormat.CSV) != 0
|| (innerDatdata.DatFormat & DatFormat.SSV) != 0));
filter.FilterDatFile(innerDatdata);
// Get the correct output path
@@ -5793,6 +5795,12 @@ namespace SabreTools.Library.DatFiles
outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", overwrite));
}
// SSV
if ((DatFormat & DatFormat.SSV) != 0)
{
outfileNames.Add(DatFormat.SSV, CreateOutfileNamesHelper(outDir, ".ssv", overwrite));
};
// TSV
if ((DatFormat & DatFormat.TSV) != 0)
{

View File

@@ -206,8 +206,9 @@ namespace SabreTools.Library.Data
// Standardized Text Formats
MissFile = AttractMode << 1,
CSV = MissFile << 1,
TSV = CSV << 1,
CSV = MissFile << 1, // Comma-separated
SSV = CSV << 1, // Semicolon-separated
TSV = SSV << 1, // Tab-separated
Listrom = TSV << 1,
// SFV-similar Formats

View File

@@ -256,7 +256,10 @@ Options:
-osl, --output-softwarelist Output in Software List format
Add outputting the created DAT to Software List XML format
-ossv, --output-ssv Output in Semicolon-Separated Value format
Add outputting the created DAT to standardized SSV format
-otsv, --output-tsv Output in Tab-Separated Value format
Add outputting the created DAT to standardized TSV format
@@ -467,7 +470,10 @@ Options:
-osl, --output-softwarelist Output in Software List format
Add outputting the created DAT to Software List XML format
-ossv, --output-ssv Output in Semicolon-Separated Value format
Add outputting the created DAT to standardized SSV format
-otsv, --output-tsv Output in Tab-Separated Value format
Add outputting the created DAT to standardized TSV format
@@ -922,7 +928,30 @@ Options:
-osl, --output-softwarelist Output in Software List format
Add outputting the created DAT to Software List XML format
-ossv, --output-ssv Output in Semicolon-Separated Value format
Add outputting the created DAT to standardized SSV format
-pre=, --prefix= Set prefix for all lines
Set a generic prefix to be prepended to all outputted lines
-post=, --postfix= Set postfix for all lines
Set a generic postfix to be appended to all outputted lines
Both prefix and postfix can use one of the following strings:
- %game% - Replaced with the Game/Machine name
- %name% - Replaced with the Rom name
- %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1
- %sha256% - Replaced with the SHA-256
- %sha384% - Replaced with the SHA-384
- %sha512% - Replaced with the SHA-512
- %size% - Replaced with the size
-q, --quotes Put double-quotes around each item
This quotes only the item and not the prefix and postfix
-otsv, --output-tsv Output in Tab-Separated Value format
Add outputting the created DAT to standardized TSV format

View File

@@ -619,6 +619,8 @@ namespace SabreTools.Library.Tools
return new SabreDat(baseDat);
case DatFormat.SoftwareList:
return new SoftwareList(baseDat);
case DatFormat.SSV:
return new DatFiles.SeparatedValue(baseDat, ';');
case DatFormat.TSV:
return new DatFiles.SeparatedValue(baseDat, '\t');
}
@@ -1035,6 +1037,8 @@ namespace SabreTools.Library.Tools
return DatFormat.RedumpSHA384;
case "sha512":
return DatFormat.RedumpSHA512;
case "ssv":
return DatFormat.SSV;
case "tsv":
return DatFormat.TSV;
}