Simplify ProcessItemName use

This commit is contained in:
Matt Nadareski
2025-01-09 10:13:47 -05:00
parent b27d73da13
commit 62a7f28334
4 changed files with 25 additions and 48 deletions

View File

@@ -421,8 +421,11 @@ namespace SabreTools.DatFiles.Formats
/// <param name="datItem">DatItem object to be output</param>
private void WriteDatItem(XmlTextWriter xtw, DatItem datItem)
{
// Get the machine for the item
var machine = datItem.GetFieldValue<Machine>(DatItem.MachineKey);
// Pre-process the item name
ProcessItemName(datItem, true);
ProcessItemName(datItem, machine, forceRemoveQuotes: true, forceRomName: false);
// Write the DatItem
XmlSerializer xs = new(typeof(DatItem));
@@ -440,8 +443,11 @@ namespace SabreTools.DatFiles.Formats
/// <param name="datItem">DatItem object to be output</param>
private void WriteDatItemDB(XmlTextWriter xtw, KeyValuePair<long, DatItem> datItem)
{
// Get the machine for the item
var machine = ItemsDB.GetMachineForItem(datItem.Key);
// Pre-process the item name
ProcessItemNameDB(datItem, true);
ProcessItemName(datItem.Value, machine.Value, forceRemoveQuotes: true, forceRomName: false);
// Write the DatItem
XmlSerializer xs = new(typeof(DatItem));