Fix mismatched DB implementations

This commit is contained in:
Matt Nadareski
2025-01-09 10:05:16 -05:00
parent 68c235f716
commit b27d73da13
2 changed files with 45 additions and 2 deletions

View File

@@ -332,7 +332,7 @@ namespace SabreTools.DatFiles.Formats
// Write out the item if we're not ignoring
if (!ShouldIgnore(datItem.Value, ignoreblanks))
WriteDatItem(xtw, datItem.Value);
WriteDatItemDB(xtw, datItem);
// Set the new data to compare against
lastgame = machine.Value!.GetStringFieldValue(Models.Metadata.Machine.NameKey);
@@ -433,6 +433,25 @@ namespace SabreTools.DatFiles.Formats
xtw.Flush();
}
/// <summary>
/// Write out DatItem using the supplied StreamWriter
/// </summary>
/// <param name="xtw">XmlTextWriter to output to</param>
/// <param name="datItem">DatItem object to be output</param>
private void WriteDatItemDB(XmlTextWriter xtw, KeyValuePair<long, DatItem> datItem)
{
// Pre-process the item name
ProcessItemNameDB(datItem, true);
// Write the DatItem
XmlSerializer xs = new(typeof(DatItem));
XmlSerializerNamespaces ns = new();
ns.Add("", "");
xs.Serialize(xtw, datItem, ns);
xtw.Flush();
}
/// <summary>
/// Write out DAT footer using the supplied StreamWriter
/// </summary>