mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Simplify ProcessItemName use
This commit is contained in:
@@ -170,8 +170,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
/// <param name="lastgame">The name of the last game to be output</param>
|
||||
private void WriteDatItem(StreamWriter sw, DatItem datItem, string? lastgame)
|
||||
{
|
||||
// Get the machine for the item
|
||||
var machine = datItem.GetFieldValue<Machine>(DatItem.MachineKey);
|
||||
|
||||
// Process the item name
|
||||
ProcessItemName(datItem, false, forceRomName: false);
|
||||
ProcessItemName(datItem, machine, false, forceRomName: false);
|
||||
|
||||
// Romba mode automatically uses item name
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true || Header.GetBoolFieldValue(DatHeader.UseRomNameKey) == true)
|
||||
@@ -194,7 +197,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
var machine = ItemsDB.GetMachineForItem(datItem.Key);
|
||||
|
||||
// Process the item name
|
||||
ProcessItemNameDB(datItem, false, forceRomName: false);
|
||||
ProcessItemName(datItem.Value, machine.Value, forceRemoveQuotes: false, forceRomName: false);
|
||||
|
||||
// Romba mode automatically uses item name
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true
|
||||
|
||||
@@ -592,8 +592,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
/// <param name="datItem">DatItem object to be output</param>
|
||||
private void WriteDatItem(JsonTextWriter jtw, 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);
|
||||
|
||||
// Build the state
|
||||
jtw.WriteStartObject();
|
||||
@@ -616,8 +619,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
/// <param name="datItem">DatItem object to be output</param>
|
||||
private void WriteDatItemDB(JsonTextWriter jtw, 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);
|
||||
|
||||
// Build the state
|
||||
jtw.WriteStartObject();
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user