mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
RV is not old-style CMP is
This commit is contained in:
@@ -52,7 +52,7 @@ namespace SabreTools
|
|||||||
bool help = false,
|
bool help = false,
|
||||||
add = false,
|
add = false,
|
||||||
convertMiss = false,
|
convertMiss = false,
|
||||||
convertRV = false,
|
convertCMP = false,
|
||||||
convertXml = false,
|
convertXml = false,
|
||||||
gamename = false,
|
gamename = false,
|
||||||
disableForce = false,
|
disableForce = false,
|
||||||
@@ -98,14 +98,14 @@ namespace SabreTools
|
|||||||
case "--add":
|
case "--add":
|
||||||
add = true;
|
add = true;
|
||||||
break;
|
break;
|
||||||
|
case "-cc":
|
||||||
|
case "--convert-cmp":
|
||||||
|
convertCMP = true;
|
||||||
|
break;
|
||||||
case "-cm":
|
case "-cm":
|
||||||
case "--convert-miss":
|
case "--convert-miss":
|
||||||
convertMiss = true;
|
convertMiss = true;
|
||||||
break;
|
break;
|
||||||
case "-cr":
|
|
||||||
case "--convert-rv":
|
|
||||||
convertRV = true;
|
|
||||||
break;
|
|
||||||
case "-cx":
|
case "-cx":
|
||||||
case "--convert-xml":
|
case "--convert-xml":
|
||||||
convertXml = true;
|
convertXml = true;
|
||||||
@@ -150,8 +150,8 @@ namespace SabreTools
|
|||||||
case "--no-rename":
|
case "--no-rename":
|
||||||
norename = true;
|
norename = true;
|
||||||
break;
|
break;
|
||||||
case "-old":
|
case "-o":
|
||||||
case "--romvault":
|
case "--old":
|
||||||
old = true;
|
old = true;
|
||||||
break;
|
break;
|
||||||
case "-q":
|
case "-q":
|
||||||
@@ -249,7 +249,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If more than one switch is enabled or help is set, show the help screen
|
// 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();
|
Build.Help();
|
||||||
logger.Close();
|
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 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();
|
Build.Help();
|
||||||
logger.Close();
|
logger.Close();
|
||||||
@@ -311,16 +311,16 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert XML DAT to RV DAT
|
// Convert XML DAT to CMP DAT
|
||||||
else if (convertRV)
|
else if (convertCMP)
|
||||||
{
|
{
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
{
|
{
|
||||||
InitConvertRV(input);
|
InitConvertCMP(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert RV DAT to XML DAT
|
// Convert CMP DAT to XML DAT
|
||||||
else if (convertXml)
|
else if (convertXml)
|
||||||
{
|
{
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
@@ -542,7 +542,7 @@ or 'b' to go back to the previous menu:");
|
|||||||
Make a selection:
|
Make a selection:
|
||||||
|
|
||||||
1) " + (norename ? "Enable game renaming" : "Disable game renaming") + @"
|
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 : "") + @"
|
3) List of systems to generate from" + (systems != "" ? ": " + systems : "") + @"
|
||||||
4) List of sources to generate from" + (sources != "" ? ": " + sources : "") + @"
|
4) List of sources to generate from" + (sources != "" ? ": " + sources : "") + @"
|
||||||
5) Enter an output folder" + (outdir != "" ? ":\n\t" + outdir : "") + @"
|
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="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="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="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)
|
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);
|
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
|
/// Wrap generating all standard DATs from the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</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 InitGenerateAll(string outdir, bool norename, bool old)
|
private static void InitGenerateAll(string outdir, bool norename, bool old)
|
||||||
{
|
{
|
||||||
string actualdir = (outdir == "" ? Environment.CurrentDirectory + "/" : outdir + "/");
|
string actualdir = (outdir == "" ? Environment.CurrentDirectory + "/" : outdir + "/");
|
||||||
@@ -744,8 +744,8 @@ Make a selection:
|
|||||||
===========================
|
===========================
|
||||||
Make a selection:
|
Make a selection:
|
||||||
|
|
||||||
1) Convert XML DAT to RV
|
1) Convert XML DAT to CMP
|
||||||
2) Convert RV DAT to XML
|
2) Convert CMP DAT to XML
|
||||||
3) Convert DAT to missfile
|
3) Convert DAT to missfile
|
||||||
4) Trim all entries in DAT and merge into a single game
|
4) Trim all entries in DAT and merge into a single game
|
||||||
5) Split DAT using 2 extensions
|
5) Split DAT using 2 extensions
|
||||||
@@ -756,7 +756,7 @@ Make a selection:
|
|||||||
switch (selection)
|
switch (selection)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
ConvertRVMenu();
|
ConvertCMPMenu();
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
ConvertXMLMenu();
|
ConvertXMLMenu();
|
||||||
@@ -775,25 +775,25 @@ Make a selection:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show the text-based XML to RV conversion menu
|
/// Show the text-based XML to CMP conversion menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void ConvertRVMenu()
|
private static void ConvertCMPMenu()
|
||||||
{
|
{
|
||||||
string selection = "";
|
string selection = "";
|
||||||
while (selection.ToLowerInvariant() != "b")
|
while (selection.ToLowerInvariant() != "b")
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
Build.Start("DATabase");
|
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:
|
or 'b' to go back to the previous menu:
|
||||||
");
|
");
|
||||||
selection = Console.ReadLine();
|
selection = Console.ReadLine();
|
||||||
if (selection.ToLowerInvariant() != "b")
|
if (selection.ToLowerInvariant() != "b")
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
InitConvertRV(selection);
|
InitConvertCMP(selection);
|
||||||
Console.Write("\nPress any key to continue...");
|
Console.Write("\nPress any key to continue...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
@@ -802,10 +802,10 @@ or 'b' to go back to the previous menu:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrap converting DAT file from XML to RomVault
|
/// Wrap converting DAT file from XML to ClrMamePro
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
private static void InitConvertRV(string filename)
|
private static void InitConvertCMP(string filename)
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
@@ -814,7 +814,7 @@ or 'b' to go back to the previous menu:
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc.LoadXml(File.ReadAllText(filename));
|
doc.LoadXml(File.ReadAllText(filename));
|
||||||
string conv = Converters.XMLToRomVault(doc);
|
string conv = Converters.XMLToClrMamePro(doc);
|
||||||
FileStream fs = File.OpenWrite(Path.GetFileNameWithoutExtension(filename) + ".new.dat");
|
FileStream fs = File.OpenWrite(Path.GetFileNameWithoutExtension(filename) + ".new.dat");
|
||||||
StreamWriter sw = new StreamWriter(fs);
|
StreamWriter sw = new StreamWriter(fs);
|
||||||
sw.Write(conv);
|
sw.Write(conv);
|
||||||
@@ -835,7 +835,7 @@ or 'b' to go back to the previous menu:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show the text-based RV to XML conversion menu
|
/// Show the text-based CMP to XML conversion menu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void ConvertXMLMenu()
|
private static void ConvertXMLMenu()
|
||||||
{
|
{
|
||||||
@@ -844,9 +844,9 @@ or 'b' to go back to the previous menu:
|
|||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
Build.Start("DATabase");
|
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:
|
or 'b' to go back to the previous menu:
|
||||||
");
|
");
|
||||||
selection = Console.ReadLine();
|
selection = Console.ReadLine();
|
||||||
@@ -862,7 +862,7 @@ or 'b' to go back to the previous menu:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrap converting DAT file from RomVault to XML
|
/// Wrap converting DAT file from ClrMamePro to XML
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
private static void InitConvertXML(string filename)
|
private static void InitConvertXML(string filename)
|
||||||
@@ -870,7 +870,7 @@ or 'b' to go back to the previous menu:
|
|||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
logger.Log("Converting " + 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");
|
FileStream fs = File.OpenWrite(Path.GetFileNameWithoutExtension(filename) + ".new.xml");
|
||||||
StreamWriter sw = new StreamWriter(fs);
|
StreamWriter sw = new StreamWriter(fs);
|
||||||
sw.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
sw.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace SabreTools
|
|||||||
/// <param name="connectionString">Connection string for SQLite</param>
|
/// <param name="connectionString">Connection string for SQLite</param>
|
||||||
/// <param name="logger">Logger object for file or console output</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="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)
|
public Generate(string systems, string sources, string outdir, string connectionString, Logger logger, bool norename = false, bool old = false)
|
||||||
{
|
{
|
||||||
_systems = systems;
|
_systems = systems;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ namespace SabreTools
|
|||||||
public class MergeDAT
|
public class MergeDAT
|
||||||
{
|
{
|
||||||
// Listing related variables
|
// Listing related variables
|
||||||
private List<RomData> _roms;
|
|
||||||
private List<String> _inputs;
|
private List<String> _inputs;
|
||||||
|
|
||||||
// User specified flags
|
// User specified flags
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ Options:
|
|||||||
system= System name (system only)
|
system= System name (system only)
|
||||||
source= Source name (source only)
|
source= Source name (source only)
|
||||||
url= URL (source only)
|
url= URL (source only)
|
||||||
|
-cc, --convert-cmp Convert an XML DAT to CMP
|
||||||
|
out= Output directory
|
||||||
-cm, --convert-miss
|
-cm, --convert-miss
|
||||||
-r, --roms Output roms to miss instead of sets
|
-r, --roms Output roms to miss instead of sets
|
||||||
-gp, --game-prefix Add game name as a prefix to each item
|
-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
|
-q, --quotes Put double-quotes around each item
|
||||||
-ae=, --add-ext= Add an extension to each item
|
-ae=, --add-ext= Add an extension to each item
|
||||||
-re=, --rep-ext= Replace all extensions with specified
|
-re=, --rep-ext= Replace all extensions with specified
|
||||||
-cr, --convert-rv Convert an XML DAT to RV
|
-cx, --convert-xml Convert a CMP DAT to XML
|
||||||
out= Output directory
|
|
||||||
-cx, --convert-xml Convert a RV DAT to XML
|
|
||||||
out= Output directory
|
out= Output directory
|
||||||
-es, --ext-split Split a DAT by two file extensions
|
-es, --ext-split Split a DAT by two file extensions
|
||||||
exta= First extension to split by
|
exta= First extension to split by
|
||||||
extb= Second extension to split by
|
extb= Second extension to split by
|
||||||
out= Output directory
|
out= Output directory
|
||||||
-g, --generate Start tool in generate mode
|
-g, --generate Start tool in generate mode
|
||||||
-ga, --generate-all Start tool in generate all mode
|
|
||||||
system= Comma-separated list of system IDs
|
system= Comma-separated list of system IDs
|
||||||
source= Comma-separated list of source IDs
|
source= Comma-separated list of source IDs
|
||||||
out= Output directory
|
out= Output directory
|
||||||
-nr, --no-rename Don't auto-rename games
|
-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
|
-i, --import Start tool in import mode
|
||||||
-l, --log Enable logging of program output
|
-l, --log Enable logging of program output
|
||||||
-lso, --list-sources List all sources (id <= name)
|
-lso, --list-sources List all sources (id <= name)
|
||||||
@@ -147,7 +150,7 @@ Options:
|
|||||||
-b, --bare Don't include date in file name
|
-b, --bare Don't include date in file name
|
||||||
-u, --unzip Force unzipping in created DAT
|
-u, --unzip Force unzipping in created DAT
|
||||||
-f, --files Treat archives as files
|
-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
|
-n=, --name= Set the name of the DAT
|
||||||
-d=, --desc= Set the description of the DAT
|
-d=, --desc= Set the description of the DAT
|
||||||
-c=, --cat= Set the category of the DAT
|
-c=, --cat= Set the category of the DAT
|
||||||
@@ -168,7 +171,7 @@ Options:
|
|||||||
-dd, --dedup Enable deduping in the created DAT
|
-dd, --dedup Enable deduping in the created DAT
|
||||||
-b, --bare Don't include date in file name
|
-b, --bare Don't include date in file name
|
||||||
-u, --unzip Force unzipping in created DAT
|
-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
|
-n=, --name= Set the name of the DAT
|
||||||
-d=, --desc= Set the description of the DAT
|
-d=, --desc= Set the description of the DAT
|
||||||
-c=, --cat= Set the category of the DAT
|
-c=, --cat= Set the category of the DAT
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ namespace SabreTools.Helper
|
|||||||
private static string _endPattern = @"^\s*\)\s*$";
|
private static string _endPattern = @"^\s*\)\s*$";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a RomVault style DAT to an XML derived DAT
|
/// Convert a ClrMamePro style DAT to an XML derived DAT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filecontents">Array of strings representing the input file</param>
|
/// <param name="filecontents">Array of strings representing the input file</param>
|
||||||
/// <returns>XElement representing the output XML DAT file</returns>
|
/// <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");
|
XElement elem = new XElement("datafile");
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
string line = filecontents[k];
|
string line = filecontents[k];
|
||||||
|
|
||||||
// Comments in RV DATs start with a #
|
// Comments in CMP DATs start with a #
|
||||||
if (line.Trim().StartsWith("#"))
|
if (line.Trim().StartsWith("#"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -152,11 +152,11 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert an XML derived DAT to a RomVault style DAT
|
/// Convert an XML derived DAT to a ClrMamePro style DAT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="root">XElement representing the file</param>
|
/// <param name="root">XElement representing the file</param>
|
||||||
/// <returns>String representing the output RomVault DAT file</returns>
|
/// <returns>String representing the output ClrMamePro DAT file</returns>
|
||||||
public static String XMLToRomVault(XmlDocument root)
|
public static String XMLToClrMamePro(XmlDocument root)
|
||||||
{
|
{
|
||||||
string output = "";
|
string output = "";
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc.LoadXml(Converters.RomVaultToXML(File.ReadAllLines(filename)).ToString());
|
doc.LoadXml(Converters.ClrMameProToXML(File.ReadAllLines(filename)).ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
2
SabreToolsUI/SabreToolsUI.Designer.cs
generated
2
SabreToolsUI/SabreToolsUI.Designer.cs
generated
@@ -175,7 +175,7 @@
|
|||||||
this.oldCheckBox.Name = "oldCheckBox";
|
this.oldCheckBox.Name = "oldCheckBox";
|
||||||
this.oldCheckBox.Size = new System.Drawing.Size(129, 17);
|
this.oldCheckBox.Size = new System.Drawing.Size(129, 17);
|
||||||
this.oldCheckBox.TabIndex = 10;
|
this.oldCheckBox.TabIndex = 10;
|
||||||
this.oldCheckBox.Text = "Use RomVault Format";
|
this.oldCheckBox.Text = "Use ClrMamePro Format";
|
||||||
this.oldCheckBox.UseVisualStyleBackColor = true;
|
this.oldCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// renameCheckBox
|
// renameCheckBox
|
||||||
|
|||||||
Reference in New Issue
Block a user