mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make top-level features return bool
This commit is contained in:
@@ -45,9 +45,11 @@ have a current entry in the DAT index.";
|
|||||||
AddFeature(NoDbFlag);
|
AddFeature(NoDbFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get the archive scanning level
|
// Get the archive scanning level
|
||||||
// TODO: Remove usage
|
// TODO: Remove usage
|
||||||
@@ -201,6 +203,8 @@ have a current entry in the DAT index.";
|
|||||||
outDir: _depots.Keys.ToList()[0],
|
outDir: _depots.Keys.ToList()[0],
|
||||||
outputFormat: OutputFormat.TorrentGzipRomba,
|
outputFormat: OutputFormat.TorrentGzipRomba,
|
||||||
asFiles: TreatAsFile.NonArchive);
|
asFiles: TreatAsFile.NonArchive);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,13 +447,14 @@ Possible values are: Verbose, User, Warning, Error");
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
||||||
{
|
{
|
||||||
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
|
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
|
||||||
ScriptMode = GetBoolean(features, ScriptValue);
|
ScriptMode = GetBoolean(features, ScriptValue);
|
||||||
|
|
||||||
InitializeConfiguration();
|
InitializeConfiguration();
|
||||||
EnsureDatabase(_db, _connectionString);
|
EnsureDatabase(_db, _connectionString);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ structure according to the original DAT master directory tree structure.";
|
|||||||
AddFeature(SubworkersInt32Input);
|
AddFeature(SubworkersInt32Input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool copy = GetBoolean(features, CopyValue);
|
bool copy = GetBoolean(features, CopyValue);
|
||||||
@@ -74,6 +76,8 @@ structure according to the original DAT master directory tree structure.";
|
|||||||
outDir: outputFolder,
|
outDir: outputFolder,
|
||||||
outputFormat: copy ? OutputFormat.TorrentGzipRomba : OutputFormat.TorrentZip);
|
outputFormat: copy ? OutputFormat.TorrentGzipRomba : OutputFormat.TorrentZip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.User("This feature is not yet implemented: cancel");
|
logger.User("This feature is not yet implemented: cancel");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// If we have no inputs listed, we want to use datroot
|
// If we have no inputs listed, we want to use datroot
|
||||||
if (Inputs == null || Inputs.Count == 0)
|
if (Inputs == null || Inputs.Count == 0)
|
||||||
@@ -41,6 +43,8 @@ namespace RombaSharp.Features
|
|||||||
baddumpCol: true,
|
baddumpCol: true,
|
||||||
nodumpCol: true,
|
nodumpCol: true,
|
||||||
StatReportFormat.Textfile);
|
StatReportFormat.Textfile);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
SqliteConnection dbc = new SqliteConnection(_connectionString);
|
SqliteConnection dbc = new SqliteConnection(_connectionString);
|
||||||
dbc.Open();
|
dbc.Open();
|
||||||
@@ -51,6 +53,7 @@ namespace RombaSharp.Features
|
|||||||
|
|
||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,11 @@ in -old DAT file. Ignores those entries in -old that are not in -new.";
|
|||||||
AddFeature(DescriptionStringInput);
|
AddFeature(DescriptionStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
string name = GetString(features, NameStringValue);
|
string name = GetString(features, NameStringValue);
|
||||||
@@ -50,13 +52,13 @@ in -old DAT file. Ignores those entries in -old that are not in -new.";
|
|||||||
if (!File.Exists(olddat))
|
if (!File.Exists(olddat))
|
||||||
{
|
{
|
||||||
logger.Error($"File '{olddat}' does not exist!");
|
logger.Error($"File '{olddat}' does not exist!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(newdat))
|
if (!File.Exists(newdat))
|
||||||
{
|
{
|
||||||
logger.Error($"File '{newdat}' does not exist!");
|
logger.Error($"File '{newdat}' does not exist!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the encapsulating datfile
|
// Create the encapsulating datfile
|
||||||
@@ -69,6 +71,7 @@ in -old DAT file. Ignores those entries in -old that are not in -new.";
|
|||||||
DatFile intDat = Parser.CreateAndParse(newdat);
|
DatFile intDat = Parser.CreateAndParse(newdat);
|
||||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||||
Writer.Write(intDat, outdat);
|
Writer.Write(intDat, outdat);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,11 @@ namespace RombaSharp.Features
|
|||||||
AddFeature(DescriptionStringInput);
|
AddFeature(DescriptionStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
string name = GetString(features, NameStringValue);
|
string name = GetString(features, NameStringValue);
|
||||||
@@ -49,7 +51,7 @@ namespace RombaSharp.Features
|
|||||||
if (!Directory.Exists(source))
|
if (!Directory.Exists(source))
|
||||||
{
|
{
|
||||||
logger.Error($"File '{source}' does not exist!");
|
logger.Error($"File '{source}' does not exist!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and write the encapsulating datfile
|
// Create and write the encapsulating datfile
|
||||||
@@ -58,6 +60,7 @@ namespace RombaSharp.Features
|
|||||||
datfile.Header.Description = description;
|
datfile.Header.Description = description;
|
||||||
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||||
Writer.Write(datfile, outdat);
|
Writer.Write(datfile, outdat);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ namespace RombaSharp.Features
|
|||||||
AddFeature(NewStringInput);
|
AddFeature(NewStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
string olddat = GetString(features, OldStringValue);
|
string olddat = GetString(features, OldStringValue);
|
||||||
@@ -45,13 +47,13 @@ namespace RombaSharp.Features
|
|||||||
if (!File.Exists(olddat))
|
if (!File.Exists(olddat))
|
||||||
{
|
{
|
||||||
logger.Error($"File '{olddat}' does not exist!");
|
logger.Error($"File '{olddat}' does not exist!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(newdat))
|
if (!File.Exists(newdat))
|
||||||
{
|
{
|
||||||
logger.Error($"File '{newdat}' does not exist!");
|
logger.Error($"File '{newdat}' does not exist!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the encapsulating datfile
|
// Create the encapsulating datfile
|
||||||
@@ -61,6 +63,7 @@ namespace RombaSharp.Features
|
|||||||
DatFile intDat = Parser.CreateAndParse(newdat);
|
DatFile intDat = Parser.CreateAndParse(newdat);
|
||||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||||
Writer.Write(intDat, outdat);
|
Writer.Write(intDat, outdat);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ namespace RombaSharp.Features
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add ability to say which depot the files are found in
|
// TODO: Add ability to say which depot the files are found in
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
SqliteConnection dbc = new SqliteConnection(_connectionString);
|
SqliteConnection dbc = new SqliteConnection(_connectionString);
|
||||||
dbc.Open();
|
dbc.Open();
|
||||||
@@ -69,6 +71,7 @@ namespace RombaSharp.Features
|
|||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
|||||||
AddFeature(SubworkersInt32Input);
|
AddFeature(SubworkersInt32Input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
// Inputs
|
// Inputs
|
||||||
@@ -38,6 +40,7 @@ namespace RombaSharp.Features
|
|||||||
string outdat = GetString(features, OutStringValue);
|
string outdat = GetString(features, OutStringValue);
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: fixdat");
|
logger.Error("This feature is not yet implemented: fixdat");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,12 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: import");
|
logger.Error("This feature is not yet implemented: import");
|
||||||
|
|
||||||
// First ensure the inputs and database connection
|
// First ensure the inputs and database connection
|
||||||
@@ -121,6 +124,7 @@ namespace RombaSharp.Features
|
|||||||
|
|
||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
|||||||
AddFeature(OutStringInput);
|
AddFeature(OutStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
long size = GetInt64(features, SizeInt64Value);
|
long size = GetInt64(features, SizeInt64Value);
|
||||||
@@ -123,6 +125,7 @@ namespace RombaSharp.Features
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.User("This feature is not yet implemented: memstats");
|
logger.User("This feature is not yet implemented: memstats");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,11 @@ namespace RombaSharp.Features
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add way of specifying "current depot" since that's what Romba relies on
|
// TODO: Add way of specifying "current depot" since that's what Romba relies on
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool onlyNeeded = GetBoolean(features, OnlyNeededValue);
|
bool onlyNeeded = GetBoolean(features, OnlyNeededValue);
|
||||||
@@ -74,6 +76,8 @@ namespace RombaSharp.Features
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Verify the filenames
|
// Verify the filenames
|
||||||
Dictionary<string, string> foundDats = GetValidDats(Inputs);
|
Dictionary<string, string> foundDats = GetValidDats(Inputs);
|
||||||
@@ -47,6 +49,7 @@ namespace RombaSharp.Features
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: miss");
|
logger.Error("This feature is not yet implemented: miss");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.User("This feature is not yet implemented: progress");
|
logger.User("This feature is not yet implemented: progress");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ structure. It also deletes the specified DATs from the DAT index.";
|
|||||||
AddFeature(LogOnlyFlag);
|
AddFeature(LogOnlyFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool logOnly = GetBoolean(features, LogOnlyValue);
|
bool logOnly = GetBoolean(features, LogOnlyValue);
|
||||||
@@ -43,6 +45,7 @@ structure. It also deletes the specified DATs from the DAT index.";
|
|||||||
List<string> depot = GetList(features, DepotListStringValue);
|
List<string> depot = GetList(features, DepotListStringValue);
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: purge-backup");
|
logger.Error("This feature is not yet implemented: purge-backup");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ structure. It also deletes the specified DATs from the DAT index.";
|
|||||||
AddFeature(LogOnlyFlag);
|
AddFeature(LogOnlyFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool logOnly = GetBoolean(features, LogOnlyValue);
|
bool logOnly = GetBoolean(features, LogOnlyValue);
|
||||||
@@ -42,6 +44,7 @@ structure. It also deletes the specified DATs from the DAT index.";
|
|||||||
List<string> depot = GetList(features, DepotListStringValue);
|
List<string> depot = GetList(features, DepotListStringValue);
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: purge-delete");
|
logger.Error("This feature is not yet implemented: purge-delete");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,11 @@ contents of any changed dats.";
|
|||||||
AddFeature(MissingSha1sStringInput);
|
AddFeature(MissingSha1sStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
int workers = GetInt32(features, WorkersInt32Value);
|
int workers = GetInt32(features, WorkersInt32Value);
|
||||||
@@ -139,6 +141,7 @@ contents of any changed dats.";
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,12 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.Error("This feature is not yet implemented: rescan-depots");
|
logger.Error("This feature is not yet implemented: rescan-depots");
|
||||||
|
|
||||||
foreach (string depotname in Inputs)
|
foreach (string depotname in Inputs)
|
||||||
@@ -41,14 +44,14 @@ namespace RombaSharp.Features
|
|||||||
if (!_depots.ContainsKey(depotname))
|
if (!_depots.ContainsKey(depotname))
|
||||||
{
|
{
|
||||||
logger.User($"'{depotname}' is not a recognized depot. Please add it to your configuration file and try again");
|
logger.User($"'{depotname}' is not a recognized depot. Please add it to your configuration file and try again");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then check that the depot is online
|
// Then check that the depot is online
|
||||||
if (!Directory.Exists(depotname))
|
if (!Directory.Exists(depotname))
|
||||||
{
|
{
|
||||||
logger.User($"'{depotname}' does not appear to be online. Please check its status and try again");
|
logger.User($"'{depotname}' does not appear to be online. Please check its status and try again");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the database connection
|
// Open the database connection
|
||||||
@@ -165,6 +168,8 @@ WHERE sha1.sha1 IN ";
|
|||||||
slc.Dispose();
|
slc.Dispose();
|
||||||
dbc.Dispose();
|
dbc.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.User("This feature is not yet implemented: shutdown");
|
logger.User("This feature is not yet implemented: shutdown");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ namespace RombaSharp.Features
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
logger.User($"RombaSharp version: {Prepare.Version}");
|
logger.User($"RombaSharp version: {Prepare.Version}");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ namespace RombaSharp
|
|||||||
|
|
||||||
// Now process the current feature
|
// Now process the current feature
|
||||||
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
||||||
|
bool success = false;
|
||||||
switch (featureName)
|
switch (featureName)
|
||||||
{
|
{
|
||||||
case DisplayHelpDetailed.Value:
|
case DisplayHelpDetailed.Value:
|
||||||
@@ -128,7 +129,7 @@ namespace RombaSharp
|
|||||||
case Miss.Value:
|
case Miss.Value:
|
||||||
case RescanDepots.Value:
|
case RescanDepots.Value:
|
||||||
VerifyInputs(feature.Inputs, featureName);
|
VerifyInputs(feature.Inputs, featureName);
|
||||||
feature.ProcessFeatures(features);
|
success = feature.ProcessFeatures(features);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Requires no input verification
|
// Requires no input verification
|
||||||
@@ -145,7 +146,7 @@ namespace RombaSharp
|
|||||||
case RefreshDats.Value:
|
case RefreshDats.Value:
|
||||||
case Shutdown.Value:
|
case Shutdown.Value:
|
||||||
case Features.Version.Value:
|
case Features.Version.Value:
|
||||||
feature.ProcessFeatures(features);
|
success = feature.ProcessFeatures(features);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// If nothing is set, show the help
|
// If nothing is set, show the help
|
||||||
@@ -154,6 +155,13 @@ namespace RombaSharp
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the feature failed, output help
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
logger.Error("An error occurred during processing!");
|
||||||
|
_help.OutputIndividualFeature(featureName);
|
||||||
|
}
|
||||||
|
|
||||||
LoggerImpl.Close();
|
LoggerImpl.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ namespace SabreTools.Help
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process and extract variables based on current feature
|
/// Process and extract variables based on current feature
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void ProcessFeatures(Dictionary<string, Feature> features) { }
|
/// <returns>True if execution was successful, false otherwise</returns>
|
||||||
|
public virtual bool ProcessFeatures(Dictionary<string, Feature> features) => true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -1853,7 +1853,7 @@ Some special strings that can be used:
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
// Generic feature flags
|
// Generic feature flags
|
||||||
Cleaner = GetCleaner(features);
|
Cleaner = GetCleaner(features);
|
||||||
@@ -1869,6 +1869,12 @@ Some special strings that can be used:
|
|||||||
// Set threading flag, if necessary
|
// Set threading flag, if necessary
|
||||||
if (features.ContainsKey(ThreadsInt32Value))
|
if (features.ContainsKey(ThreadsInt32Value))
|
||||||
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
||||||
|
|
||||||
|
// Failure conditions
|
||||||
|
if (Header == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Protected Specific Extraction
|
#region Protected Specific Extraction
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ Reset the internal state: reset();";
|
|||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Try to read each input as a batch run file
|
// Try to read each input as a batch run file
|
||||||
foreach (string path in Inputs)
|
foreach (string path in Inputs)
|
||||||
@@ -62,6 +64,8 @@ Reset the internal state: reset();";
|
|||||||
ProcessScript(path);
|
ProcessScript(path);
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -53,9 +53,11 @@ namespace SabreTools.Features
|
|||||||
AddFeature(OutputDirStringInput);
|
AddFeature(OutputDirStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool addBlankFiles = GetBoolean(features, AddBlankFilesValue);
|
bool addBlankFiles = GetBoolean(features, AddBlankFilesValue);
|
||||||
@@ -113,6 +115,8 @@ namespace SabreTools.Features
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,11 @@ The following systems have headers that this program can work with:
|
|||||||
AddFeature(NoStoreHeaderFlag);
|
AddFeature(NoStoreHeaderFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
bool nostore = GetBoolean(features, NoStoreHeaderValue);
|
bool nostore = GetBoolean(features, NoStoreHeaderValue);
|
||||||
@@ -54,6 +56,8 @@ The following systems have headers that this program can work with:
|
|||||||
{
|
{
|
||||||
DetectTransformStore(file.CurrentPath, OutputDir, nostore);
|
DetectTransformStore(file.CurrentPath, OutputDir, nostore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ The following systems have headers that this program can work with:
|
|||||||
AddFeature(OutputDirStringInput);
|
AddFeature(OutputDirStringInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get only files from the inputs
|
// Get only files from the inputs
|
||||||
List<ParentablePath> files = PathTool.GetFilesOnly(Inputs);
|
List<ParentablePath> files = PathTool.GetFilesOnly(Inputs);
|
||||||
@@ -49,6 +51,8 @@ The following systems have headers that this program can work with:
|
|||||||
{
|
{
|
||||||
RestoreHeader(file.CurrentPath, OutputDir);
|
RestoreHeader(file.CurrentPath, OutputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -58,9 +58,11 @@ namespace SabreTools.Features
|
|||||||
AddFeature(UpdateDatFlag);
|
AddFeature(UpdateDatFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
TreatAsFile asFiles = GetTreatAsFiles(features);
|
TreatAsFile asFiles = GetTreatAsFiles(features);
|
||||||
@@ -161,6 +163,8 @@ namespace SabreTools.Features
|
|||||||
Writer.Write(datdata, OutputDir);
|
Writer.Write(datdata, OutputDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,14 +44,19 @@ namespace SabreTools.Features
|
|||||||
AddFeature(TypeFlag);
|
AddFeature(TypeFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
SplittingMode splittingMode = GetSplittingMode(features);
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// If we somehow have the "none" split type, return
|
// Get the splitting mode
|
||||||
|
SplittingMode splittingMode = GetSplittingMode(features);
|
||||||
if (splittingMode == SplittingMode.None)
|
if (splittingMode == SplittingMode.None)
|
||||||
return;
|
{
|
||||||
|
logger.Error("No valid splitting mode found!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Get only files from the inputs
|
// Get only files from the inputs
|
||||||
List<ParentablePath> files = PathTool.GetFilesOnly(Inputs, appendparent: true);
|
List<ParentablePath> files = PathTool.GetFilesOnly(Inputs, appendparent: true);
|
||||||
@@ -155,6 +160,8 @@ namespace SabreTools.Features
|
|||||||
watch.Stop();
|
watch.Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ The stats that are outputted are as follows:
|
|||||||
AddFeature(IndividualFlag);
|
AddFeature(IndividualFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
string filename = Header.FileName;
|
string filename = Header.FileName;
|
||||||
if (Path.GetFileName(filename) != filename)
|
if (Path.GetFileName(filename) != filename)
|
||||||
@@ -66,6 +68,8 @@ The stats that are outputted are as follows:
|
|||||||
GetBoolean(features, BaddumpColumnValue),
|
GetBoolean(features, BaddumpColumnValue),
|
||||||
GetBoolean(features, NodumpColumnValue),
|
GetBoolean(features, NodumpColumnValue),
|
||||||
GetStatReportFormat(features));
|
GetStatReportFormat(features));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,9 +84,11 @@ namespace SabreTools.Features
|
|||||||
AddFeature(InplaceFlag);
|
AddFeature(InplaceFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
var updateDatItemFields = GetUpdateDatItemFields(features);
|
var updateDatItemFields = GetUpdateDatItemFields(features);
|
||||||
@@ -171,7 +173,7 @@ namespace SabreTools.Features
|
|||||||
Writer.Write(datFile, realOutDir, overwrite: GetBoolean(features, InplaceValue));
|
Writer.Write(datFile, realOutDir, overwrite: GetBoolean(features, InplaceValue));
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse inputs if we're in a required mode
|
// Reverse inputs if we're in a required mode
|
||||||
@@ -346,6 +348,8 @@ namespace SabreTools.Features
|
|||||||
|
|
||||||
Writer.Write(userInputDat, OutputDir);
|
Writer.Write(userInputDat, OutputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,11 @@ namespace SabreTools.Features
|
|||||||
AddFilteringFeatures();
|
AddFilteringFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||||
{
|
{
|
||||||
base.ProcessFeatures(features);
|
// If the base fails, just fail out
|
||||||
|
if (!base.ProcessFeatures(features))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
var datfiles = GetList(features, DatListValue);
|
var datfiles = GetList(features, DatListValue);
|
||||||
@@ -148,6 +150,8 @@ namespace SabreTools.Features
|
|||||||
Writer.WriteStatsToConsole(datdata);
|
Writer.WriteStatsToConsole(datdata);
|
||||||
Writer.Write(datdata, OutputDir);
|
Writer.Write(datdata, OutputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
// Now process the current feature
|
// Now process the current feature
|
||||||
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
||||||
|
bool success = false;
|
||||||
switch (featureName)
|
switch (featureName)
|
||||||
{
|
{
|
||||||
// No-op as these should be caught
|
// No-op as these should be caught
|
||||||
@@ -127,12 +128,12 @@ namespace SabreTools
|
|||||||
case Update.Value:
|
case Update.Value:
|
||||||
case Verify.Value:
|
case Verify.Value:
|
||||||
VerifyInputs(feature.Inputs, feature);
|
VerifyInputs(feature.Inputs, feature);
|
||||||
feature.ProcessFeatures(features);
|
success = feature.ProcessFeatures(features);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Requires no input verification
|
// Requires no input verification
|
||||||
case Sort.Value:
|
case Sort.Value:
|
||||||
feature.ProcessFeatures(features);
|
success = feature.ProcessFeatures(features);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// If nothing is set, show the help
|
// If nothing is set, show the help
|
||||||
@@ -141,6 +142,13 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the feature failed, output help
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
logger.Error("An error occurred during processing!");
|
||||||
|
_help.OutputIndividualFeature(featureName);
|
||||||
|
}
|
||||||
|
|
||||||
LoggerImpl.Close();
|
LoggerImpl.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -193,13 +201,6 @@ namespace SabreTools
|
|||||||
_help.OutputIndividualFeature(feature.Name);
|
_help.OutputIndividualFeature(feature.Name);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feature.Header == null)
|
|
||||||
{
|
|
||||||
logger.Error("Please check for errors in parameters");
|
|
||||||
_help.OutputIndividualFeature(feature.Name);
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user