diff --git a/DATabase/DATabase.cs b/DATabase/DATabase.cs index 8d2066c5..7d5017cf 100644 --- a/DATabase/DATabase.cs +++ b/DATabase/DATabase.cs @@ -11,7 +11,7 @@ namespace SabreTools /// /// Entry class for the DATabase application /// - class DATabase + public class DATabase { private static Logger logger; private static string _dbName = "DATabase.sqlite"; @@ -1298,7 +1298,7 @@ Make a selection: if (filename != "" && File.Exists(filename)) { logger.User("Beginning import of " + filename); - Import imp = new Import(filename, _connectionString, logger); + IImport imp = new Import(filename, _connectionString, logger); bool success = imp.ImportData(); logger.User(filename + (success ? "" : " not") + " imported!"); } @@ -1308,7 +1308,7 @@ Make a selection: foreach (string file in Directory.GetFiles(filename, "*", SearchOption.AllDirectories)) { logger.User("Beginning import of " + file); - Import imp = new Import(file, _connectionString, logger); + IImport imp = new Import(file, _connectionString, logger); bool success = imp.ImportData(); logger.User(file + (success ? "" : " not") + " imported!"); } @@ -1329,7 +1329,7 @@ Make a selection: /// True if the output file should be in ClrMamePro format (default false) 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); + IGenerate gen = new Generate(systems, sources, outdir, _connectionString, logger, norename, old); gen.Export(); return; } diff --git a/DATabase/Generate.cs b/DATabase/Generate.cs index b967bfe5..8253474a 100644 --- a/DATabase/Generate.cs +++ b/DATabase/Generate.cs @@ -11,7 +11,7 @@ namespace SabreTools /// /// Generate a DAT from the data in the database /// - class Generate + class Generate : IGenerate { // Private instance variables private string _systems; diff --git a/DATabase/Import.cs b/DATabase/Import.cs index 6e7b6e43..8c5b1e50 100644 --- a/DATabase/Import.cs +++ b/DATabase/Import.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Mono.Data.Sqlite; using System.IO; using System.Text.RegularExpressions; -using System.Xml; using SabreTools.Helper; @@ -12,7 +10,7 @@ namespace SabreTools /// /// Import data into the database from existing DATs /// - public class Import + public class Import : IImport { // Private instance variables private string _filepath; diff --git a/DATabaseTwo/DATabaseTwo.csproj b/DATabaseTwo/DATabaseTwo.csproj index 72db8076..0be5871c 100644 --- a/DATabaseTwo/DATabaseTwo.csproj +++ b/DATabaseTwo/DATabaseTwo.csproj @@ -77,8 +77,8 @@ - - + + diff --git a/DATabaseTwo/Generate.cs b/DATabaseTwo/GenerateTwo.cs similarity index 97% rename from DATabaseTwo/Generate.cs rename to DATabaseTwo/GenerateTwo.cs index aae485d1..74a142f1 100644 --- a/DATabaseTwo/Generate.cs +++ b/DATabaseTwo/GenerateTwo.cs @@ -10,7 +10,7 @@ using SabreTools.Helper; namespace SabreTools { - public class Generate + public class GenerateTwo : IGenerate { // Private instance variables private string _systemid; @@ -35,7 +35,7 @@ namespace SabreTools /// Logger object for file or console output /// True if files should not be renamed with system and/or source in merged mode (default false) /// True if the output file should be in ClrMamePro format (default false) - public Generate(string systemid, string sourceid, string datroot, string outroot, string connectionString, Logger logger, bool norename = false, bool old = false) + public GenerateTwo(string systemid, string sourceid, string datroot, string outroot, string connectionString, Logger logger, bool norename = false, bool old = false) { _systemid = systemid; _sourceid = sourceid; diff --git a/DATabaseTwo/Import.cs b/DATabaseTwo/ImportTwo.cs similarity index 99% rename from DATabaseTwo/Import.cs rename to DATabaseTwo/ImportTwo.cs index 341ee363..42c7b9c2 100644 --- a/DATabaseTwo/Import.cs +++ b/DATabaseTwo/ImportTwo.cs @@ -9,7 +9,7 @@ using SabreTools.Helper; namespace SabreTools { - public class Import + public class ImportTwo : IImport { // Private instance variables private string _datroot; @@ -24,7 +24,7 @@ namespace SabreTools /// Connection string for SQLite /// Logger object for file or console output /// False if each DAT that has no defined source asks for user input (default), true otherwise - public Import(string datroot, string connectionString, Logger logger, bool ignore = false) + public ImportTwo(string datroot, string connectionString, Logger logger, bool ignore = false) { _datroot = datroot; _connectionString = connectionString; diff --git a/SabreHelper/Interfaces/IGenerate.cs b/SabreHelper/Interfaces/IGenerate.cs new file mode 100644 index 00000000..fe0895bd --- /dev/null +++ b/SabreHelper/Interfaces/IGenerate.cs @@ -0,0 +1,7 @@ +namespace SabreTools.Helper +{ + public interface IGenerate + { + bool Export(); + } +} diff --git a/SabreHelper/Interfaces/IImport.cs b/SabreHelper/Interfaces/IImport.cs new file mode 100644 index 00000000..ca6ce6ca --- /dev/null +++ b/SabreHelper/Interfaces/IImport.cs @@ -0,0 +1,7 @@ +namespace SabreTools.Helper +{ + public interface IImport + { + bool ImportData(); + } +} diff --git a/SabreHelper/SabreHelper.csproj b/SabreHelper/SabreHelper.csproj index 6d819808..72ae46a7 100644 --- a/SabreHelper/SabreHelper.csproj +++ b/SabreHelper/SabreHelper.csproj @@ -94,6 +94,8 @@ + +