[DATabase] Move DATabaseTwo functions to DATabase

This commit is contained in:
Matt Nadareski
2016-05-28 16:36:39 -07:00
parent 07db29cfbf
commit 1b4727c618
14 changed files with 838 additions and 1523 deletions

3
.gitignore vendored
View File

@@ -2,9 +2,6 @@
/DATabase/obj /DATabase/obj
/DATabase/obj/Debug /DATabase/obj/Debug
/DATabase/obj/Release /DATabase/obj/Release
/DATabaseTwo/obj
/DATabaseTwo/obj/Debug
/DATabaseTwo/obj/Release
/DATFromDir/obj /DATFromDir/obj
/DATFromDir/obj/Debug /DATFromDir/obj/Debug
/DATFromDir/obj/Release /DATFromDir/obj/Release

View File

@@ -11,13 +11,29 @@ namespace SabreTools
/// <summary> /// <summary>
/// Entry class for the DATabase application /// Entry class for the DATabase application
/// </summary> /// </summary>
/// <remarks>
/// The following features are missing from DATabaseTwo with respect to the original DATabase:
/// - Source merging
/// - Custom DATs based on a system and a source
/// - Multi-source and multi-system DATs
///
/// The following features need to (want to) be implemented in DATabaseTwo for further stability
/// - Import updating file locations and names when SHA-1 hashes are matched
/// - True duplicate DATs being removed from the import folder (SHA-1 matches)
/// - Generate All only generating DATs that have been recently updated
/// + This requires implementing a "last updated" data point for all DATs and tracking for "last generate" somewhere
/// - Impelement a ToSort folder for DATs that will place DATs in the correct subfolder on Import
/// </remarks>
public class DATabase public class DATabase
{ {
private static Logger logger; // Private required variables
private static string _dbName = "DATabase.sqlite"; private static string _datroot = "DATS";
//private static string _dbName = "SabreTools.sqlite"; private static string _outroot = "Output";
private static string _dbName = "dats.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;"; private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
private static Logger _logger;
/// <summary> /// <summary>
/// Start menu or use supplied parameters /// Start menu or use supplied parameters
/// </summary> /// </summary>
@@ -25,8 +41,8 @@ namespace SabreTools
public static void Main(string[] args) public static void Main(string[] args)
{ {
// Perform initial setup and verification // Perform initial setup and verification
logger = new Logger(true, "database.log"); _logger = new Logger(true, "database.log");
logger.Start(); _logger.Start();
DBTools.EnsureDatabase(_dbName, _connectionString); DBTools.EnsureDatabase(_dbName, _connectionString);
Remapping.CreateRemappings(); Remapping.CreateRemappings();
Console.Clear(); Console.Clear();
@@ -35,7 +51,7 @@ namespace SabreTools
if ((new List<string>(args)).Contains("--credits")) if ((new List<string>(args)).Contains("--credits"))
{ {
Build.Credits(); Build.Credits();
logger.Close(); _logger.Close();
return; return;
} }
@@ -43,7 +59,7 @@ namespace SabreTools
if (args.Length == 0) if (args.Length == 0)
{ {
ShowMainMenu(); ShowMainMenu();
logger.Close(); _logger.Close();
return; return;
} }
@@ -66,6 +82,7 @@ namespace SabreTools
generate = false, generate = false,
genall = false, genall = false,
hashsplit = false, hashsplit = false,
ignore = false,
import = false, import = false,
inplace = false, inplace = false,
listsrc = false, listsrc = false,
@@ -179,6 +196,10 @@ namespace SabreTools
case "--import": case "--import":
import = true; import = true;
break; break;
case "-ig":
case "--ignore":
ignore = true;
break;
case "-ip": case "-ip":
case "--inplace": case "--inplace":
inplace = true; inplace = true;
@@ -321,10 +342,10 @@ namespace SabreTools
} }
else else
{ {
logger.Error("Invalid input detected: " + arg); _logger.Error("Invalid input detected: " + arg);
Console.WriteLine(); Console.WriteLine();
Build.Help(); Build.Help();
logger.Close(); _logger.Close();
return; return;
} }
break; break;
@@ -341,9 +362,9 @@ namespace SabreTools
if (help || !(add ^ (convertMiss || romba) ^ convertCMP ^ convertRC ^ convertSD ^ convertXml ^ extsplit ^ generate ^ if (help || !(add ^ (convertMiss || romba) ^ convertCMP ^ convertRC ^ convertSD ^ convertXml ^ extsplit ^ generate ^
genall ^ hashsplit ^ import ^ listsrc ^ listsys ^ (merge || diff) ^ rem ^ stats ^ trim)) genall ^ hashsplit ^ import ^ listsrc ^ listsys ^ (merge || diff) ^ rem ^ stats ^ trim))
{ {
logger.Error("Only one feature switch is allowed at a time"); _logger.Error("Only one feature switch is allowed at a time");
Build.Help(); Build.Help();
logger.Close(); _logger.Close();
return; return;
} }
@@ -351,9 +372,9 @@ namespace SabreTools
if (inputs.Count == 0 && ((convertMiss || romba) || convertCMP || convertRC || convertSD if (inputs.Count == 0 && ((convertMiss || romba) || convertCMP || convertRC || convertSD
|| convertXml || extsplit || hashsplit || import || (merge || diff) || stats || trim)) || convertXml || extsplit || hashsplit || import || (merge || diff) || stats || trim))
{ {
logger.Error("This feature requires at least one input"); _logger.Error("This feature requires at least one input");
Build.Help(); Build.Help();
logger.Close(); _logger.Close();
return; return;
} }
@@ -362,22 +383,21 @@ namespace SabreTools
// Import a file or folder // Import a file or folder
if (import) if (import)
{ {
foreach (string input in inputs) InitImport(ignore);
{
InitImport(input);
}
} }
// Generate a DAT // Generate a DAT
else if (generate) else if (generate)
{ {
InitGenerate(systems, sources, outdir, norename, old); InitImport(ignore);
InitGenerate(systems, norename, old);
} }
// Generate all DATs // Generate all DATs
else if (genall) else if (genall)
{ {
InitGenerateAll(outdir, norename, old); InitImport(ignore);
InitGenerateAll(norename, old);
} }
// List all available sources // List all available sources
@@ -507,7 +527,7 @@ namespace SabreTools
InitStats(inputs, single); InitStats(inputs, single);
} }
logger.Close(); _logger.Close();
return; return;
} }
@@ -529,8 +549,8 @@ namespace SabreTools
Make a selection: Make a selection:
1) Show command line usage 1) Show command line usage
2) Import a DAT file or folder 2) Check for new or changed DATs
3) Generate DAT files 3) Generate System DATs
4) DAT file tools 4) DAT file tools
5) List all available sources 5) List all available sources
6) List all available systems 6) List all available systems
@@ -593,21 +613,33 @@ Make a selection:
private static void ImportMenu() private static void ImportMenu()
{ {
string selection = ""; string selection = "";
bool ignore = false;
while (selection.ToLowerInvariant() != "b") while (selection.ToLowerInvariant() != "b")
{ {
Console.Clear(); Console.Clear();
Build.Start("DATabase"); Build.Start("DATabaseTwo");
Console.WriteLine(@"IMPORT MENU Console.WriteLine(@"IMPORT MENU
=========================== ===========================
Enter the name of a DAT file or folder containing DAT files Make a selection:
or 'b' to go back to the previous menu:");
1) " + (ignore ? "Enable new source prompt" : "Disable new source prompt") + @"
2) Begin import process
B) Go back to the previous menu
");
Console.Write("Enter selection: "); Console.Write("Enter selection: ");
selection = Console.ReadLine(); selection = Console.ReadLine();
if (selection.ToLowerInvariant() != "b") switch (selection)
{ {
InitImport(selection); case "1":
Console.Write("\nPress any key to continue..."); ignore = !ignore;
Console.ReadKey(); break;
case "2":
Console.Clear();
InitImport(ignore);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
ignore = false;
break;
} }
} }
return; return;
@@ -618,23 +650,21 @@ or 'b' to go back to the previous menu:");
/// </summary> /// </summary>
private static void GenerateMenu() private static void GenerateMenu()
{ {
string selection = "", systems = "", sources = "", outdir = ""; string selection = "", system = "";
bool norename = false, old = false; bool norename = false, old = false;
while (selection.ToLowerInvariant() != "b") while (selection.ToLowerInvariant() != "b")
{ {
Console.Clear(); Console.Clear();
Build.Start("DATabase"); Build.Start("DATabaseTwo");
Console.WriteLine(@"GENERATE MENU Console.WriteLine(@"GENERATE 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 ClrMamePro output") + @" 2) " + (old ? "Enable XML output" : "Enable ClrMamePro output") + @"
3) List of systems to generate from" + (systems != "" ? ": " + systems : "") + @" 3) System ID to generate from" + (system != "" ? ": " + system : "") + @"
4) List of sources to generate from" + (sources != "" ? ": " + sources : "") + @" 4) Generate the DAT file for the specified system
5) Enter an output folder" + (outdir != "" ? ":\n\t" + outdir : "") + @" 5) Generate all DAT files
6) Generate the DAT file
7) Generate all available DAT files
B) Go back to the previous menu B) Go back to the previous menu
"); ");
Console.Write("Enter selection: "); Console.Write("Enter selection: ");
@@ -650,34 +680,23 @@ Make a selection:
case "3": case "3":
Console.Clear(); Console.Clear();
ListSystems(); ListSystems();
Console.Write("Please enter the systems separated by commas: "); Console.Write("Please enter the System ID: ");
systems = Console.ReadLine(); system = Console.ReadLine();
break; break;
case "4": case "4":
Console.Clear(); Console.Clear();
ListSources(); InitGenerate(system, norename, old);
Console.Write("Please enter the sources separated by commas: "); Console.Write("\nPress any key to continue...");
sources = Console.ReadLine(); Console.ReadKey();
system = "";
norename = false; old = false;
break; break;
case "5": case "5":
Console.Clear(); Console.Clear();
Console.Write("Please enter a folder name: "); InitGenerateAll(norename, old);
outdir = Console.ReadLine();
break;
case "6":
Console.Clear();
InitGenerate(systems, sources, outdir, norename, old);
Console.Write("\nPress any key to continue..."); Console.Write("\nPress any key to continue...");
Console.ReadKey(); Console.ReadKey();
systems = ""; sources = ""; outdir = ""; system = "";
norename = false; old = false;
break;
case "7":
Console.Clear();
InitGenerateAll(outdir, norename, old);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
systems = ""; sources = ""; outdir = "";
norename = false; old = false; norename = false; old = false;
break; break;
} }
@@ -1267,7 +1286,7 @@ Make a selection:
break; break;
case "4": case "4":
Console.Clear(); Console.Clear();
ListSystems(true); ListSystems();
Console.Write("Please enter the system: "); Console.Write("Please enter the system: ");
InitRemoveSystem(Console.ReadLine()); InitRemoveSystem(Console.ReadLine());
Console.Write("\nPress any key to continue..."); Console.Write("\nPress any key to continue...");
@@ -1284,73 +1303,38 @@ Make a selection:
#region Init Methods #region Init Methods
/// <summary> /// <summary>
/// Wrap importing a file or folder into the database /// Wrap importing and updating DATs
/// </summary> /// </summary>
/// <param name="filename">File or folder to be imported</param> /// <param name="ignore"></param>
private static void InitImport(string filename) private static void InitImport(bool ignore)
{ {
Console.Clear(); IImport imp = new ImportTwo(_datroot, _connectionString, _logger, ignore);
imp.ImportData();
// Drag and drop means quotes; we don't want quotes
filename = filename.Replace("\"", "");
// Check to see if the second argument is a file that exists
if (filename != "" && File.Exists(filename))
{
logger.User("Beginning import of " + filename);
IImport imp = new Import(filename, _connectionString, logger);
bool success = imp.ImportData();
logger.User(filename + (success ? "" : " not") + " imported!");
}
// Check to see if the second argument is a directory that exists
else if (filename != "" && Directory.Exists(filename))
{
foreach (string file in Directory.GetFiles(filename, "*", SearchOption.AllDirectories))
{
logger.User("Beginning import of " + file);
IImport imp = new Import(file, _connectionString, logger);
bool success = imp.ImportData();
logger.User(file + (success ? "" : " not") + " imported!");
}
}
else
{
logger.Error("I'm sorry but " + filename + " doesn't exist!");
}
return;
} }
/// <summary> /// <summary>
/// Wrap generating a DAT from the database /// Wrap generating a DAT from the library
/// </summary> /// </summary>
/// <param name="systems">Comma-separated list of systems to be included in the DAT (blank means all)</param> /// <param name="system">System ID to be used 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 ClrMamePro 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 systemid, bool norename, bool old)
{ {
IGenerate gen = new Generate(systems, sources, outdir, _connectionString, logger, norename, old); IGenerate gen = new GenerateTwo(systemid, "" /* sourceid */, _datroot, _outroot, _connectionString, _logger, norename, old);
gen.Export(); gen.Export();
return;
} }
/// <summary> /// <summary>
/// Wrap generating all standard DATs from the database /// Wrap generating all standard DATs from the library
/// </summary> /// </summary>
/// <param name="norename">True if files should not be renamed with system and/or source in merged mode (default false)</param> private static void InitGenerateAll(bool norename, bool old)
/// <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 + Path.DirectorySeparatorChar : List<string> systems = new List<string>();
(!outdir.EndsWith(Path.DirectorySeparatorChar.ToString()) ? outdir + Path.DirectorySeparatorChar : outdir));
outdir = actualdir + "temp" + Path.DirectorySeparatorChar;
// Generate system-merged
string query = "SELECT DISTINCT systems.id FROM systems JOIN games ON systems.id=games.system ORDER BY systems.manufacturer, systems.system";
//string query = "SELECT DISTINCT system.id FROM system JOIN gamesystem ON system.id=gamesystem.systemid ORDER BY system.manufacturer, system.name";
using (SqliteConnection dbc = new SqliteConnection(_connectionString)) using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{ {
dbc.Open(); dbc.Open();
string query = "SELECT id FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc)) using (SqliteCommand slc = new SqliteCommand(query, dbc))
{ {
using (SqliteDataReader sldr = slc.ExecuteReader()) using (SqliteDataReader sldr = slc.ExecuteReader())
@@ -1358,103 +1342,24 @@ Make a selection:
// If nothing is found, tell the user and exit // If nothing is found, tell the user and exit
if (!sldr.HasRows) if (!sldr.HasRows)
{ {
logger.Error("No systems found! Please add a source and then try again."); _logger.Warning("No systems found! Please add a system and then try again.");
return; return;
} }
while (sldr.Read()) while (sldr.Read())
{ {
InitGenerate(sldr.GetInt32(0).ToString(), "", outdir, norename, old); systems.Add(sldr.GetInt32(0).ToString());
// Generate custom
string squery = @"SELECT DISTINCT sources.id
FROM systems
JOIN games
ON systems.id=games.system
JOIN sources
ON games.source=sources.id
WHERE systems.id=" + sldr.GetInt32(0).ToString() + @"
ORDER BY sources.name";
/*
string squery = @"SELECT DISTINCT source.id
FROM system
JOIN gamesystem
ON system.id=gamesystem.systemid
JOIN gamesource
ON gamesystem.game=gamesource.game
JOIN source
ON gamesource.sourceid=source.id
WHERE system.id=" + sldr.GetInt32(0).ToString() + @"
ORDER BY source.name";
*/
using (SqliteCommand sslc = new SqliteCommand(squery, dbc))
{
using (SqliteDataReader ssldr = sslc.ExecuteReader())
{
// If nothing is found, tell the user and exit
if (!ssldr.HasRows)
{
logger.Error("No sources found! Please add a source and then try again.");
return;
}
while (ssldr.Read())
{
InitGenerate(sldr.GetInt32(0).ToString(), ssldr.GetInt32(0).ToString(), outdir, norename, old);
}
}
}
} }
} }
} }
// Generate source-merged // Loop through the inputs
query = "SELECT DISTINCT sources.id, sources.name FROM sources JOIN games ON sources.id=games.source ORDER BY sources.name"; foreach (string system in systems)
//query = "SELECT DISTINCT source.id, source.name FROM source JOIN gamesource ON source.id=gamesource.sourceid ORDER BY source.name";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{ {
using (SqliteDataReader sldr = slc.ExecuteReader()) _logger.User("Generating DAT for system id " + system);
{ InitGenerate(system, norename, old);
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
logger.Error("No sources found! Please add a source and then try again.");
return;
}
while (sldr.Read())
{
InitGenerate("", sldr.GetInt32(0).ToString(), outdir, norename, old);
}
}
} }
} }
// Generate MEGAMERGED
InitGenerate("", "", outdir, norename, old);
// Zip up all of the files that were generated
logger.User("Creating zip archive");
ZipArchive zip = ZipFile.Open(actualdir + "dats-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip", ZipArchiveMode.Create);
foreach (String filename in Directory.EnumerateFiles(outdir))
{
if (filename.EndsWith(".xml") || filename.EndsWith(".dat"))
{
string internalFolder = (filename.Contains("ALL (Merged") ? "" :
filename.Contains("Merged") ? "merged-system/" :
filename.Contains("ALL") ? "merged-source/" : "custom/");
zip.CreateEntryFromFile(filename, internalFolder + Path.GetFileName(filename), CompressionLevel.Optimal);
}
}
zip.Dispose();
logger.User("Zip archive created!");
// Remove all of the DATs from the folder
Directory.Delete(outdir, true);
return;
} }
/// <summary> /// <summary>
@@ -1474,13 +1379,13 @@ Make a selection:
if (File.Exists(filename)) if (File.Exists(filename))
{ {
logger.User("Converting \"" + Path.GetFileName(filename) + "\""); _logger.User("Converting \"" + Path.GetFileName(filename) + "\"");
DatData datdata = new DatData DatData datdata = new DatData
{ {
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = false, MergeRoms = false,
}; };
datdata = RomManipulation.Parse(filename, 0, 0, datdata, logger, true); datdata = RomManipulation.Parse(filename, 0, 0, datdata, _logger, true);
// Sometimes the description doesn't match the filename, change this // Sometimes the description doesn't match the filename, change this
if (datdata.Description != Path.GetFileNameWithoutExtension(filename)) if (datdata.Description != Path.GetFileNameWithoutExtension(filename))
@@ -1495,7 +1400,7 @@ Make a selection:
datdata.Description += ".new"; datdata.Description += ".new";
} }
Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(filename) : outdir), logger); Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(filename) : outdir), _logger);
} }
else if (Directory.Exists(filename)) else if (Directory.Exists(filename))
{ {
@@ -1503,13 +1408,13 @@ Make a selection:
foreach (string file in Directory.EnumerateFiles(filename, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(filename, "*", SearchOption.AllDirectories))
{ {
logger.User("Converting \"" + Path.GetFullPath(file).Remove(0, filename.Length) + "\""); _logger.User("Converting \"" + Path.GetFullPath(file).Remove(0, filename.Length) + "\"");
DatData datdata = new DatData DatData datdata = new DatData
{ {
OutputFormat = outputFormat, OutputFormat = outputFormat,
MergeRoms = false, MergeRoms = false,
}; };
datdata = RomManipulation.Parse(file, 0, 0, datdata, logger, true); datdata = RomManipulation.Parse(file, 0, 0, datdata, _logger, true);
// If the extension matches, append ".new" to the filename // If the extension matches, append ".new" to the filename
string extension = (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat"); string extension = (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
@@ -1518,12 +1423,12 @@ Make a selection:
datdata.FileName += ".new"; datdata.FileName += ".new";
} }
Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(file) : outdir + Path.GetDirectoryName(file).Remove(0, filename.Length - 1)), logger); Output.WriteDatfile(datdata, (outdir == "" ? Path.GetDirectoryName(file) : outdir + Path.GetDirectoryName(file).Remove(0, filename.Length - 1)), _logger);
} }
} }
else else
{ {
logger.Error("I'm sorry but " + filename + " doesn't exist!"); _logger.Error("I'm sorry but " + filename + " doesn't exist!");
} }
return; return;
} }
@@ -1554,7 +1459,7 @@ Make a selection:
string name = Path.GetFileNameWithoutExtension(input) + "-miss"; string name = Path.GetFileNameWithoutExtension(input) + "-miss";
// Read in the roms from the DAT and then write them to the file // Read in the roms from the DAT and then write them to the file
logger.User("Converting " + input); _logger.User("Converting " + input);
DatData datdata = new DatData DatData datdata = new DatData
{ {
OutputFormat = OutputFormat.MissFile, OutputFormat = OutputFormat.MissFile,
@@ -1568,7 +1473,7 @@ Make a selection:
GameName = gamename, GameName = gamename,
Romba = romba, Romba = romba,
}; };
datdata = RomManipulation.Parse(input, 0, 0, datdata, logger); datdata = RomManipulation.Parse(input, 0, 0, datdata, _logger);
datdata.FileName += "-miss"; datdata.FileName += "-miss";
datdata.Name += "-miss"; datdata.Name += "-miss";
datdata.Description += "-miss"; datdata.Description += "-miss";
@@ -1577,13 +1482,13 @@ Make a selection:
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext); addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext); repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
Output.WriteDatfile(datdata, Path.GetDirectoryName(input), logger); Output.WriteDatfile(datdata, Path.GetDirectoryName(input), _logger);
logger.User(input + " converted to: " + name); _logger.User(input + " converted to: " + name);
return; return;
} }
else else
{ {
logger.Error("I'm sorry but " + input + "doesn't exist!"); _logger.Error("I'm sorry but " + input + "doesn't exist!");
} }
} }
@@ -1601,7 +1506,7 @@ Make a selection:
if (input != "" && (File.Exists(input) || Directory.Exists(input))) if (input != "" && (File.Exists(input) || Directory.Exists(input)))
{ {
TrimMerge sg = new TrimMerge(input, root, rename, force, logger); TrimMerge sg = new TrimMerge(input, root, rename, force, _logger);
sg.Process(); sg.Process();
return; return;
} }
@@ -1641,7 +1546,7 @@ Make a selection:
} }
catch (PathTooLongException) catch (PathTooLongException)
{ {
logger.Warning("The path for " + file + " was too long"); _logger.Warning("The path for " + file + " was too long");
} }
} }
} }
@@ -1653,12 +1558,12 @@ Make a selection:
} }
catch (PathTooLongException) catch (PathTooLongException)
{ {
logger.Warning("The path for " + input.Replace("\"", "") + " was too long"); _logger.Warning("The path for " + input.Replace("\"", "") + " was too long");
} }
} }
} }
MergeDiff md = new MergeDiff(newInputs, name, desc, cat, version, author, diff, dedup, bare, forceunpack, old, superdat, cascade, inplace, outdir, logger); MergeDiff md = new MergeDiff(newInputs, name, desc, cat, version, author, diff, dedup, bare, forceunpack, old, superdat, cascade, inplace, outdir, _logger);
md.Process(); md.Process();
} }
@@ -1681,16 +1586,16 @@ Make a selection:
{ {
if (exta == "" || extb == "") if (exta == "" || extb == "")
{ {
logger.Warning("Two extensions are needed to split a DAT!"); _logger.Warning("Two extensions are needed to split a DAT!");
return; return;
} }
ExtSplit es = new ExtSplit(input, exta, extb, outdir, logger); ExtSplit es = new ExtSplit(input, exta, extb, outdir, _logger);
es.Split(); es.Split();
return; return;
} }
else else
{ {
logger.Log("I'm sorry but " + input + "doesn't exist!"); _logger.Log("I'm sorry but " + input + "doesn't exist!");
} }
} }
@@ -1709,7 +1614,7 @@ Make a selection:
{ {
if (!File.Exists(input.Replace("\"", "")) && !Directory.Exists(input.Replace("\"", ""))) if (!File.Exists(input.Replace("\"", "")) && !Directory.Exists(input.Replace("\"", "")))
{ {
logger.Error(input + " is not a valid file or folder!"); _logger.Error(input + " is not a valid file or folder!");
Console.WriteLine(); Console.WriteLine();
Build.Help(); Build.Help();
return; return;
@@ -1717,7 +1622,7 @@ Make a selection:
} }
// If so, run the program // If so, run the program
HashSplit hs = new HashSplit(inputs, outdir, logger); HashSplit hs = new HashSplit(inputs, outdir, _logger);
hs.Split(); hs.Split();
} }
@@ -1761,11 +1666,11 @@ Make a selection:
{ {
if (DBTools.AddSource(name, url, _connectionString)) if (DBTools.AddSource(name, url, _connectionString))
{ {
logger.Log("Source " + name + " added!"); _logger.Log("Source " + name + " added!");
} }
else else
{ {
logger.Error("Source " + name + " could not be added!"); _logger.Error("Source " + name + " could not be added!");
} }
} }
@@ -1780,16 +1685,16 @@ Make a selection:
{ {
if (DBTools.RemoveSource(srcid, _connectionString)) if (DBTools.RemoveSource(srcid, _connectionString))
{ {
logger.Log("Source '" + srcid + "' removed!"); _logger.Log("Source '" + srcid + "' removed!");
} }
else else
{ {
logger.Error("Source with id '" + srcid + "' could not be removed."); _logger.Error("Source with id '" + srcid + "' could not be removed.");
} }
} }
else else
{ {
logger.Error("Invalid input"); _logger.Error("Invalid input");
} }
} }
@@ -1802,11 +1707,11 @@ Make a selection:
{ {
if (DBTools.AddSystem(manufacturer, system, _connectionString)) if (DBTools.AddSystem(manufacturer, system, _connectionString))
{ {
logger.Log("System " + manufacturer + " - " + system + " added!"); _logger.Log("System " + manufacturer + " - " + system + " added!");
} }
else else
{ {
logger.Error("System " + manufacturer + " - " + system + " could not be added!"); _logger.Error("System " + manufacturer + " - " + system + " could not be added!");
} }
} }
@@ -1821,27 +1726,72 @@ Make a selection:
{ {
if (DBTools.RemoveSystem(sysid, _connectionString)) if (DBTools.RemoveSystem(sysid, _connectionString))
{ {
logger.Log("System '" + sysid + "' removed!"); _logger.Log("System '" + sysid + "' removed!");
} }
else else
{ {
logger.Error("System with id '" + sysid + "' could not be removed."); _logger.Error("System with id '" + sysid + "' could not be removed.");
} }
} }
else else
{ {
logger.Error("Invalid input"); _logger.Error("Invalid input");
} }
} }
#endregion #endregion
#region Listing Methods #region Helper methods
/// <summary>
/// Perform initial setup for the program
/// </summary>
private static void Setup()
{
Remapping.CreateRemappings();
Build.Start("DATabaseTwo");
// Perform initial database and folder setup
if (!Directory.Exists(_datroot))
{
Directory.CreateDirectory(_datroot);
}
if (!Directory.Exists(_outroot))
{
Directory.CreateDirectory(_outroot);
}
DBTools.EnsureDatabase(_dbName, _connectionString);
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
string query = "SELECT * FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
int systemid = sldr.GetInt32(0);
string system = _datroot + Path.DirectorySeparatorChar + sldr.GetString(1) + " - " + sldr.GetString(2);
system = system.Trim();
if (!Directory.Exists(system))
{
Directory.CreateDirectory(system);
}
}
}
}
}
}
/// <summary> /// <summary>
/// List sources in the database /// List sources in the database
/// </summary> /// </summary>
/// <param name="all">True to list all sources regardless if there is a game associated or not</param> /// <param name="all">True to list all sources regardless if there is a game associated or not</param>
/// <remarks>This does not have an analogue in DATabaseTwo</remarks>
private static void ListSources(bool all = false) private static void ListSources(bool all = false)
{ {
string query = @" string query = @"
@@ -1858,7 +1808,7 @@ ORDER BY sources.name COLLATE NOCASE";
// If nothing is found, tell the user and exit // If nothing is found, tell the user and exit
if (!sldr.HasRows) if (!sldr.HasRows)
{ {
logger.Warning("No sources found! Please add a source and then try again."); _logger.Warning("No sources found! Please add a source and then try again.");
return; return;
} }
@@ -1876,13 +1826,12 @@ ORDER BY sources.name COLLATE NOCASE";
/// <summary> /// <summary>
/// List systems in the database /// List systems in the database
/// </summary> /// </summary>
/// <param name="all">True to list all systems regardless if there is a game associated or not</param> private static void ListSystems()
private static void ListSystems(bool all = false)
{ {
string query = @" string query = @"
SELECT DISTINCT systems.id, systems.manufacturer, systems.system SELECT DISTINCT system.id, system.manufacturer, system.name
FROM systems " + (!all ? "JOIN games ON systems.id=games.system" : "") + @" FROM system
ORDER BY systems.manufacturer, systems.system"; ORDER BY system.manufacturer, system.name";
using (SqliteConnection dbc = new SqliteConnection(_connectionString)) using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{ {
dbc.Open(); dbc.Open();
@@ -1893,7 +1842,7 @@ ORDER BY systems.manufacturer, systems.system";
// If nothing is found, tell the user and exit // If nothing is found, tell the user and exit
if (!sldr.HasRows) if (!sldr.HasRows)
{ {
logger.Warning("No systems found! Please add a system and then try again."); _logger.Warning("No systems found! Please add a system and then try again.");
return; return;
} }

View File

@@ -105,10 +105,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ExtSplit.cs" /> <Compile Include="ExtSplit.cs" />
<Compile Include="Generate.cs" /> <Compile Include="ImportExport\Generate.cs" />
<Compile Include="ImportExport\GenerateTwo.cs" />
<Compile Include="HashSplit.cs" /> <Compile Include="HashSplit.cs" />
<Compile Include="Import.cs" /> <Compile Include="ImportExport\Import.cs" />
<Compile Include="DATabase.cs" /> <Compile Include="DATabase.cs" />
<Compile Include="ImportExport\ImportTwo.cs" />
<Compile Include="MergeDiff.cs" /> <Compile Include="MergeDiff.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TrimMerge.cs" /> <Compile Include="TrimMerge.cs" />

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -1,452 +0,0 @@
using System;
using System.Collections.Generic;
using Mono.Data.Sqlite;
using System.IO;
using SabreTools.Helper;
namespace SabreTools
{
/// <summary>
/// The following features are missing from DATabaseTwo with respect to the original DATabase:
/// - Source merging
/// - Custom DATs based on a system and a source
/// - Multi-source and multi-system DATs
///
/// The following features need to (want to) be implemented in DATabaseTwo for further stability
/// - Import updating file locations and names when SHA-1 hashes are matched
/// - True duplicate DATs being removed from the import folder (SHA-1 matches)
/// - Generate All only generating DATs that have been recently updated
/// + This requires implementing a "last updated" data point for all DATs and tracking for "last generate" somewhere
/// - Impelement a ToSort folder for DATs that will place DATs in the correct subfolder on Import
/// </summary>
public class DATabaseTwo
{
// Private required variables
private static string _datroot = "DATS";
private static string _outroot = "Output";
private static string _dbName = "dats.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
private static Logger _logger;
public static void Main(string[] args)
{
Console.Clear();
// Credits take precidence over all
if ((new List<string>(args)).Contains("--credits"))
{
Build.Credits();
return;
}
_logger = new Logger(true, "database2.log");
_logger.Start();
// Perform initial setup
Setup();
// If there's no arguments, show the menu
if (args.Length == 0)
{
_logger.ToFile = true;
ShowMainMenu();
_logger.Close();
return;
}
// Set all default values
bool help = false,
gen = false,
genall = false,
ignore = false,
listsys = false,
norename = false,
old = false;
string system = "";
// Determine which switches are enabled (with values if necessary)
foreach (string arg in args)
{
switch (arg)
{
case "-?":
case "-h":
case "--help":
help = true;
break;
case "-g":
case "--generate":
gen = true;
break;
case "-ga":
case "--generate-all":
genall = true;
break;
case "-i":
case "--ignore":
ignore = true;
break;
case "-lsy":
case "--list-systems":
listsys = true;
break;
case "-nr":
case "--no-rename":
norename = true;
break;
case "-o":
case "--old":
old = true;
break;
default:
if (arg.StartsWith("-sys=") || arg.StartsWith("--system="))
{
system = arg.Split('=')[1];
}
else
{
_logger.Warning("Invalid input detected: " + arg);
Console.WriteLine();
Build.Help();
_logger.Close();
return;
}
break;
}
}
// If help is set or system is blank, show the help screen
if (help || (system == "" && !listsys))
{
Build.Help();
_logger.Close();
return;
}
// If we want a list of systems
if (listsys)
{
ListSystems();
}
// If we want to generate all DATs
else if (genall)
{
InitImport(ignore);
InitGenerateAll(norename, old);
}
// If we want to generate a DAT
else if (gen)
{
InitImport(ignore);
InitGenerate(system, norename, old);
}
_logger.Close();
}
#region Menus
/// <summary>
/// Show the text-based main menu
/// </summary>
private static void ShowMainMenu()
{
string selection = "";
while (selection.ToLowerInvariant() != "x")
{
Console.Clear();
Build.Start("DATabaseTwo");
Console.WriteLine(@"MAIN MENU
===========================
Make a selection:
1) Show command line usage
2) Check for new or changed DATs
3) Generate System DATs
4) List all available systems
5) Show credits
X) Exit Program
");
Console.Write("Enter selection: ");
selection = Console.ReadLine();
switch (selection)
{
case "1":
Console.Clear();
Build.Help();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
case "2":
ImportMenu();
break;
case "3":
GenerateMenu();
break;
case "4":
Console.Clear();
Build.Start("DATabaseTwo");
ListSystems();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
case "5":
Console.Clear();
Build.Credits();
Console.Write("\nPress any key to continue...");
Console.ReadKey();
break;
}
}
}
/// <summary>
/// Show the text-based import menu
/// </summary>
private static void ImportMenu()
{
string selection = "";
bool ignore = false;
while (selection.ToLowerInvariant() != "b")
{
Console.Clear();
Build.Start("DATabaseTwo");
Console.WriteLine(@"IMPORT MENU
===========================
Make a selection:
1) " + (ignore ? "Enable new source prompt" : "Disable new source prompt") + @"
2) Begin import process
B) Go back to the previous menu
");
Console.Write("Enter selection: ");
selection = Console.ReadLine();
switch (selection)
{
case "1":
ignore = !ignore;
break;
case "2":
Console.Clear();
InitImport(ignore);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
ignore = false;
break;
}
}
return;
}
/// <summary>
/// Show the text-based generate menu
/// </summary>
private static void GenerateMenu()
{
string selection = "", system = "";
bool norename = false, old = false;
while (selection.ToLowerInvariant() != "b")
{
Console.Clear();
Build.Start("DATabaseTwo");
Console.WriteLine(@"GENERATE MENU
===========================
Make a selection:
1) " + (norename ? "Enable game renaming" : "Disable game renaming") + @"
2) " + (old ? "Enable XML output" : "Enable ClrMamePro output") + @"
3) System ID to generate from" + (system != "" ? ": " + system : "") + @"
4) Generate the DAT file for the specified system
5) Generate all DAT files
B) Go back to the previous menu
");
Console.Write("Enter selection: ");
selection = Console.ReadLine();
switch (selection)
{
case "1":
norename = !norename;
break;
case "2":
old = !old;
break;
case "3":
Console.Clear();
ListSystems();
Console.Write("Please enter the System ID: ");
system = Console.ReadLine();
break;
case "4":
Console.Clear();
InitGenerate(system, norename, old);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
system = "";
norename = false; old = false;
break;
case "5":
Console.Clear();
InitGenerateAll(norename, old);
Console.Write("\nPress any key to continue...");
Console.ReadKey();
system = "";
norename = false; old = false;
break;
}
}
return;
}
#endregion
#region Function Methods
/// <summary>
/// Wrap importing and updating DATs
/// </summary>
/// <param name="ignore"></param>
private static void InitImport(bool ignore)
{
Import imp = new Import(_datroot, _connectionString, _logger, ignore);
imp.ImportData();
}
/// <summary>
/// Wrap generating a DAT from the library
/// </summary>
/// <param name="system">System ID to be used 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 ClrMamePro format (default false)</param>
private static void InitGenerate(string systemid, bool norename, bool old)
{
Generate gen = new Generate(systemid, "" /* sourceid */, _datroot, _outroot, _connectionString, _logger, norename, old);
gen.Export();
}
/// <summary>
/// Wrap generating all standard DATs from the library
/// </summary>
private static void InitGenerateAll(bool norename, bool old)
{
List<string> systems = new List<string>();
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
string query = "SELECT id FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
_logger.Warning("No systems found! Please add a system and then try again.");
return;
}
while (sldr.Read())
{
systems.Add(sldr.GetInt32(0).ToString());
}
}
}
// Loop through the inputs
foreach (string system in systems)
{
_logger.User("Generating DAT for system id " + system);
InitGenerate(system, norename, old);
}
}
}
/// <summary>
/// List systems in the database
/// </summary>
private static void ListSystems()
{
string query = @"
SELECT DISTINCT system.id, system.manufacturer, system.name
FROM system
ORDER BY system.manufacturer, system.name";
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
_logger.Warning("No systems found! Please add a system and then try again.");
return;
}
Console.WriteLine("Available Systems (id <= name):\n");
while (sldr.Read())
{
Console.WriteLine(sldr.GetInt32(0) + "\t<=\t" + sldr.GetString(1) + " - " + sldr.GetString(2));
}
}
}
}
return;
}
#endregion
#region Helper Methods
/// <summary>
/// Perform initial setup for the program
/// </summary>
private static void Setup()
{
Remapping.CreateRemappings();
Build.Start("DATabaseTwo");
// Perform initial database and folder setup
if (!Directory.Exists(_datroot))
{
Directory.CreateDirectory(_datroot);
}
if (!Directory.Exists(_outroot))
{
Directory.CreateDirectory(_outroot);
}
DBTools.EnsureDatabase(_dbName, _connectionString);
using (SqliteConnection dbc = new SqliteConnection(_connectionString))
{
dbc.Open();
string query = "SELECT * FROM system";
using (SqliteCommand slc = new SqliteCommand(query, dbc))
{
using (SqliteDataReader sldr = slc.ExecuteReader())
{
while (sldr.Read())
{
int systemid = sldr.GetInt32(0);
string system = _datroot + Path.DirectorySeparatorChar + sldr.GetString(1) + " - " + sldr.GetString(2);
system = system.Trim();
if (!Directory.Exists(system))
{
Directory.CreateDirectory(system);
}
}
}
}
}
}
#endregion
}
}

