mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Better universal options, fix last commit
This commit is contained in:
@@ -95,9 +95,9 @@ of other features. The following descriptions are based on what WILL be done
|
||||
with each flag. Not all features are currently available.
|
||||
|
||||
Usage:
|
||||
RombaSharp.exe [options] [filename|dirname] ...
|
||||
RombaSharp.exe [feature] [options] [filename|dirname] ...
|
||||
|
||||
Options:
|
||||
Features and Options:
|
||||
-?, -h, --help Show the built-in help text
|
||||
Built-in to most of the programs is a basic help text
|
||||
|
||||
@@ -159,21 +159,33 @@ For any command below that includes a `field` of any sort, the name are standard
|
||||
the format will be `item.name`
|
||||
|
||||
Usage:
|
||||
SabreTools.exe [options] [filename|dirname] ...
|
||||
SabreTools.exe [feature] [options] [filename|dirname] ...
|
||||
|
||||
Options:
|
||||
Universal Options:
|
||||
These parameters can be enabled on any feature except Detailed Help and Help
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-sc, --script Enable script mode (no clear screen)
|
||||
For times when SabreTools is being used in a scripted environment, the
|
||||
user may not want the screen to be cleared every time that it is called.
|
||||
This flag allows the user to skip clearing the screen on run just like if
|
||||
the console was being redirected.
|
||||
|
||||
-mt=, --threads= Amount of threads to use (default = # cores)
|
||||
Optionally, set the number of threads to use for the multithreaded
|
||||
operations. The default is the number of available machine threads;
|
||||
-1 means unlimited threads created.
|
||||
|
||||
Features and Options:
|
||||
-?, -h, --help Show this help
|
||||
Built-in to most of the programs is a basic help text.
|
||||
|
||||
-??, -hd, --help-detailed Show this detailed help
|
||||
Display a detailed help text to the screen.
|
||||
|
||||
--script Enable script mode (no clear screen)
|
||||
For times when SabreTools is being used in a scripted environment, the
|
||||
user may not want the screen to be cleared every time that it is called.
|
||||
This flag allows the user to skip clearing the screen on run just like if
|
||||
the console was being redirected.
|
||||
|
||||
-bt, --batch Enable batch mode
|
||||
Run a special mode that takes input files as lists of batch commands to
|
||||
run sequentially. Each command has to be its own line and must be followed
|
||||
@@ -205,10 +217,6 @@ Options:
|
||||
date. It will also treat all archives as possible games and add all three
|
||||
hashes (CRC, MD5, SHA-1) for each file.
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-nm, --skip-md5 Don't include MD5 in output
|
||||
This allows the user to skip calculating the MD5 for each of the
|
||||
files which will speed up the creation of the DAT.
|
||||
@@ -419,11 +427,6 @@ Options:
|
||||
This sets an output folder to be used when the files are created. If
|
||||
a path is not defined, the runtime directory is used instead.
|
||||
|
||||
-mt=, --threads= Amount of threads to use (default = # cores)
|
||||
Optionally, set the number of threads to use for the multithreaded
|
||||
operations. The default is the number of available machine threads;
|
||||
-1 means unlimited threads created.
|
||||
|
||||
-ex, --extract Extract and remove copier headers
|
||||
This will detect, store, and remove copier headers from a file or folder
|
||||
of files. The headers are backed up and collated by the hash of the
|
||||
@@ -441,10 +444,6 @@ Options:
|
||||
- Nintendo Super Famicom / Super Nintendo Entertainment System
|
||||
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-out=, --output-dir= Set output directory
|
||||
This sets an output folder to be used when the files are created. If
|
||||
a path is not defined, the runtime directory is used instead.
|
||||
@@ -471,10 +470,6 @@ Options:
|
||||
- Nintendo Super Famicom / Super Nintendo Entertainment System
|
||||
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-out=, --output-dir= Set output directory
|
||||
This sets an output folder to be used when the files are created. If
|
||||
a path is not defined, the runtime directory is used instead.
|
||||
@@ -484,10 +479,6 @@ Options:
|
||||
file(s). By default all files will be rebuilt to uncompressed folders in
|
||||
the output directory.
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-dat=, --dat= Input DAT to be used
|
||||
User-supplied DAT for use in all operations. Multiple instances of
|
||||
this flag are allowed.
|
||||
@@ -616,20 +607,11 @@ Options:
|
||||
the files that could not be matched will be output to the output
|
||||
directory.
|
||||
|
||||
-mt=, --threads= Amount of threads to use (default = # cores)
|
||||
Optionally, set the number of threads to use for the multithreaded
|
||||
operations. The default is the number of available machine threads;
|
||||
-1 means unlimited threads created.
|
||||
|
||||
-sp, --split Split input DATs by a given criteria
|
||||
This feature allows the user to split input DATs by a number of different
|
||||
possible criteria. See the individual input information for details. More
|
||||
than one split type is allowed at a time.
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-ot=, --output-type= Output DATs to a specified format
|
||||
Add outputting the created DAT to known format. Multiple instances of
|
||||
this flag are allowed.
|
||||
@@ -747,10 +729,6 @@ Options:
|
||||
- Items that include a SHA-512
|
||||
- Items with Nodump status
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-srt=, --report-type= Output statistics to a specified format
|
||||
Add outputting the created DAT to known format. Multiple instances of
|
||||
this flag are allowed.
|
||||
@@ -788,10 +766,6 @@ Options:
|
||||
different programs that performed DAT manipulation that work better
|
||||
together.
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-ot=, --output-type= Output DATs to a specified format
|
||||
Add outputting the created DAT to known format. Multiple instances of
|
||||
this flag are allowed.
|
||||
@@ -1174,11 +1148,6 @@ Options:
|
||||
directory, if set). This flag enables users to write out to the
|
||||
directory that the DATs originated from.
|
||||
|
||||
-mt=, --threads= Amount of threads to use (default = # cores)
|
||||
Optionally, set the number of threads to use for the multithreaded
|
||||
operations. The default is the number of available machine threads;
|
||||
-1 means unlimited threads created.
|
||||
|
||||
-ve, --verify Verify a folder against DATs
|
||||
When used, this will use an input DAT or set of DATs to blindly check
|
||||
against an input folder. The base of the folder is considered the base
|
||||
@@ -1186,10 +1155,6 @@ Options:
|
||||
within. This will only do a direct verification of the items within and
|
||||
will create a fixdat afterwards for missing files.
|
||||
|
||||
-ll=, --log-level= Set the lowest log level for output
|
||||
Set the lowest log level for output.
|
||||
Possible values are: Verbose, User, Warning, Error
|
||||
|
||||
-dat=, --dat= Input DAT to be used
|
||||
User-supplied DAT for use in all operations. Multiple instances of
|
||||
this flag are allowed.
|
||||
|
||||
@@ -956,7 +956,7 @@ namespace SabreTools.Core.Tools
|
||||
/// <returns>LogLevel value corresponding to the string</returns>
|
||||
public static LogLevel AsLogLevel(this string logLevel)
|
||||
{
|
||||
return logLevel.ToLowerInvariant() switch
|
||||
return logLevel?.ToLowerInvariant() switch
|
||||
{
|
||||
"verbose" => LogLevel.VERBOSE,
|
||||
"user" => LogLevel.USER,
|
||||
|
||||
@@ -828,6 +828,20 @@ namespace SabreTools.Features
|
||||
}
|
||||
}
|
||||
|
||||
internal const string ScriptValue = "script";
|
||||
internal static Feature ScriptFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
ScriptValue,
|
||||
new List<string>() { "-sc", "--script" },
|
||||
"Enable script mode (no clear screen)",
|
||||
ParameterType.Flag,
|
||||
"For times when SabreTools is being used in a scripted environment, the user may not want the screen to be cleared every time that it is called. This flag allows the user to skip clearing the screen on run just like if the console was being redirected.");
|
||||
}
|
||||
}
|
||||
|
||||
internal const string ShortValue = "short";
|
||||
internal static Feature ShortFlag
|
||||
{
|
||||
@@ -1765,6 +1779,11 @@ Some special strings that can be used:
|
||||
/// </summary>
|
||||
protected Remover Remover { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if scripting mode is enabled
|
||||
/// </summary>
|
||||
public bool ScriptMode { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pre-configured Splitter
|
||||
/// </summary>
|
||||
@@ -1774,6 +1793,16 @@ Some special strings that can be used:
|
||||
|
||||
#region Add Feature Groups
|
||||
|
||||
/// <summary>
|
||||
/// Add common features
|
||||
/// </summary>
|
||||
protected void AddCommonFeatures()
|
||||
{
|
||||
AddFeature(ScriptFlag);
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddFeature(ThreadsInt32Input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add Filter-specific features
|
||||
/// </summary>
|
||||
@@ -1839,6 +1868,7 @@ Some special strings that can be used:
|
||||
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
|
||||
OutputDir = GetString(features, OutputDirStringValue).Trim('"');
|
||||
Remover = GetRemover(features);
|
||||
ScriptMode = GetBoolean(features, ScriptValue);
|
||||
Splitter = GetSplitter(features);
|
||||
|
||||
// Set threading flag, if necessary
|
||||
|
||||
@@ -46,7 +46,7 @@ Reset the internal state: reset();";
|
||||
Features = new Dictionary<string, Help.Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace SabreTools.Features
|
||||
Features = new Dictionary<string, Help.Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
|
||||
// Hash Features
|
||||
AddFeature(SkipMd5Flag);
|
||||
@@ -50,7 +50,6 @@ namespace SabreTools.Features
|
||||
AddFeature(ExtraIniListInput);
|
||||
AddFilteringFeatures();
|
||||
AddFeature(OutputDirStringInput);
|
||||
AddFeature(ThreadsInt32Input);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||
|
||||
@@ -35,7 +35,7 @@ The following systems have headers that this program can work with:
|
||||
Features = new Dictionary<string, Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(OutputDirStringInput);
|
||||
AddFeature(NoStoreHeaderFlag);
|
||||
|
||||
@@ -33,6 +33,9 @@ The following systems have headers that this program can work with:
|
||||
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
|
||||
// Common Features
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(OutputDirStringInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SabreTools.Help;
|
||||
|
||||
namespace SabreTools.Features
|
||||
{
|
||||
// TODO: With the introduction of the `--log-level` input, can we create a better way
|
||||
// to handle "universal" flags? Having script as its own feature is not ideal.
|
||||
internal class Script : BaseFeature
|
||||
{
|
||||
public const string Value = "Script";
|
||||
|
||||
public Script()
|
||||
{
|
||||
Name = Value;
|
||||
Flags = new List<string>() { "--script" };
|
||||
Description = "Enable script mode (no clear screen)";
|
||||
_featureType = ParameterType.Flag;
|
||||
LongDescription = "For times when SabreTools is being used in a scripted environment, the user may not want the screen to be cleared every time that it is called. This flag allows the user to skip clearing the screen on run just like if the console was being redirected.";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace SabreTools.Features
|
||||
Features = new Dictionary<string, Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(DatListInput);
|
||||
AddFeature(OutputDirStringInput);
|
||||
@@ -56,7 +56,6 @@ namespace SabreTools.Features
|
||||
AddFeature(HeaderStringInput);
|
||||
AddInternalSplitFeatures();
|
||||
AddFeature(UpdateDatFlag);
|
||||
AddFeature(ThreadsInt32Input);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SabreTools.Features
|
||||
Features = new Dictionary<string, Help.Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(OutputTypeListInput);
|
||||
this[OutputTypeListInput].AddFeature(DeprecatedFlag);
|
||||
|
||||
@@ -32,6 +32,9 @@ The stats that are outputted are as follows:
|
||||
- Items with Nodump status";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
|
||||
// Common Features
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(ReportTypeListInput);
|
||||
AddFeature(FilenameStringInput);
|
||||
AddFeature(OutputDirStringInput);
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace SabreTools.Features
|
||||
LongDescription = "This is the multitool part of the program, allowing for almost every manipulation to a DAT, or set of DATs. This is also a combination of many different programs that performed DAT manipulation that work better together.";
|
||||
Features = new Dictionary<string, Help.Feature>();
|
||||
|
||||
// Common Features
|
||||
AddCommonFeatures();
|
||||
|
||||
// Output Formats
|
||||
AddFeature(OutputTypeListInput);
|
||||
this[OutputTypeListInput].AddFeature(PrefixStringInput);
|
||||
@@ -79,7 +82,6 @@ namespace SabreTools.Features
|
||||
AddFilteringFeatures();
|
||||
AddFeature(OutputDirStringInput);
|
||||
AddFeature(InplaceFlag);
|
||||
AddFeature(ThreadsInt32Input);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Help.Feature> features)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SabreTools.Features
|
||||
Features = new Dictionary<string, Feature>();
|
||||
|
||||
// Common Features
|
||||
AddFeature(LogLevelStringInput);
|
||||
AddCommonFeatures();
|
||||
|
||||
AddFeature(DatListInput);
|
||||
AddFeature(DepotFlag);
|
||||
|
||||
@@ -42,24 +42,6 @@ namespace SabreTools
|
||||
// Create a new Help object for this program
|
||||
_help = RetrieveHelp();
|
||||
|
||||
// Get the location of the script tag, if it exists
|
||||
int scriptLocation = (new List<string>(args)).IndexOf("--script");
|
||||
|
||||
// If output is being redirected or we are in script mode, don't allow clear screens
|
||||
if (!Console.IsOutputRedirected && scriptLocation == -1)
|
||||
{
|
||||
Console.Clear();
|
||||
Prepare.SetConsoleHeader("SabreTools");
|
||||
}
|
||||
|
||||
// Now we remove the script tag because it messes things up
|
||||
if (scriptLocation > -1)
|
||||
{
|
||||
List<string> newargs = new List<string>(args);
|
||||
newargs.RemoveAt(scriptLocation);
|
||||
args = newargs.ToArray();
|
||||
}
|
||||
|
||||
// Credits take precidence over all
|
||||
if ((new List<string>(args)).Contains("--credits"))
|
||||
{
|
||||
@@ -112,6 +94,13 @@ namespace SabreTools
|
||||
// Set the new log level based on settings
|
||||
LoggerImpl.LowestLogLevel = feature.LogLevel;
|
||||
|
||||
// If output is being redirected or we are in script mode, don't allow clear screens
|
||||
if (!Console.IsOutputRedirected && feature.ScriptMode)
|
||||
{
|
||||
Console.Clear();
|
||||
Prepare.SetConsoleHeader("SabreTools");
|
||||
}
|
||||
|
||||
// Now process the current feature
|
||||
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
|
||||
switch (featureName)
|
||||
@@ -119,7 +108,6 @@ namespace SabreTools
|
||||
// No-op as these should be caught
|
||||
case DisplayHelp.Value:
|
||||
case DisplayHelpDetailed.Value:
|
||||
case Script.Value:
|
||||
break;
|
||||
|
||||
// Require input verification
|
||||
@@ -172,7 +160,6 @@ namespace SabreTools
|
||||
// Add all of the features
|
||||
help.Add(new DisplayHelp());
|
||||
help.Add(new DisplayHelpDetailed());
|
||||
help.Add(new Script());
|
||||
help.Add(new Batch());
|
||||
help.Add(new DatFromDir());
|
||||
help.Add(new Extract());
|
||||
|
||||
Reference in New Issue
Block a user