Reduce unnecessary library calls

This commit is contained in:
Matt Nadareski
2024-10-23 22:10:55 -04:00
parent 1f0637cc91
commit a1b59eb2f3
3 changed files with 4 additions and 32 deletions

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.IO;
using Microsoft.Data.Sqlite;
using SabreTools.Core;
using SabreTools.Core.Tools;
using SabreTools.Help;
using SabreTools.IO;
@@ -61,24 +60,6 @@ namespace Headerer.Features
#endregion
#region Int32 features
internal const string ThreadsInt32Value = "threads";
internal static Feature ThreadsInt32Input
{
get
{
return new Feature(
ThreadsInt32Value,
new List<string>() { "-mt", "--threads" },
"Amount of threads to use (default = # cores)",
ParameterType.Int32,
longDescription: "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.");
}
}
#endregion
#region String features
internal const string LogLevelStringValue = "log-level";
@@ -142,22 +123,15 @@ Possible values are: Verbose, User, Warning, Error");
{
AddFeature(ScriptFlag);
AddFeature(LogLevelStringInput);
AddFeature(ThreadsInt32Input);
}
#endregion
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// Generic feature flags
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
OutputDir = GetString(features, OutputDirStringValue)?.Trim('"');
ScriptMode = GetBoolean(features, ScriptValue);
// Set threading flag, if necessary
if (features.ContainsKey(ThreadsInt32Value))
Globals.MaxThreads = GetInt32(features, ThreadsInt32Value);
return true;
}