mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[RombaSharp] Add skeletons for more functionality
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -356,7 +356,8 @@ namespace RombaSharp
|
||||
/// <summary>
|
||||
/// Moves DAT index entries for orphaned DATs to backup folder
|
||||
/// </summary>
|
||||
private static void PurgeBackup()
|
||||
/// <param name="logOnly">Only write out actions to log</param>
|
||||
private static void PurgeBackup(bool logOnly)
|
||||
{
|
||||
_logger.User("This feature is not yet implemented: purge-backup");
|
||||
}
|
||||
@@ -364,7 +365,8 @@ namespace RombaSharp
|
||||
/// <summary>
|
||||
/// Deletes DAT index entries for orphaned DATs
|
||||
/// </summary>
|
||||
private static void PurgeDelete()
|
||||
/// <param name="logOnly">Only write out actions to log</param>
|
||||
private static void PurgeDelete(bool logOnly)
|
||||
{
|
||||
_logger.User("This feature is not yet implemented: purge-delete");
|
||||
}
|
||||
|
||||
@@ -275,6 +275,15 @@ namespace RombaSharp
|
||||
// NOTE: This might share code with InitMiss
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrap importing CSVs into the database
|
||||
/// </summary>
|
||||
/// <param name="inputs"></param>
|
||||
private static void InitImport(List<string> inputs)
|
||||
{
|
||||
_logger.User("This feature is not yet implemented: import");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrap looking up if hashes exist in the database
|
||||
/// </summary>
|
||||
|
||||
@@ -11,12 +11,17 @@ namespace RombaSharp
|
||||
/// <summary>
|
||||
/// Entry class for the RombaSharp application
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user