Add nullability to the two programs (not enforced)

This commit is contained in:
Matt Nadareski
2024-03-05 20:26:38 -05:00
parent 919973266c
commit 3c0d190dc3
43 changed files with 238 additions and 259 deletions

View File

@@ -1774,28 +1774,23 @@ Some special strings that can be used:
/// <summary>
/// Preconfigured Cleaner
/// </summary>
protected Cleaner Cleaner { get; set; }
protected Cleaner? Cleaner { get; set; }
/// <summary>
/// Preconfigured ExtraIni set
/// </summary>
protected ExtraIni Extras { get; set; }
/// <summary>
/// Preconfigured Filter
/// </summary>
protected Filtering.Filter Filter { get; set; }
protected ExtraIni? Extras { get; set; }
/// <summary>
/// Preonfigured FilterRunner
/// </summary>
protected Filter.FilterRunner FilterRunner { get; set; }
protected Filter.FilterRunner? FilterRunner { get; set; }
/// <summary>
/// Pre-configured DatHeader
/// </summary>
/// <remarks>Public because it's an indicator something went wrong</remarks>
public DatHeader Header { get; set; }
public DatHeader? Header { get; set; }
/// <summary>
/// Lowest log level for output
@@ -1805,12 +1800,12 @@ Some special strings that can be used:
/// <summary>
/// Output directory
/// </summary>
protected string OutputDir { get; set; }
protected string? OutputDir { get; set; }
/// <summary>
/// Pre-configured Remover
/// </summary>
protected Remover Remover { get; set; }
protected Remover? Remover { get; set; }
/// <summary>
/// Determines if scripting mode is enabled
@@ -1820,7 +1815,7 @@ Some special strings that can be used:
/// <summary>
/// Pre-configured Splitter
/// </summary>
protected Filtering.Splitter Splitter { get; set; }
protected Filtering.Splitter? Splitter { get; set; }
#endregion
@@ -1873,7 +1868,7 @@ Some special strings that can be used:
// Header Filters
AddFeature(ExcludeFieldListInput);
AddFeature(OneGamePerRegionFlag);
this[OneGamePerRegionFlag].AddFeature(RegionListInput);
this[OneGamePerRegionFlag]!.AddFeature(RegionListInput);
AddFeature(OneRomPerGameFlag);
AddFeature(SceneDateStripFlag);
}
@@ -1893,12 +1888,11 @@ Some special strings that can be used:
#endregion
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// Generic feature flags
Cleaner = GetCleaner(features);
Extras = GetExtras(features);
Filter = GetFilter(features);
FilterRunner = GetFilterRunner(features);
Header = GetDatHeader(features);
LogLevel = GetString(features, LogLevelStringValue).AsEnumValue<LogLevel>();
@@ -1923,7 +1917,7 @@ Some special strings that can be used:
/// <summary>
/// Get include from scan from feature list
/// </summary>
protected static HashType[] GetIncludeInScan(Dictionary<string, Feature> features)
protected static HashType[] GetIncludeInScan(Dictionary<string, Feature?> features)
{
List<HashType> includeInScan = [];
@@ -1952,7 +1946,7 @@ Some special strings that can be used:
/// <summary>
/// Get OutputFormat from feature list
/// </summary>
protected static OutputFormat GetOutputFormat(Dictionary<string, Feature> features)
protected static OutputFormat GetOutputFormat(Dictionary<string, Feature?> features)
{
if (GetBoolean(features, TarValue))
return OutputFormat.TapeArchive;
@@ -1981,7 +1975,7 @@ Some special strings that can be used:
/// <summary>
/// Get SkipFileType from feature list
/// </summary>
protected static SkipFileType GetSkipFileType(Dictionary<string, Feature> features)
protected static SkipFileType GetSkipFileType(Dictionary<string, Feature?> features)
{
if (GetBoolean(features, SkipArchivesValue))
return SkipFileType.Archive;
@@ -1994,7 +1988,7 @@ Some special strings that can be used:
/// <summary>
/// Get SplittingMode from feature list
/// </summary>
protected static SplittingMode GetSplittingMode(Dictionary<string, Feature> features)
protected static SplittingMode GetSplittingMode(Dictionary<string, Feature?> features)
{
SplittingMode splittingMode = SplittingMode.None;
@@ -2017,7 +2011,7 @@ Some special strings that can be used:
/// <summary>
/// Get StatReportFormat from feature list
/// </summary>
protected static StatReportFormat GetStatReportFormat(Dictionary<string, Feature> features)
protected static StatReportFormat GetStatReportFormat(Dictionary<string, Feature?> features)
{
StatReportFormat statDatFormat = StatReportFormat.None;
@@ -2032,7 +2026,7 @@ Some special strings that can be used:
/// <summary>
/// Get TreatAsFiles from feature list
/// </summary>
protected static TreatAsFile GetTreatAsFiles(Dictionary<string, Feature> features)
protected static TreatAsFile GetTreatAsFiles(Dictionary<string, Feature?> features)
{
TreatAsFile asFiles = 0x00;
if (GetBoolean(features, AaruFormatsAsFilesValue))
@@ -2048,13 +2042,13 @@ Some special strings that can be used:
/// <summary>
/// Get update Machine fields from feature list
/// </summary>
protected static List<string> GetUpdateMachineFields(Dictionary<string, Feature> features)
protected static List<string> GetUpdateMachineFields(Dictionary<string, Feature?> features)
{
List<string> updateFields = [];
foreach (string fieldName in GetList(features, UpdateFieldListValue))
{
(string? itemType, string? key) = SabreTools.Filter.FilterParser.ParseFilterId(fieldName);
if (itemType == Models.Metadata.MetadataFile.MachineKey)
if (itemType == Models.Metadata.MetadataFile.MachineKey && key != null)
updateFields.Add(key);
}
@@ -2064,13 +2058,13 @@ Some special strings that can be used:
/// <summary>
/// Get update DatItem fields from feature list
/// </summary>
protected static Dictionary<string, List<string>> GetUpdateDatItemFields(Dictionary<string, Feature> features)
protected static Dictionary<string, List<string>> GetUpdateDatItemFields(Dictionary<string, Feature?> features)
{
Dictionary<string, List<string>> updateFields = [];
foreach (string fieldName in GetList(features, UpdateFieldListValue))
{
(string? itemType, string? key) = SabreTools.Filter.FilterParser.ParseFilterId(fieldName);
if (itemType != Models.Metadata.MetadataFile.HeaderKey && itemType != Models.Metadata.MetadataFile.MachineKey)
if (itemType != null && itemType != Models.Metadata.MetadataFile.HeaderKey && itemType != Models.Metadata.MetadataFile.MachineKey && key != null)
{
if (!updateFields.ContainsKey(itemType))
updateFields[itemType] = [];
@@ -2085,7 +2079,7 @@ Some special strings that can be used:
/// <summary>
/// Get UpdateMode from feature list
/// </summary>
protected static UpdateMode GetUpdateMode(Dictionary<string, Feature> features)
protected static UpdateMode GetUpdateMode(Dictionary<string, Feature?> features)
{
UpdateMode updateMode = UpdateMode.None;
@@ -2129,7 +2123,7 @@ Some special strings that can be used:
/// <summary>
/// Get Cleaner from feature list
/// </summary>
private static Cleaner GetCleaner(Dictionary<string, Feature> features)
private static Cleaner GetCleaner(Dictionary<string, Feature?> features)
{
Cleaner cleaner = new()
{
@@ -2153,10 +2147,10 @@ Some special strings that can be used:
/// <summary>
/// Get DatHeader from feature list
/// </summary>
private DatHeader GetDatHeader(Dictionary<string, Feature> features)
private DatHeader? GetDatHeader(Dictionary<string, Feature?> features)
{
// TODO: Sort this by region, like the actual header
DatHeader datHeader = new()
var datHeader = new DatHeader()
{
AddExtension = GetString(features, AddExtensionStringValue),
Author = GetString(features, AuthorStringValue),
@@ -2217,7 +2211,7 @@ Some special strings that can be used:
/// <summary>
/// Get DedupeType from feature list
/// </summary>
private static DedupeType GetDedupeType(Dictionary<string, Feature> features)
private static DedupeType GetDedupeType(Dictionary<string, Feature?> features)
{
if (GetBoolean(features, DedupValue))
return DedupeType.Full;
@@ -2230,38 +2224,17 @@ Some special strings that can be used:
/// <summary>
/// Get ExtraIni from feature list
/// </summary>
private static ExtraIni GetExtras(Dictionary<string, Feature> features)
private static ExtraIni GetExtras(Dictionary<string, Feature?> features)
{
ExtraIni extraIni = new();
extraIni.PopulateFromList(GetList(features, ExtraIniListValue));
return extraIni;
}
/// <summary>
/// Get Filter from feature list
/// </summary>
private static Filtering.Filter GetFilter(Dictionary<string, Feature> features)
{
Filtering.Filter filter = new()
{
DatItemFilter = new DatItemFilter(),
MachineFilter = new MachineFilter(),
};
// Populate filters
List<string> filterPairs = GetList(features, FilterListValue);
filter.PopulateFiltersFromList(filterPairs);
// Include 'of" in game filters
filter.MachineFilter.IncludeOfInGame = GetBoolean(features, MatchOfTagsValue);
return filter;
}
/// <summary>
/// Get FilterRunner from feature list
/// </summary>
private static Filter.FilterRunner GetFilterRunner(Dictionary<string, Feature> features)
private static Filter.FilterRunner GetFilterRunner(Dictionary<string, Feature?> features)
{
// Populate filters
List<string> filterPairs = GetList(features, FilterListValue);
@@ -2277,7 +2250,7 @@ Some special strings that can be used:
/// <summary>
/// Get Remover from feature list
/// </summary>
private static Remover GetRemover(Dictionary<string, Feature> features)
private static Remover GetRemover(Dictionary<string, Feature?> features)
{
Remover remover = new();
@@ -2291,7 +2264,7 @@ Some special strings that can be used:
/// <summary>
/// Get Splitter from feature list
/// </summary>
private static Filtering.Splitter GetSplitter(Dictionary<string, Feature> features)
private static Filtering.Splitter GetSplitter(Dictionary<string, Feature?> features)
{
Filtering.Splitter splitter = new()
{
@@ -2303,7 +2276,7 @@ Some special strings that can be used:
/// <summary>
/// Get SplitType from feature list
/// </summary>
private static MergingFlag GetSplitType(Dictionary<string, Feature> features)
private static MergingFlag GetSplitType(Dictionary<string, Feature?> features)
{
MergingFlag splitType = MergingFlag.None;
if (GetBoolean(features, DatDeviceNonMergedValue))

View File

@@ -38,9 +38,9 @@ namespace SabreTools.Features
AddFeature(ArchivesAsFilesFlag);
AddFeature(ChdsAsFilesFlag);
AddFeature(OutputTypeListInput);
this[OutputTypeListInput].AddFeature(DeprecatedFlag);
this[OutputTypeListInput]!.AddFeature(DeprecatedFlag);
AddFeature(RombaFlag);
this[RombaFlag].AddFeature(RombaDepthInt32Input);
this[RombaFlag]!.AddFeature(RombaDepthInt32Input);
AddFeature(SkipArchivesFlag);
AddFeature(SkipFilesFlag);
AddHeaderFeatures();
@@ -100,8 +100,7 @@ namespace SabreTools.Features
// Perform additional processing steps
Extras.ApplyExtras(datdata);
Splitter.ApplySplitting(datdata, useTags: false);
Filter.ApplyFilters(datdata);
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
datdata.ExecuteFilters(FilterRunner);
Cleaner.ApplyCleaning(datdata);
Remover.ApplyRemovals(datdata);

View File

@@ -15,7 +15,7 @@ namespace SabreTools.Features
Description = "Show this help";
_featureType = ParameterType.Flag;
LongDescription = "Built-in to most of the programs is a basic help text.";
Features = new Dictionary<string, Feature>();
Features = [];
}
public override bool ProcessArgs(string[] args, FeatureSet help)

View File

@@ -15,7 +15,7 @@ namespace SabreTools.Features
Description = "Show this detailed help";
_featureType = ParameterType.Flag;
LongDescription = "Display a detailed help text to the screen.";
Features = new Dictionary<string, Feature>();
Features = [];
}
public override bool ProcessArgs(string[] args, FeatureSet help)

View File

@@ -32,7 +32,7 @@ The following systems have headers that this program can work with:
- Nintendo Famicom Disk System
- Nintendo Super Famicom / Super Nintendo Entertainment System
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -41,7 +41,7 @@ The following systems have headers that this program can work with:
AddFeature(NoStoreHeaderFlag);
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))

View File

@@ -31,7 +31,7 @@ The following systems have headers that this program can work with:
- Nintendo Famicom Disk System
- Nintendo Super Famicom / Super Nintendo Entertainment System
- Nintendo Super Famicom / Super Nintendo Entertainment System SPC";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -39,7 +39,7 @@ The following systems have headers that this program can work with:
AddFeature(OutputDirStringInput);
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))

View File

@@ -21,7 +21,7 @@ namespace SabreTools.Features
Description = "Sort inputs by a set of DATs";
_featureType = ParameterType.Flag;
LongDescription = "This feature allows the user to quickly rebuild based on a supplied DAT file(s). By default all files will be rebuilt to uncompressed folders in the output directory.";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -29,7 +29,7 @@ namespace SabreTools.Features
AddFeature(DatListInput);
AddFeature(OutputDirStringInput);
AddFeature(DepotFlag);
this[DepotFlag].AddFeature(DepotDepthInt32Input);
this[DepotFlag]!.AddFeature(DepotDepthInt32Input);
AddFeature(DeleteFlag);
AddFeature(InverseFlag);
AddFeature(QuickFlag);
@@ -42,13 +42,13 @@ namespace SabreTools.Features
AddFeature(Torrent7zipFlag);
AddFeature(TarFlag);
AddFeature(TorrentGzipFlag);
this[TorrentGzipFlag].AddFeature(RombaFlag);
this[TorrentGzipFlag][RombaFlag].AddFeature(RombaDepthInt32Input);
this[TorrentGzipFlag]!.AddFeature(RombaFlag);
this[TorrentGzipFlag][RombaFlag]!.AddFeature(RombaDepthInt32Input);
//AddFeature(SharedInputs.TorrentLrzipFlag);
//AddFeature(SharedInputs.TorrentLz4Flag);
//AddFeature(SharedInputs.TorrentRarFlag);
//AddFeature(SharedInputs.TorrentXzFlag);
//this[SharedInputs.TorrentXzFlag].AddFeature(SharedInputs.RombaFlag);
//this[SharedInputs.TorrentXzFlag]!.AddFeature(SharedInputs.RombaFlag);
AddFeature(TorrentZipFlag);
//AddFeature(SharedInputs.TorrentZpaqFlag);
//AddFeature(SharedInputs.TorrentZstdFlag);
@@ -58,7 +58,7 @@ namespace SabreTools.Features
AddFeature(UpdateDatFlag);
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))

View File

@@ -26,20 +26,20 @@ namespace SabreTools.Features
AddCommonFeatures();
AddFeature(OutputTypeListInput);
this[OutputTypeListInput].AddFeature(DeprecatedFlag);
this[OutputTypeListInput]!.AddFeature(DeprecatedFlag);
AddFeature(OutputDirStringInput);
AddFeature(InplaceFlag);
AddFeature(ExtensionFlag);
this[ExtensionFlag].AddFeature(ExtaListInput);
this[ExtensionFlag].AddFeature(ExtbListInput);
this[ExtensionFlag]!.AddFeature(ExtaListInput);
this[ExtensionFlag]!.AddFeature(ExtbListInput);
AddFeature(HashFlag);
AddFeature(LevelFlag);
this[LevelFlag].AddFeature(ShortFlag);
this[LevelFlag].AddFeature(BaseFlag);
this[LevelFlag]!.AddFeature(ShortFlag);
this[LevelFlag]!.AddFeature(BaseFlag);
AddFeature(SizeFlag);
this[SizeFlag].AddFeature(RadixInt64Input);
this[SizeFlag]!.AddFeature(RadixInt64Input);
AddFeature(TotalSizeFlag);
this[TotalSizeFlag].AddFeature(ChunkSizeInt64Input);
this[TotalSizeFlag]!.AddFeature(ChunkSizeInt64Input);
AddFeature(TypeFlag);
}

View File

@@ -30,7 +30,7 @@ The stats that are outputted are as follows:
- Items that include a SHA-384
- Items that include a SHA-512
- Items with Nodump status";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -43,7 +43,7 @@ The stats that are outputted are as follows:
AddFeature(IndividualFlag);
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))

View File

@@ -29,17 +29,17 @@ namespace SabreTools.Features
// Output Formats
AddFeature(OutputTypeListInput);
this[OutputTypeListInput].AddFeature(PrefixStringInput);
this[OutputTypeListInput].AddFeature(PostfixStringInput);
this[OutputTypeListInput].AddFeature(QuotesFlag);
this[OutputTypeListInput].AddFeature(RomsFlag);
this[OutputTypeListInput].AddFeature(GamePrefixFlag);
this[OutputTypeListInput].AddFeature(AddExtensionStringInput);
this[OutputTypeListInput].AddFeature(ReplaceExtensionStringInput);
this[OutputTypeListInput].AddFeature(RemoveExtensionsFlag);
this[OutputTypeListInput].AddFeature(RombaFlag);
this[OutputTypeListInput][RombaFlag].AddFeature(RombaDepthInt32Input);
this[OutputTypeListInput].AddFeature(DeprecatedFlag);
this[OutputTypeListInput]!.AddFeature(PrefixStringInput);
this[OutputTypeListInput]!.AddFeature(PostfixStringInput);
this[OutputTypeListInput]!.AddFeature(QuotesFlag);
this[OutputTypeListInput]!.AddFeature(RomsFlag);
this[OutputTypeListInput]!.AddFeature(GamePrefixFlag);
this[OutputTypeListInput]!.AddFeature(AddExtensionStringInput);
this[OutputTypeListInput]!.AddFeature(ReplaceExtensionStringInput);
this[OutputTypeListInput]!.AddFeature(RemoveExtensionsFlag);
this[OutputTypeListInput]!.AddFeature(RombaFlag);
this[OutputTypeListInput][RombaFlag]!.AddFeature(RombaDepthInt32Input);
this[OutputTypeListInput]!.AddFeature(DeprecatedFlag);
AddHeaderFeatures();
AddFeature(KeepEmptyGamesFlag);
@@ -48,35 +48,35 @@ namespace SabreTools.Features
AddFeature(DescriptionAsNameFlag);
AddInternalSplitFeatures();
AddFeature(TrimFlag);
this[TrimFlag].AddFeature(RootDirStringInput);
this[TrimFlag]!.AddFeature(RootDirStringInput);
AddFeature(SingleSetFlag);
AddFeature(DedupFlag);
AddFeature(GameDedupFlag);
AddFeature(MergeFlag);
this[MergeFlag].AddFeature(NoAutomaticDateFlag);
this[MergeFlag]!.AddFeature(NoAutomaticDateFlag);
AddFeature(DiffAllFlag);
this[DiffAllFlag].AddFeature(NoAutomaticDateFlag);
this[DiffAllFlag]!.AddFeature(NoAutomaticDateFlag);
AddFeature(DiffDuplicatesFlag);
this[DiffDuplicatesFlag].AddFeature(NoAutomaticDateFlag);
this[DiffDuplicatesFlag]!.AddFeature(NoAutomaticDateFlag);
AddFeature(DiffIndividualsFlag);
this[DiffIndividualsFlag].AddFeature(NoAutomaticDateFlag);
this[DiffIndividualsFlag]!.AddFeature(NoAutomaticDateFlag);
AddFeature(DiffNoDuplicatesFlag);
this[DiffNoDuplicatesFlag].AddFeature(NoAutomaticDateFlag);
this[DiffNoDuplicatesFlag]!.AddFeature(NoAutomaticDateFlag);
AddFeature(DiffAgainstFlag);
this[DiffAgainstFlag].AddFeature(BaseDatListInput);
this[DiffAgainstFlag].AddFeature(ByGameFlag);
this[DiffAgainstFlag]!.AddFeature(BaseDatListInput);
this[DiffAgainstFlag]!.AddFeature(ByGameFlag);
AddFeature(BaseReplaceFlag);
this[BaseReplaceFlag].AddFeature(BaseDatListInput);
this[BaseReplaceFlag].AddFeature(UpdateFieldListInput);
this[BaseReplaceFlag][UpdateFieldListInput].AddFeature(OnlySameFlag);
this[BaseReplaceFlag]!.AddFeature(BaseDatListInput);
this[BaseReplaceFlag]!.AddFeature(UpdateFieldListInput);
this[BaseReplaceFlag][UpdateFieldListInput]!.AddFeature(OnlySameFlag);
AddFeature(ReverseBaseReplaceFlag);
this[ReverseBaseReplaceFlag].AddFeature(BaseDatListInput);
this[ReverseBaseReplaceFlag].AddFeature(UpdateFieldListInput);
this[ReverseBaseReplaceFlag][UpdateFieldListInput].AddFeature(OnlySameFlag);
this[ReverseBaseReplaceFlag]!.AddFeature(BaseDatListInput);
this[ReverseBaseReplaceFlag]!.AddFeature(UpdateFieldListInput);
this[ReverseBaseReplaceFlag][UpdateFieldListInput]!.AddFeature(OnlySameFlag);
AddFeature(DiffCascadeFlag);
this[DiffCascadeFlag].AddFeature(SkipFirstOutputFlag);
this[DiffCascadeFlag]!.AddFeature(SkipFirstOutputFlag);
AddFeature(DiffReverseCascadeFlag);
this[DiffReverseCascadeFlag].AddFeature(SkipFirstOutputFlag);
this[DiffReverseCascadeFlag]!.AddFeature(SkipFirstOutputFlag);
AddFeature(ExtraIniListInput);
AddFilteringFeatures();
AddFeature(OutputDirStringInput);
@@ -174,8 +174,7 @@ namespace SabreTools.Features
// Perform additional processing steps
Extras.ApplyExtras(datFile);
Splitter.ApplySplitting(datFile, useTags: false);
Filter.ApplyFilters(datFile);
// datFile.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
datFile.ExecuteFilters(FilterRunner);
Cleaner.ApplyCleaning(datFile);
Remover.ApplyRemovals(datFile);
@@ -218,8 +217,7 @@ namespace SabreTools.Features
// Perform additional processing steps
Extras.ApplyExtras(userInputDat);
Splitter.ApplySplitting(userInputDat, useTags: false);
Filter.ApplyFilters(userInputDat);
// userInputDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
userInputDat.ExecuteFilters(FilterRunner);
Cleaner.ApplyCleaning(userInputDat);
Remover.ApplyRemovals(userInputDat);
@@ -348,8 +346,7 @@ namespace SabreTools.Features
// Perform additional processing steps
Extras.ApplyExtras(repDat);
Splitter.ApplySplitting(repDat, useTags: false);
Filter.ApplyFilters(repDat);
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
repDat.ExecuteFilters(FilterRunner);
Cleaner.ApplyCleaning(repDat);
Remover.ApplyRemovals(repDat);
@@ -385,8 +382,7 @@ namespace SabreTools.Features
// Perform additional processing steps
Extras.ApplyExtras(repDat);
Splitter.ApplySplitting(repDat, useTags: false);
Filter.ApplyFilters(repDat);
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
repDat.ExecuteFilters(FilterRunner);
Cleaner.ApplyCleaning(repDat);
Remover.ApplyRemovals(repDat);

View File

@@ -20,14 +20,14 @@ namespace SabreTools.Features
Description = "Verify a folder against DATs";
_featureType = ParameterType.Flag;
LongDescription = "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 for the combined DATs and games are either the directories or archives within. This will only do a direct verification of the items within and will create a fixdat afterwards for missing files.";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
AddFeature(DatListInput);
AddFeature(DepotFlag);
this[DepotFlag].AddFeature(DepotDepthInt32Input);
this[DepotFlag]!.AddFeature(DepotDepthInt32Input);
AddFeature(OutputDirStringInput);
AddFeature(HashOnlyFlag);
AddFeature(QuickFlag);
@@ -40,7 +40,7 @@ namespace SabreTools.Features
AddFilteringFeatures();
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))
@@ -65,15 +65,14 @@ namespace SabreTools.Features
Parser.ParseInto(datdata, datfile, int.MaxValue, keep: true);
// Perform additional processing steps
Extras.ApplyExtras(datdata);
Splitter.ApplySplitting(datdata, useTags: true);
Filter.ApplyFilters(datdata);
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
Cleaner.ApplyCleaning(datdata);
Remover.ApplyRemovals(datdata);
Extras!.ApplyExtras(datdata);
Splitter!.ApplySplitting(datdata, useTags: true);
datdata.ExecuteFilters(FilterRunner!);
Cleaner!.ApplyCleaning(datdata);
Remover!.ApplyRemovals(datdata);
// Set depot information
datdata.Header.InputDepot = Header.InputDepot?.Clone() as DepotInformation;
datdata.Header.InputDepot = Header!.InputDepot?.Clone() as DepotInformation;
// If we have overridden the header skipper, set it now
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
@@ -98,7 +97,7 @@ namespace SabreTools.Features
// Now write out if there are any items left
Writer.WriteStatsToConsole(datdata);
Writer.Write(datdata, OutputDir);
Writer.Write(datdata, OutputDir!);
}
}
// Otherwise, process all DATs into the same output
@@ -114,15 +113,14 @@ namespace SabreTools.Features
}
// Perform additional processing steps
Extras.ApplyExtras(datdata);
Splitter.ApplySplitting(datdata, useTags: true);
Filter.ApplyFilters(datdata);
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
Cleaner.ApplyCleaning(datdata);
Remover.ApplyRemovals(datdata);
Extras!.ApplyExtras(datdata);
Splitter!.ApplySplitting(datdata, useTags: true);
datdata.ExecuteFilters(FilterRunner!);
Cleaner!.ApplyCleaning(datdata);
Remover!.ApplyRemovals(datdata);
// Set depot information
datdata.Header.InputDepot = Header.InputDepot?.Clone() as DepotInformation;
datdata.Header.InputDepot = Header!.InputDepot?.Clone() as DepotInformation;
// If we have overridden the header skipper, set it now
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
@@ -149,7 +147,7 @@ namespace SabreTools.Features
// Now write out if there are any items left
Writer.WriteStatsToConsole(datdata);
Writer.Write(datdata, OutputDir);
Writer.Write(datdata, OutputDir!);
}
return true;

View File

@@ -16,13 +16,13 @@ namespace SabreTools.Features
Description = "Prints version";
_featureType = ParameterType.Flag;
LongDescription = "Prints current program version.";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
}
public override bool ProcessFeatures(Dictionary<string, Feature> features)
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
{
// If the base fails, just fail out
if (!base.ProcessFeatures(features))

View File

@@ -109,7 +109,7 @@ namespace SabreTools
}
// Now process the current feature
Dictionary<string, Feature> features = _help.GetEnabledFeatures();
Dictionary<string, Feature?> features = _help.GetEnabledFeatures();
bool success = false;
switch (featureName)
{

View File

@@ -5,6 +5,7 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Authors>Matt Nadareski</Authors>
<Copyright>Copyright (c)2016-2024 Matt Nadareski</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>