RV is not old-style CMP is

This commit is contained in:
Matt Nadareski
2016-04-20 21:55:28 -07:00
parent 7e818df8a8
commit 1c4d7dab2c
7 changed files with 51 additions and 49 deletions

View File

@@ -52,7 +52,7 @@ namespace SabreTools
bool help = false,
add = false,
convertMiss = false,
convertRV = false,
convertCMP = false,
convertXml = false,
gamename = false,
disableForce = false,
@@ -98,14 +98,14 @@ namespace SabreTools
case "--add":
add = true;
break;
case "-cc":
case "--convert-cmp":
convertCMP = true;
break;
case "-cm":
case "--convert-miss":
convertMiss = true;
break;
case "-cr":
case "--convert-rv":
convertRV = true;
break;
case "-cx":
case "--convert-xml":
convertXml = true;
@@ -150,8 +150,8 @@ namespace SabreTools
case "--no-rename":
norename = true;
break;
case "-old":
case "--romvault":
case "-o":
case "--old":
old = true;
break;
case "-q":
@@ -249,7 +249,7 @@ namespace SabreTools
}
// If more than one switch is enabled or help is set, show the help screen
if (help || !(add ^ convertMiss ^ convertRV ^ convertXml ^ extsplit ^ generate ^ genall ^ import ^ listsrc ^ listsys ^ rem ^ trim))
if (help || !(add ^ convertMiss ^ convertCMP ^ convertXml ^ extsplit ^ generate ^ genall ^ import ^ listsrc ^ listsys ^ rem ^ trim))
{
Build.Help();
logger.Close();
@@ -257,7 +257,7 @@ namespace SabreTools
}
// If a switch that requires a filename is set and no file is, show the help screen
if (inputs.Count == 0 && (convertMiss || convertRV || convertXml || extsplit || import || trim))
if (inputs.Count == 0 && (convertMiss || convertCMP || convertXml || extsplit || import || trim))
{
Build.Help();
logger.Close();
@@ -311,16 +311,16 @@ namespace SabreTools
}
}
// Convert XML DAT to RV DAT
else if (convertRV)
// Convert XML DAT to CMP DAT
else if (convertCMP)
{
foreach (string input in inputs)
{
InitConvertRV(input);
InitConvertCMP(input);
}
}
// Convert RV DAT to XML DAT
// Convert CMP DAT to XML DAT
else if (convertXml)
{
foreach (string input in inputs)
@@ -542,7 +542,7 @@ or 'b' to go back to the previous menu:");
Make a selection:
1) " + (norename ? "Enable game renaming" : "Disable game renaming") + @"
2) " + (old ? "Enable XML output" : "Enable RomVault output") + @"
2) " + (old ? "Enable XML output" : "Enable ClrMamePro output") + @"
3) List of systems to generate from" + (systems != "" ? ": " + systems : "") + @"
4) List of sources to generate from" + (sources != "" ? ": " + sources : "") + @"
5) Enter an output folder" + (outdir != "" ? ":\n\t" + outdir : "") + @"
@@ -600,7 +600,7 @@ Make a selection:
/// <param name="systems">Comma-separated list of systems to be included in the DAT (blank means all)</param>
/// <param name="sources">Comma-separated list of sources to be included in the DAT (blank means all)</param>
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</param>
/// <param name="old">True if the output file should be in RomVault format (default false)</param>
/// <param name="old">True if the output file should be in ClrMamePro format (default false)</param>
private static void InitGenerate(string systems, string sources, string outdir, bool norename, bool old)
{
Generate gen = new Generate(systems, sources, outdir, _connectionString, logger, norename, old);
@@ -612,7 +612,7 @@ Make a selection:
/// Wrap generating all standard DATs from the database
/// </summary>
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</param>
/// <param name="old">True if the output file should be in RomVault format (default false)</param>
/// <param name="old">True if the output file should be in ClrMamePro format (default false)</param>
private static void InitGenerateAll(string outdir, bool norename, bool old)
{
string actualdir = (outdir == "" ? Environment.CurrentDirectory + "/" : outdir + "/");
@@ -744,8 +744,8 @@ Make a selection:
===========================
Make a selection:
1) Convert XML DAT to RV
2) Convert RV DAT to XML
1) Convert XML DAT to CMP
2) Convert CMP DAT to XML
3) Convert DAT to missfile
4) Trim all entries in DAT and merge into a single game
5) Split DAT using 2 extensions
@@ -756,7 +756,7 @@ Make a selection:
switch (selection)
{
case "1":
ConvertRVMenu();
ConvertCMPMenu();
break;
case "2":
ConvertXMLMenu();
@@ -775,25 +775,25 @@ Make a selection:
}
/// <summary>
/// Show the text-based XML to RV conversion menu
/// Show the text-based XML to CMP conversion menu
/// </summary>
private static void ConvertRVMenu()
private static void ConvertCMPMenu()
{
string selection = "";
while (selection.ToLowerInvariant() != "b")
{
Console.Clear();
Build.Start("DATabase");
Console.WriteLine(@"XML -> RV CONVERT MENU
Console.WriteLine(@"XML -> CMP CONVERT MENU
===========================
Enter the name of a DAT file to convert from XML to RV
Enter the name of a DAT file to convert from XML to CMP
or 'b' to go back to the previous menu:
");
selection = Console.ReadLine();
if (selection.ToLowerInvariant() != "b")
{
Console.Clear();
InitConvertRV(selection);
InitConvertCMP(selection);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
}
@@ -802,10 +802,10 @@ or 'b' to go back to the previous menu:
}
/// <summary>
/// Wrap converting DAT file from XML to RomVault
/// Wrap converting DAT file from XML to ClrMamePro
/// </summary>
/// <param name="filename"></param>
private static void InitConvertRV(string filename)
private static void InitConvertCMP(string filename)
{
if (File.Exists(filename))
{
@@ -814,7 +814,7 @@ or 'b' to go back to the previous menu:
try
{
doc.LoadXml(File.ReadAllText(filename));
string conv = Converters.XMLToRomVault(doc);
string conv = Converters.XMLToClrMamePro(doc);
FileStream fs = File.OpenWrite(Path.GetFileNameWithoutExtension(filename) + ".new.dat");
StreamWriter sw = new StreamWriter(fs);
sw.Write(conv);
@@ -835,7 +835,7 @@ or 'b' to go back to the previous menu:
}
/// <summary>
/// Show the text-based RV to XML conversion menu
/// Show the text-based CMP to XML conversion menu
/// </summary>
private static void ConvertXMLMenu()
{
@@ -844,9 +844,9 @@ or 'b' to go back to the previous menu:
{
Console.Clear();
Build.Start("DATabase");
Console.WriteLine(@"RV -> XML CONVERT MENU
Console.WriteLine(@"CMP -> XML CONVERT MENU
===========================
Enter the name of a DAT file to convert from RV to XML
Enter the name of a DAT file to convert from CMP to XML
or 'b' to go back to the previous menu:
");
selection = Console.ReadLine();
@@ -862,7 +862,7 @@ or 'b' to go back to the previous menu:
}
/// <summary>
/// Wrap converting DAT file from RomVault to XML
/// Wrap converting DAT file from ClrMamePro to XML
/// </summary>
/// <param name="filename"></param>
private static void InitConvertXML(string filename)
@@ -870,7 +870,7 @@ or 'b' to go back to the previous menu:
if (File.Exists(filename))
{
logger.Log("Converting " + filename);
XElement conv = Converters.RomVaultToXML(File.ReadAllLines(filename));
XElement conv = Converters.ClrMameProToXML(File.ReadAllLines(filename));
FileStream fs = File.OpenWrite(Path.GetFileNameWithoutExtension(filename) + ".new.xml");
StreamWriter sw = new StreamWriter(fs);
sw.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +

View File

@@ -33,7 +33,7 @@ namespace SabreTools
/// <param name="connectionString">Connection string for SQLite</param>
/// <param name="logger">Logger object for file or console output</param>
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</param>
/// <param name="old">True if the output file should be in RomVault format (default false)</param>
/// <param name="old">True if the output file should be in ClrMamePro format (default false)</param>
public Generate(string systems, string sources, string outdir, string connectionString, Logger logger, bool norename = false, bool old = false)
{
_systems = systems;

View File

@@ -9,7 +9,6 @@ namespace SabreTools
public class MergeDAT
{
// Listing related variables
private List<RomData> _roms;
private List<String> _inputs;
// User specified flags

View File

@@ -87,6 +87,8 @@ Options:
system= System name (system only)
source= Source name (source only)
url= URL (source only)
-cc, --convert-cmp Convert an XML DAT to CMP
out= Output directory
-cm, --convert-miss
-r, --roms Output roms to miss instead of sets
-gp, --game-prefix Add game name as a prefix to each item
@@ -95,21 +97,22 @@ Options:
-q, --quotes Put double-quotes around each item
-ae=, --add-ext= Add an extension to each item
-re=, --rep-ext= Replace all extensions with specified
-cr, --convert-rv Convert an XML DAT to RV
out= Output directory
-cx, --convert-xml Convert a RV DAT to XML
-cx, --convert-xml Convert a CMP DAT to XML
out= Output directory
-es, --ext-split Split a DAT by two file extensions
exta= First extension to split by
extb= Second extension to split by
out= Output directory
-g, --generate Start tool in generate mode
-ga, --generate-all Start tool in generate all mode
system= Comma-separated list of system IDs
source= Comma-separated list of source IDs
out= Output directory
-nr, --no-rename Don't auto-rename games
-old, --romvault Produce a DAT in RV format
-o, --old Output DAT in CMP format instead of XML
-ga, --generate-all Start tool in generate all mode
out= Output directory
-nr, --no-rename Don't auto-rename games
-o, --old Output DAT in CMP format instead of XML
-i, --import Start tool in import mode
-l, --log Enable logging of program output
-lso, --list-sources List all sources (id <= name)
@@ -147,7 +150,7 @@ Options:
-b, --bare Don't include date in file name
-u, --unzip Force unzipping in created DAT
-f, --files Treat archives as files
-o, --old Output DAT in RV format instead of XML
-o, --old Output DAT in CMP format instead of XML
-n=, --name= Set the name of the DAT
-d=, --desc= Set the description of the DAT
-c=, --cat= Set the category of the DAT
@@ -168,7 +171,7 @@ Options:
-dd, --dedup Enable deduping in the created DAT
-b, --bare Don't include date in file name
-u, --unzip Force unzipping in created DAT
-o, --old Output DAT in RV format instead of XML
-o, --old Output DAT in CMP format instead of XML
-n=, --name= Set the name of the DAT
-d=, --desc= Set the description of the DAT
-c=, --cat= Set the category of the DAT

View File

@@ -17,11 +17,11 @@ namespace SabreTools.Helper
private static string _endPattern = @"^\s*\)\s*$";
/// <summary>
/// Convert a RomVault style DAT to an XML derived DAT
/// Convert a ClrMamePro style DAT to an XML derived DAT
/// </summary>
/// <param name="filecontents">Array of strings representing the input file</param>
/// <returns>XElement representing the output XML DAT file</returns>
public static XElement RomVaultToXML (string[] filecontents)
public static XElement ClrMameProToXML (string[] filecontents)
{
XElement elem = new XElement("datafile");
@@ -30,7 +30,7 @@ namespace SabreTools.Helper
{
string line = filecontents[k];
// Comments in RV DATs start with a #
// Comments in CMP DATs start with a #
if (line.Trim().StartsWith("#"))
{
continue;
@@ -152,11 +152,11 @@ namespace SabreTools.Helper
}
/// <summary>
/// Convert an XML derived DAT to a RomVault style DAT
/// Convert an XML derived DAT to a ClrMamePro style DAT
/// </summary>
/// <param name="root">XElement representing the file</param>
/// <returns>String representing the output RomVault DAT file</returns>
public static String XMLToRomVault(XmlDocument root)
/// <returns>String representing the output ClrMamePro DAT file</returns>
public static String XMLToClrMamePro(XmlDocument root)
{
string output = "";

View File

@@ -45,7 +45,7 @@ namespace SabreTools.Helper
{
try
{
doc.LoadXml(Converters.RomVaultToXML(File.ReadAllLines(filename)).ToString());
doc.LoadXml(Converters.ClrMameProToXML(File.ReadAllLines(filename)).ToString());
}
catch (Exception ex)
{

View File

@@ -175,7 +175,7 @@
this.oldCheckBox.Name = "oldCheckBox";
this.oldCheckBox.Size = new System.Drawing.Size(129, 17);
this.oldCheckBox.TabIndex = 10;
this.oldCheckBox.Text = "Use RomVault Format";
this.oldCheckBox.Text = "Use ClrMamePro Format";
this.oldCheckBox.UseVisualStyleBackColor = true;
//
// renameCheckBox