mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Reduce array allocations
This commit is contained in:
@@ -41,6 +41,7 @@ namespace RombaSharp.Features
|
||||
string? description = GetString(features, DescriptionStringValue);
|
||||
string? source = GetString(features, SourceStringValue);
|
||||
string? outdat = GetString(features, OutStringValue);
|
||||
HashType[] hashes = [HashType.CRC32, HashType.MD5, HashType.SHA1];
|
||||
|
||||
// Ensure the output directory
|
||||
outdat = outdat.Ensure(create: true);
|
||||
@@ -56,7 +57,7 @@ namespace RombaSharp.Features
|
||||
DatFile datfile = DatFile.Create();
|
||||
datfile.Header.SetFieldValue<string?>(SabreTools.Models.Metadata.Header.NameKey, string.IsNullOrWhiteSpace(name) ? "untitled" : name);
|
||||
datfile.Header.SetFieldValue<string?>(SabreTools.Models.Metadata.Header.DescriptionKey, description);
|
||||
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: [HashType.CRC32, HashType.MD5, HashType.SHA1]);
|
||||
DatFromDir.PopulateFromDir(datfile, source, asFiles: TreatAsFile.NonArchive, hashes: hashes);
|
||||
Writer.Write(datfile, outdat!);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user