mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make all folders on the first run so that there's no confusion if the user doesn't perform import first.
This commit is contained in:
@@ -53,19 +53,8 @@ namespace SabreTools
|
||||
_logger = new Logger(true, "database2.log");
|
||||
_logger.Start();
|
||||
|
||||
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);
|
||||
// Perform initial setup
|
||||
Setup();
|
||||
|
||||
// If there's no arguments, show the menu
|
||||
if (args.Length == 0)
|
||||
@@ -574,6 +563,50 @@ ORDER BY system.manufacturer, system.name";
|
||||
|
||||
#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>
|
||||
/// Perform initial or incremental import of DATs in the root folder
|
||||
/// </summary>
|
||||
@@ -612,11 +645,6 @@ ORDER BY system.manufacturer, system.name";
|
||||
|
||||
_logger.Log("System: " + system.Remove(0, 5));
|
||||
|
||||
if (!Directory.Exists(system))
|
||||
{
|
||||
Directory.CreateDirectory(system);
|
||||
}
|
||||
|
||||
// Audit all DATs in the folder
|
||||
foreach (string file in Directory.GetFiles(system, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user