mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add suggested feature for power users
Ignore is useful for users who don't particularly care about the source going into the system. This is especially useful in combination with norename enabled.
This commit is contained in:
@@ -53,21 +53,10 @@ namespace SabreTools
|
|||||||
_logger = new Logger(true, "database2.log");
|
_logger = new Logger(true, "database2.log");
|
||||||
_logger.Start();
|
_logger.Start();
|
||||||
|
|
||||||
// Call 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
|
// Set all default values
|
||||||
bool help = false,
|
bool help = false,
|
||||||
genall = false,
|
genall = false,
|
||||||
|
ignore = false,
|
||||||
listsys = false,
|
listsys = false,
|
||||||
norename = false,
|
norename = false,
|
||||||
old = false;
|
old = false;
|
||||||
@@ -87,6 +76,10 @@ namespace SabreTools
|
|||||||
case "--generate-all":
|
case "--generate-all":
|
||||||
genall = true;
|
genall = true;
|
||||||
break;
|
break;
|
||||||
|
case "-i":
|
||||||
|
case "--ignore":
|
||||||
|
ignore = true;
|
||||||
|
break;
|
||||||
case "-lsy":
|
case "-lsy":
|
||||||
case "--list-systems":
|
case "--list-systems":
|
||||||
listsys = true;
|
listsys = true;
|
||||||
@@ -124,6 +117,18 @@ namespace SabreTools
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call initial setup because everything after here requires it
|
||||||
|
Import(ignore);
|
||||||
|
|
||||||
|
// If there's no arguments, show the menu
|
||||||
|
if (args.Length == 0)
|
||||||
|
{
|
||||||
|
_logger.ToFile = true;
|
||||||
|
ShowMainMenu();
|
||||||
|
_logger.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If we want a list of systems
|
// If we want a list of systems
|
||||||
if (listsys)
|
if (listsys)
|
||||||
{
|
{
|
||||||
@@ -512,7 +517,8 @@ ORDER BY system.manufacturer, system.name";
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform initial setup for the program
|
/// Perform initial setup for the program
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void Setup()
|
/// <param name="ignore">False if each DAT that has no defined source asks for user input (default), true otherwise</param>
|
||||||
|
private static void Import(bool ignore = false)
|
||||||
{
|
{
|
||||||
Remapping.CreateRemappings();
|
Remapping.CreateRemappings();
|
||||||
Build.Start("DATabaseTwo");
|
Build.Start("DATabaseTwo");
|
||||||
@@ -556,7 +562,7 @@ ORDER BY system.manufacturer, system.name";
|
|||||||
{
|
{
|
||||||
while (sldr.Read())
|
while (sldr.Read())
|
||||||
{
|
{
|
||||||
int id = sldr.GetInt32(0);
|
int systemid = sldr.GetInt32(0);
|
||||||
string system = _datroot + Path.DirectorySeparatorChar + sldr.GetString(1) + " - " + sldr.GetString(2);
|
string system = _datroot + Path.DirectorySeparatorChar + sldr.GetString(1) + " - " + sldr.GetString(2);
|
||||||
system = system.Trim();
|
system = system.Trim();
|
||||||
|
|
||||||
@@ -601,6 +607,12 @@ COMMIT;";
|
|||||||
// Add the hash to the temporary Dictionary
|
// Add the hash to the temporary Dictionary
|
||||||
hashes.Add(hash, hashid);
|
hashes.Add(hash, hashid);
|
||||||
|
|
||||||
|
// If we don't care about source, stop here
|
||||||
|
if (ignore)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Now try to determine the source for the file based on the name
|
// Now try to determine the source for the file based on the name
|
||||||
string source = GetSourceFromFileName(Path.GetFileName(file));
|
string source = GetSourceFromFileName(Path.GetFileName(file));
|
||||||
int sourceid = 0;
|
int sourceid = 0;
|
||||||
@@ -679,8 +691,10 @@ COMMIT;";
|
|||||||
}
|
}
|
||||||
// Otherwise, we should already have an ID
|
// Otherwise, we should already have an ID
|
||||||
|
|
||||||
// Add the source link to the database
|
// Add the source and system link to the database
|
||||||
string uquery = "INSERT OR IGNORE INTO datsdata (id, key, value) VALUES (" + hashid + ", 'source', '" + sourceid + "')";
|
string uquery = @"INSERT OR IGNORE INTO datsdata (id, key, value)
|
||||||
|
VALUES (" + hashid + ", 'source', '" + sourceid + @"'),
|
||||||
|
(" + hashid + ", 'system', '" + systemid + "')";
|
||||||
using (SqliteCommand uslc = new SqliteCommand(uquery, dbc))
|
using (SqliteCommand uslc = new SqliteCommand(uquery, dbc))
|
||||||
{
|
{
|
||||||
uslc.ExecuteNonQuery();
|
uslc.ExecuteNonQuery();
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ Usage: DATabaseTwo [options]
|
|||||||
Options:
|
Options:
|
||||||
-h, -?, --help Show this help dialog
|
-h, -?, --help Show this help dialog
|
||||||
-ga, --generate-all Start tool in generate all 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)
|
-lsy, --list-systems List all systems (id <= name)
|
||||||
-o, --old Output DAT in CMP format instead of XML
|
-o, --old Output DAT in CMP format instead of XML
|
||||||
-sys=, --system= System ID to generate from
|
-sys=, --system= System ID to generate from
|
||||||
|
|||||||
Reference in New Issue
Block a user