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

@@ -19,7 +19,7 @@ namespace RombaSharp.Features
Description = "Creates a DAT file with those entries that are in -new DAT.";
_featureType = ParameterType.Flag;
LongDescription = @"Creates a DAT file with those entries that are in -new DAT files and not in -old DAT files. Ignores those entries in -old that are not in -new.";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -29,19 +29,19 @@ namespace RombaSharp.Features
AddFeature(NewStringInput);
}
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))
return false;
// Get feature flags
string olddat = GetString(features, OldStringValue);
string outdat = GetString(features, OutStringValue);
string newdat = GetString(features, NewStringValue);
string? olddat = GetString(features, OldStringValue);
string? outdat = GetString(features, OutStringValue);
string? newdat = GetString(features, NewStringValue);
// Ensure the output directory
outdat.Ensure(create: true);
outdat = outdat?.Ensure(create: true);
// Check that all required files exist
if (!File.Exists(olddat))
@@ -62,7 +62,7 @@ namespace RombaSharp.Features
// Diff against the new datfile
DatFile intDat = Parser.CreateAndParse(newdat);
DatFileTool.DiffAgainst(datfile, intDat, false);
Writer.Write(intDat, outdat);
Writer.Write(intDat, outdat!);
return true;
}
}