View File

@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DATabaseTwo</RootNamespace>
<AssemblyName>DATabaseTwo</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Debug-x64\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\..\Release-x64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\Mono.Data.Sqlite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Portable, Version=4.0.0.0, Culture=neutral, PublicKeyToken=59e704a76bc4613a, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Data.Portable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Transactions.Portable, Version=4.0.0.0, Culture=neutral, PublicKeyToken=59e704a76bc4613a, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Transactions.Portable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DATabaseTwo.cs" />
<Compile Include="GenerateTwo.cs" />
<Compile Include="ImportTwo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SabreHelper\SabreHelper.csproj">
<Project>{225a1afd-0890-44e8-b779-7502665c23a5}</Project>
<Name>SabreHelper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets" Condition="Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" />
<Target Name="EnsureMonoDataSqlitePortableImported" BeforeTargets="BeforeBuild" Condition="'$(MonoDataSqlitePortableImported)' == ''">
<Error Condition="!Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them." />
<Error Condition="Exists('..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\tools\Mono.Data.Sqlite.Portable.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DATabaseTwo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DATabaseTwo")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c7732a05-1f96-43ed-ac8c-0e388f37ebc1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Data.Sqlite.Portable" version="1.0.3.5" targetFramework="net452" />
</packages>

View File

@@ -99,18 +99,16 @@ Options:
-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
-system= Comma-separated list of system IDs -system= System ID to generate from
-source= Comma-separated list of source IDs
-out= Output directory
-nr, --no-rename Don't auto-rename games -nr, --no-rename Don't auto-rename games
-o, --old Output DAT in CMP format instead of XML -o, --old Output DAT in CMP format instead of XML
-ga, --generate-all Start tool in generate all mode -ga, --generate-all Start tool in generate all mode
-out= Output directory
-nr, --no-rename Don't auto-rename games -nr, --no-rename Don't auto-rename games
-o, --old Output DAT in CMP format instead of XML -o, --old Output DAT in CMP format instead of XML
-hs, --hash-split Split a DAT or folder by best-available hashes -hs, --hash-split Split a DAT or folder by best-available hashes
-out= Output directory -out= Output directory
-i, --import Start tool in import mode -i, --import Start tool in import mode
-ig, --ignore Don't prompt for new sources
-lso, --list-sources List all sources (id <= name) -lso, --list-sources List all sources (id <= name)
-lsy, --list-systems List all systems (id <= name) -lsy, --list-systems List all systems (id <= name)
-m, --merge Merge one or more DATs -m, --merge Merge one or more DATs
@@ -195,22 +193,6 @@ This program will output the following DATs:
(d) Have - (NewComplete)-(New Missing) (d) Have - (NewComplete)-(New Missing)
OR (Complete or NewComplete)-(Missing) if one is missing"); OR (Complete or NewComplete)-(Missing) if one is missing");
break; break;
case "DATabaseTwo":
Console.WriteLine(@"DATabaseTwo - Catalog and merge DATs by system
-----------------------------------------
Usage: DATabaseTwo [options]
Options:
-h, -?, --help Show this help dialog
-g, --generate Start tool in generate mode
-ga, --generate-all Start tool in generate all mode
-i, --ignore Don't prompt for new sources
-lsy, --list-systems List all systems (id <= name)
-nr, --no-rename Don't auto-rename games by source/system
-o, --old Output DAT in CMP format instead of XML
-sys=, --system= System ID to generate from
");
break;
case "Filter": case "Filter":
Console.WriteLine(@"Filter - Filter DATs by inputted criteria Console.WriteLine(@"Filter - Filter DATs by inputted criteria
----------------------------------------- -----------------------------------------

View File

@@ -15,8 +15,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATFromDir", "DATFromDir\DA
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfflineMerge", "OfflineMerge\OfflineMerge.csproj", "{88310DB9-3B64-4268-AD48-2E0358D4CA5F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfflineMerge", "OfflineMerge\OfflineMerge.csproj", "{88310DB9-3B64-4268-AD48-2E0358D4CA5F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DATabaseTwo", "DATabaseTwo\DATabaseTwo.csproj", "{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filter", "Filter\Filter.csproj", "{136AA0D0-9234-4680-B593-A32C0762972E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filter", "Filter\Filter.csproj", "{136AA0D0-9234-4680-B593-A32C0762972E}"
EndProject EndProject
Global Global
@@ -76,14 +74,6 @@ Global
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|Any CPU.Build.0 = Release|Any CPU {88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|Any CPU.Build.0 = Release|Any CPU
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.ActiveCfg = Release|x64 {88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.ActiveCfg = Release|x64
{88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.Build.0 = Release|x64 {88310DB9-3B64-4268-AD48-2E0358D4CA5F}.Release|x64.Build.0 = Release|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|x64.ActiveCfg = Debug|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Debug|x64.Build.0 = Debug|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|Any CPU.Build.0 = Release|Any CPU
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|x64.ActiveCfg = Release|x64
{C7732A05-1F96-43ED-AC8C-0E388F37EBC1}.Release|x64.Build.0 = Release|x64
{136AA0D0-9234-4680-B593-A32C0762972E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {136AA0D0-9234-4680-B593-A32C0762972E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{136AA0D0-9234-4680-B593-A32C0762972E}.Debug|Any CPU.Build.0 = Debug|Any CPU {136AA0D0-9234-4680-B593-A32C0762972E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{136AA0D0-9234-4680-B593-A32C0762972E}.Debug|x64.ActiveCfg = Debug|x64 {136AA0D0-9234-4680-B593-A32C0762972E}.Debug|x64.ActiveCfg = Debug|x64