[DATabase] Add non-menu flag for clean in convert functions

This commit is contained in:
Matt Nadareski
2016-05-29 13:31:22 -07:00
parent 30e2d41827
commit afd26ba627
2 changed files with 15 additions and 6 deletions

View File

@@ -67,6 +67,7 @@ namespace SabreTools
add = false,
bare = false,
cascade = false,
clean = false,
convertMiss = false,
convertCMP = false,
convertRC = false,
@@ -144,6 +145,10 @@ namespace SabreTools
case "--convert-cmp":
convertCMP = true;
break;
case "-clean":
case "--clean":
clean = true;
break;
case "-cm":
case "--convert-miss":
convertMiss = true;
@@ -430,7 +435,7 @@ namespace SabreTools
{
foreach (string input in inputs)
{
InitConvert(input, OutputFormat.ClrMamePro, outdir);
InitConvert(input, OutputFormat.ClrMamePro, outdir, clean);
}
}
@@ -439,7 +444,7 @@ namespace SabreTools
{
foreach (string input in inputs)
{
InitConvert(input, OutputFormat.RomCenter, outdir);
InitConvert(input, OutputFormat.RomCenter, outdir, clean);
}
}
@@ -448,7 +453,7 @@ namespace SabreTools
{
foreach (string input in inputs)
{
InitConvert(input, OutputFormat.SabreDat, outdir);
InitConvert(input, OutputFormat.SabreDat, outdir, clean);
}
}
@@ -1375,7 +1380,7 @@ Make a selection:
/// </summary>
/// <param name="filename"></param>
/// <param name="outputFormat"></param>
private static void InitConvert(string filename, OutputFormat outputFormat, string outdir = "")
private static void InitConvert(string filename, OutputFormat outputFormat, string outdir = "", bool clean = false)
{
// Clean the input strings
outdir = outdir.Replace("\"", "");
@@ -1393,7 +1398,7 @@ Make a selection:
OutputFormat = outputFormat,
MergeRoms = false,
};
datdata = RomManipulation.Parse(filename, 0, 0, datdata, _logger, true);
datdata = RomManipulation.Parse(filename, 0, 0, datdata, _logger, true, clean);
// Sometimes the description doesn't match the filename, change this
if (datdata.Description != Path.GetFileNameWithoutExtension(filename))
@@ -1422,7 +1427,7 @@ Make a selection:
OutputFormat = outputFormat,
MergeRoms = false,
};
datdata = RomManipulation.Parse(file, 0, 0, datdata, _logger, true);
datdata = RomManipulation.Parse(file, 0, 0, datdata, _logger, true, clean);
// If the extension matches, append ".new" to the filename
string extension = (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");

View File

@@ -78,6 +78,7 @@ Options:
-source= Source name (source only)
-url= URL (source only)
-cc, --convert-cmp Convert any DAT to CMP
-clean Clean game names according to WoD standards
-out= Output directory
-cm, --convert-miss Convert from DAT to miss
-r, --roms Output roms to miss instead of sets
@@ -90,10 +91,13 @@ Options:
-ro, --romba Output roms in Romba format (requires SHA-1)
-tsv, --tsv Output roms in Tab-Separated Value format
-cs, --convert-sd Convert any DAT to SabreDAT
-clean Clean game names according to WoD standards
-out= Output directory
-cr, --convert-rc Convert any DAT to RomCenter
-clean Clean game names according to WoD standards
-out= Output directory
-cx, --convert-xml Convert any DAT to XML
-clean Clean game names according to WoD standards
-out= Output directory
-es, --ext-split Split a DAT by two file extensions
-exta= First extension to split by