[DatFile] Finally get rid of softlist; replace by desc-game

This commit is contained in:
Matt Nadareski
2017-02-23 16:41:29 -08:00
parent 6192152919
commit 76f2579b7c
7 changed files with 90 additions and 67 deletions

View File

@@ -200,7 +200,7 @@ namespace RombaSharp
{ {
// Get the DAT file associated with the key // Get the DAT file associated with the key
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.Combine(_dats, foundDats[key]), 0, 0, _logger, softlist: true); datFile.Parse(Path.Combine(_dats, foundDats[key]), 0, 0, _logger);
// Create the new output directory if it doesn't exist // Create the new output directory if it doesn't exist
string outputFolder = Path.Combine("out", Path.GetFileNameWithoutExtension(foundDats[key])); string outputFolder = Path.Combine("out", Path.GetFileNameWithoutExtension(foundDats[key]));

View File

@@ -32,7 +32,7 @@ namespace SabreTools.Helper.Dats
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param> /// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param> /// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param> /// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
/// <param name="softlist">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param> /// <param name="descAsName">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param> /// <param name="filter">Filter object to be passed to the DatItem level</param>
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param> /// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param> /// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
@@ -41,7 +41,7 @@ namespace SabreTools.Helper.Dats
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param> /// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
/// <param name="logger">Logging object for console and file output</param> /// <param name="logger">Logging object for console and file output</param>
public void DetermineUpdateType(List<string> inputPaths, string outDir, bool merge, DiffMode diff, bool inplace, bool skip, public void DetermineUpdateType(List<string> inputPaths, string outDir, bool merge, DiffMode diff, bool inplace, bool skip,
bool bare, bool clean, bool softlist, Filter filter, SplitType splitType, bool trim, bool single, string root, bool bare, bool clean, bool descAsName, Filter filter, SplitType splitType, bool trim, bool single, string root,
int maxDegreeOfParallelism, Logger logger) int maxDegreeOfParallelism, Logger logger)
{ {
// If we're in merging or diffing mode, use the full list of inputs // If we're in merging or diffing mode, use the full list of inputs
@@ -57,7 +57,7 @@ namespace SabreTools.Helper.Dats
} }
// Create a dictionary of all ROMs from the input DATs // Create a dictionary of all ROMs from the input DATs
List<DatFile> datHeaders = PopulateUserData(newInputFileNames, inplace, clean, softlist, List<DatFile> datHeaders = PopulateUserData(newInputFileNames, inplace, clean, descAsName,
outDir, filter, splitType, trim, single, root, maxDegreeOfParallelism, logger); outDir, filter, splitType, trim, single, root, maxDegreeOfParallelism, logger);
// Modify the Dictionary if necessary and output the results // Modify the Dictionary if necessary and output the results
@@ -79,7 +79,7 @@ namespace SabreTools.Helper.Dats
// Otherwise, loop through all of the inputs individually // Otherwise, loop through all of the inputs individually
else else
{ {
Update(inputPaths, outDir, clean, softlist, filter, splitType, trim, single, root, maxDegreeOfParallelism, logger); Update(inputPaths, outDir, clean, descAsName, filter, splitType, trim, single, root, maxDegreeOfParallelism, logger);
} }
return; return;
} }
@@ -95,7 +95,7 @@ namespace SabreTools.Helper.Dats
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param> /// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
/// <param name="logger">Logging object for console and file output</param> /// <param name="logger">Logging object for console and file output</param>
/// <returns>List of DatData objects representing headers</returns> /// <returns>List of DatData objects representing headers</returns>
private List<DatFile> PopulateUserData(List<string> inputs, bool inplace, bool clean, bool softlist, string outDir, private List<DatFile> PopulateUserData(List<string> inputs, bool inplace, bool clean, bool descAsName, string outDir,
Filter filter, SplitType splitType, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger) Filter filter, SplitType splitType, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger)
{ {
DatFile[] datHeaders = new DatFile[inputs.Count]; DatFile[] datHeaders = new DatFile[inputs.Count];
@@ -116,7 +116,7 @@ namespace SabreTools.Helper.Dats
MergeRoms = MergeRoms, MergeRoms = MergeRoms,
}; };
datHeaders[i].Parse(input.Split('¬')[0], i, 0, filter, splitType, trim, single, root, logger, true, clean, softlist); datHeaders[i].Parse(input.Split('¬')[0], i, 0, filter, splitType, trim, single, root, logger, true, clean, descAsName);
}); });
logger.User("Processing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); logger.User("Processing complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -445,7 +445,7 @@ namespace SabreTools.Helper.Dats
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param> /// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param> /// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param> /// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
/// <param name="softlist">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param> /// <param name="descAsName">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param> /// <param name="filter">Filter object to be passed to the DatItem level</param>
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param> /// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param> /// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
@@ -453,7 +453,7 @@ namespace SabreTools.Helper.Dats
/// <param name="root">String representing root directory to compare against for length calculation</param> /// <param name="root">String representing root directory to compare against for length calculation</param>
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param> /// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
/// <param name="logger">Logging object for console and file output</param> /// <param name="logger">Logging object for console and file output</param>
public void Update(List<string> inputFileNames, string outDir, bool clean, bool softlist, Filter filter, public void Update(List<string> inputFileNames, string outDir, bool clean, bool descAsName, Filter filter,
SplitType splitType, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger) SplitType splitType, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger)
{ {
Parallel.ForEach(inputFileNames, Parallel.ForEach(inputFileNames,
@@ -471,7 +471,7 @@ namespace SabreTools.Helper.Dats
DatFile innerDatdata = new DatFile(this); DatFile innerDatdata = new DatFile(this);
logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\""); logger.User("Processing \"" + Path.GetFileName(inputFileName) + "\"");
innerDatdata.Parse(inputFileName, 0, 0, filter, splitType, trim, single, innerDatdata.Parse(inputFileName, 0, 0, filter, splitType, trim, single,
root, logger, true, clean, softlist, root, logger, true, clean, descAsName,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0)); keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
// Try to output the file // Try to output the file
@@ -488,7 +488,7 @@ namespace SabreTools.Helper.Dats
logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\""); logger.User("Processing \"" + Path.GetFullPath(file).Remove(0, inputFileName.Length) + "\"");
DatFile innerDatdata = new DatFile(this); DatFile innerDatdata = new DatFile(this);
innerDatdata.Parse(file, 0, 0, filter, splitType, innerDatdata.Parse(file, 0, 0, filter, splitType,
trim, single, root, logger, true, clean, softlist, trim, single, root, logger, true, clean, descAsName,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0)); keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
// Try to output the file // Try to output the file

View File

@@ -32,14 +32,14 @@ namespace SabreTools.Helper.Dats
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param> /// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param> /// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
/// <param name="useTags">True if tags from the DAT should be used to merge the output, false otherwise (default)</param> /// <param name="useTags">True if tags from the DAT should be used to merge the output, false otherwise (default)</param>
public void Parse(string filename, int sysid, int srcid, Logger logger, public void Parse(string filename, int sysid, int srcid, Logger logger,
bool keep = false, bool clean = false, bool softlist = false, bool keepext = false, bool useTags = false) bool keep = false, bool clean = false, bool descAsName = false, bool keepext = false, bool useTags = false)
{ {
Parse(filename, sysid, srcid, new Filter(), SplitType.None, false, false, "", logger, Parse(filename, sysid, srcid, new Filter(), SplitType.None, false, false, "", logger,
keep: keep, clean: clean, softlist: softlist, keepext: keepext, useTags: useTags); keep: keep, clean: clean, descAsName: descAsName, keepext: keepext, useTags: useTags);
} }
/// <summary> /// <summary>
@@ -56,7 +56,7 @@ namespace SabreTools.Helper.Dats
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param> /// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
/// <param name="keepext">True if original extension should be kept, false otherwise (default)</param> /// <param name="keepext">True if original extension should be kept, false otherwise (default)</param>
/// <param name="useTags">True if tags from the DAT should be used to merge the output, false otherwise (default)</param> /// <param name="useTags">True if tags from the DAT should be used to merge the output, false otherwise (default)</param>
public void Parse( public void Parse(
@@ -78,7 +78,7 @@ namespace SabreTools.Helper.Dats
Logger logger, Logger logger,
bool keep = false, bool keep = false,
bool clean = false, bool clean = false,
bool softlist = false, bool descAsName = false,
bool keepext = false, bool keepext = false,
bool useTags = false) bool useTags = false)
{ {
@@ -103,17 +103,17 @@ namespace SabreTools.Helper.Dats
switch (FileTools.GetDatFormat(filename, logger)) switch (FileTools.GetDatFormat(filename, logger))
{ {
case DatFormat.AttractMode: case DatFormat.AttractMode:
ParseAttractMode(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean); ParseAttractMode(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean, descAsName);
break; break;
case DatFormat.ClrMamePro: case DatFormat.ClrMamePro:
case DatFormat.DOSCenter: case DatFormat.DOSCenter:
ParseCMP(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean); ParseCMP(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean, descAsName);
break; break;
case DatFormat.Logiqx: case DatFormat.Logiqx:
case DatFormat.OfflineList: case DatFormat.OfflineList:
case DatFormat.SabreDat: case DatFormat.SabreDat:
case DatFormat.SoftwareList: case DatFormat.SoftwareList:
ParseGenericXML(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean, softlist); ParseGenericXML(filename, sysid, srcid, filter, trim, single, root, logger, keep, clean, descAsName);
break; break;
case DatFormat.RedumpMD5: case DatFormat.RedumpMD5:
ParseRedumpMD5(filename, sysid, srcid, filter, trim, single, root, logger, clean); ParseRedumpMD5(filename, sysid, srcid, filter, trim, single, root, logger, clean);
@@ -128,7 +128,7 @@ namespace SabreTools.Helper.Dats
ParseRedumpSHA256(filename, sysid, srcid, filter, trim, single, root, logger, clean); ParseRedumpSHA256(filename, sysid, srcid, filter, trim, single, root, logger, clean);
break; break;
case DatFormat.RomCenter: case DatFormat.RomCenter:
ParseRC(filename, sysid, srcid, filter, trim, single, root, logger, clean); ParseRC(filename, sysid, srcid, filter, trim, single, root, logger, clean, descAsName);
break; break;
default: default:
return; return;
@@ -188,6 +188,7 @@ namespace SabreTools.Helper.Dats
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
private void ParseAttractMode( private void ParseAttractMode(
// Standard Dat parsing // Standard Dat parsing
string filename, string filename,
@@ -205,7 +206,8 @@ namespace SabreTools.Helper.Dats
// Miscellaneous // Miscellaneous
Logger logger, Logger logger,
bool keep, bool keep,
bool clean) bool clean,
bool descAsName)
{ {
// Open a file reader // Open a file reader
Encoding enc = Style.GetEncoding(filename); Encoding enc = Style.GetEncoding(filename);
@@ -250,7 +252,7 @@ namespace SabreTools.Helper.Dats
Machine = new Machine Machine = new Machine
{ {
Name = gameinfo[0], Name = (descAsName ? gameinfo[1] : gameinfo[0]),
Description = gameinfo[1], Description = gameinfo[1],
CloneOf = gameinfo[3], CloneOf = gameinfo[3],
Year = gameinfo[4], Year = gameinfo[4],
@@ -280,6 +282,7 @@ namespace SabreTools.Helper.Dats
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
private void ParseCMP( private void ParseCMP(
// Standard Dat parsing // Standard Dat parsing
string filename, string filename,
@@ -297,7 +300,8 @@ namespace SabreTools.Helper.Dats
// Miscellaneous // Miscellaneous
Logger logger, Logger logger,
bool keep, bool keep,
bool clean) bool clean,
bool descAsName)
{ {
// Open a file reader // Open a file reader
Encoding enc = Style.GetEncoding(filename); Encoding enc = Style.GetEncoding(filename);
@@ -694,6 +698,12 @@ namespace SabreTools.Helper.Dats
break; break;
case "description": case "description":
gamedesc = itemval; gamedesc = itemval;
// If we want to have the description as the name, do so
if (descAsName)
{
tempgamename = gamedesc.Replace('/', '_').Replace("\"", "''");
}
break; break;
case "romof": case "romof":
romof = itemval; romof = itemval;
@@ -861,7 +871,7 @@ namespace SabreTools.Helper.Dats
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="softlist">True if SL XML names should be kept, false otherwise (default)</param> /// <param name="descAsName">True if SL XML names should be kept, false otherwise (default)</param>
private void ParseGenericXML( private void ParseGenericXML(
// Standard Dat parsing // Standard Dat parsing
string filename, string filename,
@@ -880,7 +890,7 @@ namespace SabreTools.Helper.Dats
Logger logger, Logger logger,
bool keep, bool keep,
bool clean, bool clean,
bool softlist) bool descAsName)
{ {
// Prepare all internal variables // Prepare all internal variables
XmlReader subreader, headreader, flagreader; XmlReader subreader, headreader, flagreader;
@@ -1514,16 +1524,8 @@ namespace SabreTools.Helper.Dats
case "description": case "description":
machine.Description = subreader.ReadElementContentAsString(); machine.Description = subreader.ReadElementContentAsString();
/*
// If we want to have the description as the name, do so // If we want to have the description as the name, do so
if (decAsName) if (descAsName)
{
machine.Name = machine.Description.Replace('/', '_').Replace("\"", "''");
}
*/
// If we have a softlist and we don't want preserve the name
if (!softlist && temptype == "software")
{ {
machine.Name = machine.Description.Replace('/', '_').Replace("\"", "''"); machine.Name = machine.Description.Replace('/', '_').Replace("\"", "''");
} }
@@ -2269,6 +2271,7 @@ namespace SabreTools.Helper.Dats
/// <param name="root">String representing root directory to compare against for length calculation</param> /// <param name="root">String representing root directory to compare against for length calculation</param>
/// <param name="logger">Logger object for console and/or file output</param> /// <param name="logger">Logger object for console and/or file output</param>
/// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
/// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
private void ParseRC( private void ParseRC(
// Standard Dat parsing // Standard Dat parsing
string filename, string filename,
@@ -2285,7 +2288,8 @@ namespace SabreTools.Helper.Dats
// Miscellaneous // Miscellaneous
Logger logger, Logger logger,
bool clean) bool clean,
bool descAsName)
{ {
// Open a file reader // Open a file reader
Encoding enc = Style.GetEncoding(filename); Encoding enc = Style.GetEncoding(filename);
@@ -2415,7 +2419,7 @@ namespace SabreTools.Helper.Dats
Machine = new Machine Machine = new Machine
{ {
Name = rominfo[3], Name = (descAsName ? rominfo[4] : rominfo[3]),
Description = rominfo[4], Description = rominfo[4],
CloneOf = rominfo[1], CloneOf = rominfo[1],
RomOf = rominfo[8], RomOf = rominfo[8],

View File

@@ -158,6 +158,10 @@ Options:
-ns, --noSHA1 Don't include SHA1 in output -ns, --noSHA1 Don't include SHA1 in output
This allows the user to skip calculating the SHA-1 for each of the files which will This allows the user to skip calculating the SHA-1 for each of the files which will
speed up the creation of the DAT. speed up the creation of the DAT.
-ns256, --noSHA256 Don't include SHA256 in output
This allows the user to skip calculating the SHA-256 for each of the files which will
speed up the creation of the DAT.
-b, --bare Don't include date in file name -b, --bare Don't include date in file name
Normally, the DAT will be created with the date in the file name. This flag removes Normally, the DAT will be created with the date in the file name. This flag removes
@@ -206,8 +210,11 @@ Options:
-osfv, --output-sfv Output in SFV format -osfv, --output-sfv Output in SFV format
Add outputting the created DAT to SFV format Add outputting the created DAT to SFV format
-osha1, -output-sha1 Output in SHA-1 format -osha1, --output-sha1 Output in SHA-1 format
Add outputting the created DAT to SHA1 format Add outputting the created DAT to SHA1 format
-osha256, --output-sha256 Output in SHA-256 format
Add outputting the created DAT to SHA256 format
-osl, --output-sl Output in Software List format -osl, --output-sl Output in Software List format
Add outputting the created DAT to Software List XML format Add outputting the created DAT to Software List XML format
@@ -698,6 +705,7 @@ Options:
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1
- %sha256% - Replaced with the SHA-256
- %size% - Replaced with the size - %size% - Replaced with the size
-q, --quotes Put double-quotes around each item -q, --quotes Put double-quotes around each item
@@ -729,6 +737,7 @@ Options:
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1
- %sha256% - Replaced with the SHA-256
- %size% - Replaced with the size - %size% - Replaced with the size
-q, --quotes Put double-quotes around each item -q, --quotes Put double-quotes around each item
@@ -768,11 +777,17 @@ Options:
-gp, --game-prefix Add game name as a prefix -gp, --game-prefix Add game name as a prefix
This allows for the name of the game to be used as a prefix to each file This allows for the name of the game to be used as a prefix to each file
-osha1, -output-sha1 Output in SHA-1 format -osha1, --output-sha1 Output in SHA-1 format
Add outputting the created DAT to SHA1 format Add outputting the created DAT to SHA1 format
-gp, --game-prefix Add game name as a prefix -gp, --game-prefix Add game name as a prefix
This allows for the name of the game to be used as a prefix to each file This allows for the name of the game to be used as a prefix to each file
-osha256, --output-sha256 Output in SHA-256 format
Add outputting the created DAT to SHA256 format
-gp, --game-prefix Add game name as a prefix
This allows for the name of the game to be used as a prefix to each file
-osl, --output-sl Output in Software List format -osl, --output-sl Output in Software List format
Add outputting the created DAT to Software List XML format Add outputting the created DAT to Software List XML format
@@ -792,6 +807,7 @@ Options:
- %crc% - Replaced with the CRC - %crc% - Replaced with the CRC
- %md5% - Replaced with the MD5 - %md5% - Replaced with the MD5
- %sha1% - Replaced with the SHA-1 - %sha1% - Replaced with the SHA-1
- %sha256% - Replaced with the SHA-256
- %size% - Replaced with the size - %size% - Replaced with the size
-q, --quotes Put double-quotes around each item -q, --quotes Put double-quotes around each item
@@ -862,11 +878,12 @@ Options:
Game names will be santitized to remove what the original WoD standards Game names will be santitized to remove what the original WoD standards
deemed as unneeded information, such as parenthized or bracketed strings deemed as unneeded information, such as parenthized or bracketed strings
-sl, --softlist Use Software List name instead of description -dan, --desc-name Use Software List name instead of description
By default, software list DATs are treated as "incorrect", using the game By default, all DATs are converted exactly as they are input. Enabling this flag
descriptions as the name instead, since they tend to be more descriptive. allows for the machine names in the DAT to be replaced by the machine description
Enabling this flag allows for the original name to be preserved and keeping instead. In most cases, this will result in no change in the output DAT, but a
the description as just a description. notable example would be a software list DAT where the machine names are
generally DOS-friendly while the description is more complete.
-dm, --dat-merged Create merged sets in the output DAT -dm, --dat-merged Create merged sets in the output DAT
Preprocess the DAT to have parent sets contain all items from the children based Preprocess the DAT to have parent sets contain all items from the children based
@@ -955,6 +972,8 @@ Options:
-nmd5=, --not-md5= Exclude by MD5 hash -nmd5=, --not-md5= Exclude by MD5 hash
-sha1=, --sha1= Filter by SHA-1 hash -sha1=, --sha1= Filter by SHA-1 hash
-nsha1=, --not-sha1= Exclude by SHA-1 hash -nsha1=, --not-sha1= Exclude by SHA-1 hash
-sha256=, --sha256= Filter by SHA-256 hash
-nsha256=, --not-sha256 Exclude by SHA-256 hash
For each of the flags above, the user can specify either an exact match or can use For each of the flags above, the user can specify either an exact match or can use
full C#-style regex for pattern matching. Multiples of each of the above inputs are full C#-style regex for pattern matching. Multiples of each of the above inputs are
allowed. allowed.

View File

@@ -966,9 +966,9 @@ namespace SabreTools
"Clean game names according to WoD standards", "Clean game names according to WoD standards",
FeatureType.Flag, FeatureType.Flag,
null)); null));
update.AddFeature("softlist", new Feature( update.AddFeature("desc-name", new Feature(
new List<string>() { "-sl", "--softlist" }, new List<string>() { "-dan", "--desc-name" },
"Use Software List name instead of description", "Use description instead of machine name",
FeatureType.Flag, FeatureType.Flag,
null)); null));
update.AddFeature("dat-merged", new Feature( update.AddFeature("dat-merged", new Feature(

View File

@@ -175,7 +175,7 @@ namespace SabreTools
if (File.Exists(input)) if (File.Exists(input))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(input), 0, 0, _logger);
datFile.SplitByExt(outDir, Path.GetDirectoryName(input), exta, extb, _logger); datFile.SplitByExt(outDir, Path.GetDirectoryName(input), exta, extb, _logger);
} }
else if (Directory.Exists(input)) else if (Directory.Exists(input))
@@ -183,7 +183,7 @@ namespace SabreTools
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(file), 0, 0, _logger);
datFile.SplitByExt(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), exta, extb, _logger); datFile.SplitByExt(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), exta, extb, _logger);
} }
} }
@@ -210,7 +210,7 @@ namespace SabreTools
if (File.Exists(input)) if (File.Exists(input))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(input), 0, 0, _logger);
datFile.SplitByHash(outDir, Path.GetDirectoryName(input), _logger); datFile.SplitByHash(outDir, Path.GetDirectoryName(input), _logger);
} }
else if (Directory.Exists(input)) else if (Directory.Exists(input))
@@ -218,7 +218,7 @@ namespace SabreTools
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(file), 0, 0, _logger);
datFile.SplitByHash(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), _logger); datFile.SplitByHash(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), _logger);
} }
} }
@@ -270,7 +270,7 @@ namespace SabreTools
if (File.Exists(input)) if (File.Exists(input))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, softlist: true, keep: true); datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, keep: true);
datFile.SplitByLevel(outDir, Path.GetDirectoryName(input), shortname, basedat, _logger); datFile.SplitByLevel(outDir, Path.GetDirectoryName(input), shortname, basedat, _logger);
} }
else if (Directory.Exists(input)) else if (Directory.Exists(input))
@@ -278,7 +278,7 @@ namespace SabreTools
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, softlist: true, keep: true); datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, keep: true);
datFile.SplitByLevel(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), shortname, basedat, _logger); datFile.SplitByLevel(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), shortname, basedat, _logger);
} }
} }
@@ -328,7 +328,7 @@ namespace SabreTools
foreach (string datfile in datfiles) foreach (string datfile in datfiles)
{ {
datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger, datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger,
keep: true, softlist: true, useTags: true); keep: true, useTags: true);
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -363,7 +363,7 @@ namespace SabreTools
foreach (string datfile in datfiles) foreach (string datfile in datfiles)
{ {
datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger, datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger,
keep: true, softlist: true, useTags: true); keep: true, useTags: true);
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -399,7 +399,7 @@ namespace SabreTools
if (File.Exists(input)) if (File.Exists(input))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(input), 0, 0, _logger;
datFile.SplitByType(outDir, Path.GetFullPath(Path.GetDirectoryName(input)), _logger); datFile.SplitByType(outDir, Path.GetFullPath(Path.GetDirectoryName(input)), _logger);
} }
else if (Directory.Exists(input)) else if (Directory.Exists(input))
@@ -407,7 +407,7 @@ namespace SabreTools
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{ {
DatFile datFile = new DatFile(); DatFile datFile = new DatFile();
datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, softlist: true); datFile.Parse(Path.GetFullPath(file), 0, 0, _logger);
datFile.SplitByType(outDir, Path.GetFullPath((input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar)), _logger); datFile.SplitByType(outDir, Path.GetFullPath((input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar)), _logger);
} }
} }
@@ -471,7 +471,7 @@ namespace SabreTools
/// /* Output DAT info */ /// /* Output DAT info */
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param> /// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
/// <param name="softlist">True to allow SL DATs to have game names used instead of descriptions, false otherwise (default)</param> /// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
/// <param name="dedup">True to dedupe the roms in the DAT, false otherwise (default)</param> /// <param name="dedup">True to dedupe the roms in the DAT, false otherwise (default)</param>
/// /* Multithreading info */ /// /* Multithreading info */
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param> /// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
@@ -527,7 +527,7 @@ namespace SabreTools
/* Output DAT info */ /* Output DAT info */
string outDir, string outDir,
bool clean, bool clean,
bool softlist, bool descAsName,
bool dedup, bool dedup,
/* Multithreading info */ /* Multithreading info */
@@ -666,7 +666,7 @@ namespace SabreTools
Romba = romba, Romba = romba,
}; };
userInputDat.DetermineUpdateType(inputs, outDir, merge, diffMode, inplace, skip, bare, clean, softlist, userInputDat.DetermineUpdateType(inputs, outDir, merge, diffMode, inplace, skip, bare, clean, descAsName,
filter, splitType, trim, single, root, maxDegreeOfParallelism, _logger); filter, splitType, trim, single, root, maxDegreeOfParallelism, _logger);
} }
@@ -694,7 +694,7 @@ namespace SabreTools
foreach (string datfile in datfiles) foreach (string datfile in datfiles)
{ {
datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger, datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger,
keep: true, softlist: true, useTags: true); keep: true, useTags: true);
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
@@ -720,7 +720,7 @@ namespace SabreTools
foreach (string datfile in datfiles) foreach (string datfile in datfiles)
{ {
datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger, datdata.Parse(datfile, 99, 99, new Filter(), splitType, false /* trim */, false /* single */, null /* root */, _logger,
keep: true, softlist: true, useTags: true); keep: true, useTags: true);
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));

