diff --git a/RombaSharp/Partials/RombaSharp.Help.cs b/RombaSharp/Partials/RombaSharp.Help.cs index 5611963e..1a2843f0 100644 --- a/RombaSharp/Partials/RombaSharp.Help.cs +++ b/RombaSharp/Partials/RombaSharp.Help.cs @@ -102,6 +102,13 @@ namespace RombaSharp FeatureType.Flag, null); + // Create the Import feature + Feature import = new Feature( + "import", + "Import a database from a formatted CSV file", + FeatureType.Flag, + null); + // Create the Lookup feature Feature lookup = new Feature( "lookup", @@ -146,6 +153,11 @@ namespace RombaSharp "Moves DAT index entries for orphaned DATs", FeatureType.Flag, null); + purgeBackup.AddFeature("log-only", new Feature( + "-log-only", + "Only write out actions to log", + FeatureType.Flag, + null)); // Create the Purge Delete feature Feature purgeDelete = new Feature( @@ -153,6 +165,11 @@ namespace RombaSharp "Deletes DAT index entries for orphaned DATs", FeatureType.Flag, null); + purgeDelete.AddFeature("log-only", new Feature( + "-log-only", + "Only write out actions to log", + FeatureType.Flag, + null)); // Create the Refresh DATs feature Feature refreshDats = new Feature( @@ -185,6 +202,7 @@ namespace RombaSharp help.Add("Dir2Dat", dir2dat); help.Add("Export", export); help.Add("Fixdat", fixdat); + help.Add("Import", import); help.Add("Lookup", lookup); help.Add("Memstats", memstats); help.Add("Merge", merge); diff --git a/RombaSharp/Partials/RombaSharp.Helpers.cs b/RombaSharp/Partials/RombaSharp.Helpers.cs index 8c7cdef2..d60f5ef3 100644 --- a/RombaSharp/Partials/RombaSharp.Helpers.cs +++ b/RombaSharp/Partials/RombaSharp.Helpers.cs @@ -356,7 +356,8 @@ namespace RombaSharp /// /// Moves DAT index entries for orphaned DATs to backup folder /// - private static void PurgeBackup() + /// Only write out actions to log + private static void PurgeBackup(bool logOnly) { _logger.User("This feature is not yet implemented: purge-backup"); } @@ -364,7 +365,8 @@ namespace RombaSharp /// /// Deletes DAT index entries for orphaned DATs /// - private static void PurgeDelete() + /// Only write out actions to log + private static void PurgeDelete(bool logOnly) { _logger.User("This feature is not yet implemented: purge-delete"); } diff --git a/RombaSharp/Partials/RombaSharp.Inits.cs b/RombaSharp/Partials/RombaSharp.Inits.cs index 7eb345ea..880682e9 100644 --- a/RombaSharp/Partials/RombaSharp.Inits.cs +++ b/RombaSharp/Partials/RombaSharp.Inits.cs @@ -275,6 +275,15 @@ namespace RombaSharp // NOTE: This might share code with InitMiss } + /// + /// Wrap importing CSVs into the database + /// + /// + private static void InitImport(List inputs) + { + _logger.User("This feature is not yet implemented: import"); + } + /// /// Wrap looking up if hashes exist in the database /// diff --git a/RombaSharp/RombaSharp.cs b/RombaSharp/RombaSharp.cs index 287afbfa..7e0bb99e 100644 --- a/RombaSharp/RombaSharp.cs +++ b/RombaSharp/RombaSharp.cs @@ -11,12 +11,17 @@ namespace RombaSharp /// /// Entry class for the RombaSharp application /// + /// + /// In the database, we want to enable "offline mode". That is, when a user does an operation + /// that needs to read from the depot themselves, if the depot folder cannot be found, the + /// user is prompted to reconnect the depot OR skip that depot entirely. + /// public partial class RombaSharp { // General settings - private static int _workers; //Number of parallel threads - private static string _logdir; //Log folder location - private static string _tmpdir; //Temp folder location + private static int _workers; // Number of parallel threads + private static string _logdir; // Log folder location + private static string _tmpdir; // Temp folder location private static string _webdir; // Web frontend location private static string _baddir; // Fail-to-unpack file folder location private static int _verbosity; // Verbosity of the output @@ -84,6 +89,7 @@ namespace RombaSharp dir2dat = false, export = false, fixdat = false, + import = false, lookup = false, memstats = false, merge = false, @@ -96,6 +102,7 @@ namespace RombaSharp // User flags bool copy = false, + logOnly = false, onlyNeeded = false; // User inputs @@ -146,6 +153,9 @@ namespace RombaSharp case "fixdat": fixdat = true; break; + case "import": + import = true; + break; case "lookup": lookup = true; break; @@ -176,8 +186,13 @@ namespace RombaSharp // User flags case "-copy": + case "--copy": copy = true; break; + case "-log-only": + case "--log-only": + logOnly = true; + break; case "-only-needed": case "--only-needed": onlyNeeded = true; @@ -240,7 +255,7 @@ namespace RombaSharp } // If more than one switch is enabled, show the help screen - if (!(archive ^ build ^ dbstats ^ depotRescan ^ diffdat ^ dir2dat ^ export ^ fixdat ^ lookup ^ + if (!(archive ^ build ^ dbstats ^ depotRescan ^ diffdat ^ dir2dat ^ export ^ fixdat ^ import ^ lookup ^ memstats ^ merge ^ miss ^ progress ^ purgeBackup ^ purgeDelete ^ refreshDats ^ shutdown)) { _logger.Error("Only one feature switch is allowed at a time"); @@ -250,7 +265,8 @@ namespace RombaSharp } // If a switch that requires a filename is set and no file is, show the help screen - if (inputs.Count == 0 && (archive || build || depotRescan || dir2dat || fixdat || lookup || merge || miss)) + if (inputs.Count == 0 && (archive || build || depotRescan || dir2dat || fixdat || + import || lookup || merge || miss)) { _logger.Error("This feature requires at least one input"); _help.OutputGenericHelp(); @@ -311,6 +327,12 @@ namespace RombaSharp InitFixdat(inputs); } + // Import a CSV into the database + else if (import) + { + InitImport(inputs); + } + // For each specified hash it looks up any available information else if (lookup) { @@ -344,13 +366,13 @@ namespace RombaSharp // Moves DAT index entries for orphaned DATs else if (purgeBackup) { - PurgeBackup(); + PurgeBackup(logOnly); } // Deletes DAT index entries for orphaned DATs else if (purgeDelete) { - PurgeDelete(); + PurgeDelete(logOnly); } // Refreshes the DAT index from the files in the DAT master directory tree