diff --git a/SabreTools.DatFiles/Formats/Missfile.cs b/SabreTools.DatFiles/Formats/Missfile.cs
index 329a0ac5..80b987cc 100644
--- a/SabreTools.DatFiles/Formats/Missfile.cs
+++ b/SabreTools.DatFiles/Formats/Missfile.cs
@@ -167,9 +167,31 @@ namespace SabreTools.DatFiles.Formats
/// The name of the last game to be output
private void WriteDatItem(StreamWriter sw, DatItem datItem, string? lastgame)
{
- // Get the machine for the item
var machine = datItem.GetFieldValue(DatItem.MachineKey);
+ WriteDatItemImpl(sw, datItem, machine!, lastgame);
+ }
+ ///
+ /// Write out DatItem using the supplied StreamWriter
+ ///
+ /// StreamWriter to output to
+ /// DatItem object to be output
+ /// The name of the last game to be output
+ private void WriteDatItemDB(StreamWriter sw, KeyValuePair datItem, string? lastgame)
+ {
+ var machine = ItemsDB.GetMachineForItem(datItem.Key).Value;
+ WriteDatItemImpl(sw, datItem.Value, machine!, lastgame);
+ }
+
+ ///
+ /// Write out DatItem using the supplied StreamWriter
+ ///
+ /// StreamWriter to output to
+ /// DatItem object to be output
+ /// Machine object representing the set the item is in
+ /// The name of the last game to be output
+ private void WriteDatItemImpl(StreamWriter sw, DatItem datItem, Machine machine, string? lastgame)
+ {
// Process the item name
ProcessItemName(datItem, machine, forceRemoveQuotes: false, forceRomName: false);
@@ -181,28 +203,5 @@ namespace SabreTools.DatFiles.Formats
sw.Flush();
}
-
- ///
- /// Write out DatItem using the supplied StreamWriter
- ///
- /// StreamWriter to output to
- /// DatItem object to be output
- /// The name of the last game to be output
- private void WriteDatItemDB(StreamWriter sw, KeyValuePair datItem, string? lastgame)
- {
- // Get the machine for the item
- var machine = ItemsDB.GetMachineForItem(datItem.Key).Value;
-
- // Process the item name
- ProcessItemName(datItem.Value, machine, forceRemoveQuotes: false, forceRomName: false);
-
- // Romba mode automatically uses item name
- if (Modifiers.OutputDepot?.IsActive == true || Modifiers.UseRomName)
- sw.Write($"{datItem.Value.GetName() ?? string.Empty}\n");
- else if (!Modifiers.UseRomName && machine!.GetStringFieldValue(Models.Metadata.Machine.NameKey) != lastgame)
- sw.Write($"{machine!.GetStringFieldValue(Models.Metadata.Machine.NameKey) ?? string.Empty}\n");
-
- sw.Flush();
- }
}
}