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

@@ -20,7 +20,7 @@ namespace RombaSharp.Features
Description = "Creates a DAT file for the specified input directory and saves it to the -out filename.";
_featureType = ParameterType.Flag;
LongDescription = "Creates a DAT file for the specified input directory and saves it to the -out filename.";
Features = new Dictionary<string, Feature>();
Features = [];
// Common Features
AddCommonFeatures();
@@ -31,20 +31,20 @@ namespace RombaSharp.Features
AddFeature(DescriptionStringInput);
}
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 name = GetString(features, NameStringValue);
string description = GetString(features, DescriptionStringValue);
string source = GetString(features, SourceStringValue);
string outdat = GetString(features, OutStringValue);
string? name = GetString(features, NameStringValue);
string? description = GetString(features, DescriptionStringValue);
string? source = GetString(features, SourceStringValue);
string? outdat = GetString(features, OutStringValue);
// Ensure the output directory
outdat.Ensure(create: true);
outdat = outdat?.Ensure(create: true);
// Check that all required directories exist
if (!Directory.Exists(source))
@@ -58,7 +58,7 @@ namespace RombaSharp.Features
datfile.Header.Name = string.IsNullOrWhiteSpace(name) ? "untitled" : name;
datfile.Header.Description = description;
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: [HashType.CRC32, HashType.MD5, HashType.SHA1]);
Writer.Write(datfile, outdat);
Writer.Write(datfile, outdat!);
return true;
}
}