View File

@@ -95,6 +95,7 @@ namespace SabreTools
datPrefix = false, datPrefix = false,
dedup = false, dedup = false,
delete = false, delete = false,
descAsName = false,
enableGzip = false, enableGzip = false,
excludeOf = false, excludeOf = false,
hashOnly = false, hashOnly = false,
@@ -114,7 +115,6 @@ namespace SabreTools
showNodumpColumn = false, showNodumpColumn = false,
shortname = false, shortname = false,
single = false, single = false,
softlist = false,
superdat = false, superdat = false,
trim = false, trim = false,
skip = false, skip = false,
@@ -307,6 +307,10 @@ namespace SabreTools
case "--csv": case "--csv":
statDatFormat |= StatDatFormat.CSV; statDatFormat |= StatDatFormat.CSV;
break; break;
case "-dan":
case "--desc-name":
descAsName = true;
break;
case "-dd": case "-dd":
case "--dedup": case "--dedup":
dedup = true; dedup = true;
@@ -511,10 +515,6 @@ namespace SabreTools
case "--single": case "--single":
single = true; single = true;
break; break;
case "-sl":
case "--softlist":
softlist = true;
break;
case "-t7z": case "-t7z":
case "--t7z": case "--t7z":
outputFormat = OutputFormat.Torrent7Zip; outputFormat = OutputFormat.Torrent7Zip;
@@ -1187,7 +1187,7 @@ namespace SabreTools
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header, InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix, superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix,
postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName,
filter, splitType, trim, single, root, outDir, cleanGameNames, softlist, dedup, maxParallelism); filter, splitType, trim, single, root, outDir, cleanGameNames, descAsName, dedup, maxParallelism);
} }
// If we're using the verifier // If we're using the verifier