ProcessItemName

This commit is contained in:
Matt Nadareski
2025-01-09 16:25:53 -05:00
parent 5d9f2de4b5
commit f456f2b0ff
16 changed files with 1220 additions and 17 deletions

View File

@@ -211,7 +211,7 @@ namespace SabreTools.DatFiles
post = FormatPrefixPostfix(item, machine, post);
// Get the name to update
string? name = (useRomName == true
string? name = (useRomName
? item.GetName()
: machine?.GetStringFieldValue(Models.Metadata.Machine.NameKey)) ?? string.Empty;
@@ -229,6 +229,16 @@ namespace SabreTools.DatFiles
item.SetName($"{pre}{name}{post}");
}
}
else if (item is DatItems.Formats.File file)
{
// We can only write out if there's a SHA-1
string? sha1 = file.SHA1;
if (!string.IsNullOrEmpty(sha1))
{
name = Utilities.GetDepotPath(sha1, outputDepot.Depth)?.Replace('\\', '/');
item.SetName($"{pre}{name}{post}");
}
}
else if (item is Media media)
{
// We can only write out if there's a SHA-1
@@ -319,6 +329,8 @@ namespace SabreTools.DatFiles
}
else if (item is DatItems.Formats.File file)
{
name = $"{file.Id}.{file.Extension}";
size = file.Size.ToString() ?? string.Empty;
crc = file.CRC ?? string.Empty;
md5 = file.MD5 ?? string.Empty;
sha1 = file.SHA1 ?? string.Empty;