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);
|
||||
}
|
||||
|
||||
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
|
||||
// TODO: Remove usage
|
||||
@@ -201,6 +203,8 @@ have a current entry in the DAT index.";
|
||||
outDir: _depots.Keys.ToList()[0],
|
||||
outputFormat: OutputFormat.TorrentGzipRomba,
|
||||
asFiles: TreatAsFile.NonArchive);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,13 +447,14 @@ Possible values are: Verbose, User, Warning, Error");
|
||||
|
||||
#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();
|
||||
ScriptMode = GetBoolean(features, ScriptValue);
|
||||
|
||||
InitializeConfiguration();
|
||||
EnsureDatabase(_db, _connectionString);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -35,9 +35,11 @@ structure according to the original DAT master directory tree structure.";
|
||||
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
|
||||
bool copy = GetBoolean(features, CopyValue);
|
||||
@@ -74,6 +76,8 @@ structure according to the original DAT master directory tree structure.";
|
||||
outDir: outputFolder,
|
||||
outputFormat: copy ? OutputFormat.TorrentGzipRomba : OutputFormat.TorrentZip);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,11 @@ namespace RombaSharp.Features
|
||||
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 (Inputs == null || Inputs.Count == 0)
|
||||
@@ -41,6 +43,8 @@ namespace RombaSharp.Features
|
||||
baddumpCol: true,
|
||||
nodumpCol: true,
|
||||
StatReportFormat.Textfile);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ namespace RombaSharp.Features
|
||||
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);
|
||||
dbc.Open();
|
||||
@@ -51,6 +53,7 @@ namespace RombaSharp.Features
|
||||
|
||||
slc.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);
|
||||
}
|
||||
|
||||
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
|
||||
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))
|
||||
{
|
||||
logger.Error($"File '{olddat}' does not exist!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!File.Exists(newdat))
|
||||
{
|
||||
logger.Error($"File '{newdat}' does not exist!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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);
|
||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||
Writer.Write(intDat, outdat);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,11 @@ namespace RombaSharp.Features
|
||||
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
|
||||
string name = GetString(features, NameStringValue);
|
||||
@@ -49,7 +51,7 @@ namespace RombaSharp.Features
|
||||
if (!Directory.Exists(source))
|
||||
{
|
||||
logger.Error($"File '{source}' does not exist!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and write the encapsulating datfile
|
||||
@@ -58,6 +60,7 @@ namespace RombaSharp.Features
|
||||
datfile.Header.Description = description;
|
||||
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: Hash.Standard);
|
||||
Writer.Write(datfile, outdat);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@ namespace RombaSharp.Features
|
||||
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
|
||||
string olddat = GetString(features, OldStringValue);
|
||||
@@ -45,13 +47,13 @@ namespace RombaSharp.Features
|
||||
if (!File.Exists(olddat))
|
||||
{
|
||||
logger.Error($"File '{olddat}' does not exist!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!File.Exists(newdat))
|
||||
{
|
||||
logger.Error($"File '{newdat}' does not exist!");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the encapsulating datfile
|
||||
@@ -61,6 +63,7 @@ namespace RombaSharp.Features
|
||||
DatFile intDat = Parser.CreateAndParse(newdat);
|
||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||
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
|
||||
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);
|
||||
dbc.Open();
|
||||
@@ -69,6 +71,7 @@ namespace RombaSharp.Features
|
||||
slc.Dispose();
|
||||
sw.Dispose();
|
||||
dbc.Dispose();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
||||
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
|
||||
// Inputs
|
||||
@@ -38,6 +40,7 @@ namespace RombaSharp.Features
|
||||
string outdat = GetString(features, OutStringValue);
|
||||
|
||||
logger.Error("This feature is not yet implemented: fixdat");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,12 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
|
||||
// First ensure the inputs and database connection
|
||||
@@ -121,6 +124,7 @@ namespace RombaSharp.Features
|
||||
|
||||
slc.Dispose();
|
||||
dbc.Dispose();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
||||
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
|
||||
long size = GetInt64(features, SizeInt64Value);
|
||||
@@ -123,6 +125,7 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
dbc.Dispose();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
// 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
|
||||
bool onlyNeeded = GetBoolean(features, OnlyNeededValue);
|
||||
@@ -74,6 +76,8 @@ namespace RombaSharp.Features
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ namespace RombaSharp.Features
|
||||
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
|
||||
Dictionary<string, string> foundDats = GetValidDats(Inputs);
|
||||
@@ -47,6 +49,7 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
logger.Error("This feature is not yet implemented: miss");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,11 @@ structure. It also deletes the specified DATs from the DAT index.";
|
||||
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
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
logger.Error("This feature is not yet implemented: purge-delete");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ contents of any changed dats.";
|
||||
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
|
||||
int workers = GetInt32(features, WorkersInt32Value);
|
||||
@@ -139,6 +141,7 @@ contents of any changed dats.";
|
||||
}
|
||||
|
||||
dbc.Dispose();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,12 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
|
||||
foreach (string depotname in Inputs)
|
||||
@@ -41,14 +44,14 @@ namespace RombaSharp.Features
|
||||
if (!_depots.ContainsKey(depotname))
|
||||
{
|
||||
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
|
||||
if (!Directory.Exists(depotname))
|
||||
{
|
||||
logger.User($"'{depotname}' does not appear to be online. Please check its status and try again");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open the database connection
|
||||
@@ -165,6 +168,8 @@ WHERE sha1.sha1 IN ";
|
||||
slc.Dispose();
|
||||
dbc.Dispose();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,14 @@ namespace RombaSharp.Features
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,14 @@ namespace RombaSharp.Features
|
||||
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}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ namespace RombaSharp
|
||||
|
||||
// Now process the current feature
|
||||
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
||||
bool success = false;
|
||||
switch (featureName)
|
||||
{
|
||||
case DisplayHelpDetailed.Value:
|
||||
@@ -128,7 +129,7 @@ namespace RombaSharp
|
||||
case Miss.Value:
|
||||
case RescanDepots.Value:
|
||||
VerifyInputs(feature.Inputs, featureName);
|
||||
feature.ProcessFeatures(features);
|
||||
success = feature.ProcessFeatures(features);
|
||||
break;
|
||||
|
||||
// Requires no input verification
|
||||
@@ -145,7 +146,7 @@ namespace RombaSharp
|
||||
case RefreshDats.Value:
|
||||
case Shutdown.Value:
|
||||
case Features.Version.Value:
|
||||
feature.ProcessFeatures(features);
|
||||
success = feature.ProcessFeatures(features);
|
||||
break;
|
||||
|
||||
// If nothing is set, show the help
|
||||
@@ -154,6 +155,13 @@ namespace RombaSharp
|
||||
break;
|
||||
}
|
||||
|
||||
// If the feature failed, output help
|
||||
if (!success)
|
||||
{
|
||||
logger.Error("An error occurred during processing!");
|
||||
_help.OutputIndividualFeature(featureName);
|
||||
}
|
||||
|
||||
LoggerImpl.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,8 @@ namespace SabreTools.Help
|
||||
/// <summary>
|
||||
/// Process and extract variables based on current feature
|
||||
/// </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
|
||||
|
||||
|
||||
@@ -1853,7 +1853,7 @@ Some special strings that can be used:
|
||||
|
||||
#endregion
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override bool ProcessFeatures(Dictionary<string, Feature> features)
|
||||
{
|
||||
// Generic feature flags
|
||||
Cleaner = GetCleaner(features);
|
||||
@@ -1869,6 +1869,12 @@ Some special strings that can be used:
|
||||
// Set threading flag, if necessary
|
||||
if (features.ContainsKey(ThreadsInt32Value))
|
||||
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
|
||||
|
||||
// Failure conditions
|
||||
if (Header == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Protected Specific Extraction
|
||||
|
||||
@@ -51,9 +51,11 @@ Reset the internal state: reset();";
|
||||
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
|
||||
foreach (string path in Inputs)
|
||||
@@ -62,6 +64,8 @@ Reset the internal state: reset();";
|
||||
ProcessScript(path);
|
||||
watch.Stop();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -53,9 +53,11 @@ namespace SabreTools.Features
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,9 +39,11 @@ The following systems have headers that this program can work with:
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,9 +58,11 @@ namespace SabreTools.Features
|
||||
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
|
||||
TreatAsFile asFiles = GetTreatAsFiles(features);
|
||||
@@ -161,6 +163,8 @@ namespace SabreTools.Features
|
||||
Writer.Write(datdata, OutputDir);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,19 @@ namespace SabreTools.Features
|
||||
AddFeature(TypeFlag);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
SplittingMode splittingMode = GetSplittingMode(features);
|
||||
// If the base fails, just fail out
|
||||
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)
|
||||
return;
|
||||
{
|
||||
logger.Error("No valid splitting mode found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get only files from the inputs
|
||||
List<ParentablePath> files = PathTool.GetFilesOnly(Inputs, appendparent: true);
|
||||
@@ -155,6 +160,8 @@ namespace SabreTools.Features
|
||||
watch.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,11 @@ The stats that are outputted are as follows:
|
||||
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;
|
||||
if (Path.GetFileName(filename) != filename)
|
||||
@@ -66,6 +68,8 @@ The stats that are outputted are as follows:
|
||||
GetBoolean(features, BaddumpColumnValue),
|
||||
GetBoolean(features, NodumpColumnValue),
|
||||
GetStatReportFormat(features));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,11 @@ namespace SabreTools.Features
|
||||
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
|
||||
var updateDatItemFields = GetUpdateDatItemFields(features);
|
||||
@@ -171,7 +173,7 @@ namespace SabreTools.Features
|
||||
Writer.Write(datFile, realOutDir, overwrite: GetBoolean(features, InplaceValue));
|
||||
});
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reverse inputs if we're in a required mode
|
||||
@@ -346,6 +348,8 @@ namespace SabreTools.Features
|
||||
|
||||
Writer.Write(userInputDat, OutputDir);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,11 @@ namespace SabreTools.Features
|
||||
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
|
||||
var datfiles = GetList(features, DatListValue);
|
||||
@@ -148,6 +150,8 @@ namespace SabreTools.Features
|
||||
Writer.WriteStatsToConsole(datdata);
|
||||
Writer.Write(datdata, OutputDir);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ namespace SabreTools
|
||||
|
||||
// Now process the current feature
|
||||
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
||||
bool success = false;
|
||||
switch (featureName)
|
||||
{
|
||||
// No-op as these should be caught
|
||||
@@ -127,12 +128,12 @@ namespace SabreTools
|
||||
case Update.Value:
|
||||
case Verify.Value:
|
||||
VerifyInputs(feature.Inputs, feature);
|
||||
feature.ProcessFeatures(features);
|
||||
success = feature.ProcessFeatures(features);
|
||||
break;
|
||||
|
||||
// Requires no input verification
|
||||
case Sort.Value:
|
||||
feature.ProcessFeatures(features);
|
||||
success = feature.ProcessFeatures(features);
|
||||
break;
|
||||
|
||||
// If nothing is set, show the help
|
||||
@@ -141,6 +142,13 @@ namespace SabreTools
|
||||
break;
|
||||
}
|
||||
|
||||
// If the feature failed, output help
|
||||
if (!success)
|
||||
{
|
||||
logger.Error("An error occurred during processing!");
|
||||
_help.OutputIndividualFeature(featureName);
|
||||
}
|
||||
|
||||
LoggerImpl.Close();
|
||||
return;
|
||||
}
|
||||
@@ -193,13 +201,6 @@ namespace SabreTools
|
||||
_help.OutputIndividualFeature(feature.Name);
|
||||
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