Reduce use of GetName and SetName, prefer direct

This commit is contained in:
Matt Nadareski
2026-04-03 22:57:58 -04:00
parent cdc55e721e
commit 2fdecebe66
20 changed files with 557 additions and 906 deletions

View File

@@ -507,7 +507,7 @@ namespace SabreTools.Metadata.DatFiles
if (!string.IsNullOrEmpty(sha1))
{
name = Utilities.GetDepotPath(sha1, Modifiers.OutputDepot.Depth)?.Replace('\\', '/');
item.SetName($"{pre}{name}{post}");
disk.Name = $"{pre}{name}{post}";
}
}
else if (item is DatItems.Formats.File file)
@@ -517,7 +517,7 @@ namespace SabreTools.Metadata.DatFiles
if (!string.IsNullOrEmpty(sha1))
{
name = Utilities.GetDepotPath(sha1, Modifiers.OutputDepot.Depth)?.Replace('\\', '/');
item.SetName($"{pre}{name}{post}");
file.SetName($"{pre}{name}{post}");
}
}
else if (item is Media media)
@@ -527,7 +527,7 @@ namespace SabreTools.Metadata.DatFiles
if (!string.IsNullOrEmpty(sha1))
{
name = Utilities.GetDepotPath(sha1, Modifiers.OutputDepot.Depth)?.Replace('\\', '/');
item.SetName($"{pre}{name}{post}");
media.Name = $"{pre}{name}{post}";
}
}
else if (item is Rom rom)
@@ -537,7 +537,7 @@ namespace SabreTools.Metadata.DatFiles
if (!string.IsNullOrEmpty(sha1))
{
name = Utilities.GetDepotPath(sha1, Modifiers.OutputDepot.Depth)?.Replace('\\', '/');
item.SetName($"{pre}{name}{post}");
rom.Name = $"{pre}{name}{post}";
}
}

View File

@@ -206,7 +206,7 @@ namespace SabreTools.Metadata.DatFiles.Formats
if (Modifiers.OutputDepot?.IsActive == true || Modifiers.UseRomName)
sw.Write($"{datItem.GetName() ?? string.Empty}\n");
else if (!Modifiers.UseRomName && machine!.Name != lastgame)
sw.Write($"{machine!.GetName() ?? string.Empty}\n");
sw.Write($"{machine!.Name ?? string.Empty}\n");
sw.Flush();
}