mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix mismatched DB implementations
This commit is contained in:
@@ -503,7 +503,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
|
|
||||||
// Write out the item if we're not ignoring
|
// Write out the item if we're not ignoring
|
||||||
if (!ShouldIgnore(datItem.Value, ignoreblanks))
|
if (!ShouldIgnore(datItem.Value, ignoreblanks))
|
||||||
WriteDatItem(jtw, datItem.Value);
|
WriteDatItemDB(jtw, datItem);
|
||||||
|
|
||||||
// Set the new data to compare against
|
// Set the new data to compare against
|
||||||
lastgame = machine.Value!.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
lastgame = machine.Value!.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
||||||
@@ -609,6 +609,30 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
jtw.Flush();
|
jtw.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write out DatItem using the supplied JsonTextWriter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="jtw">JsonTextWriter to output to</param>
|
||||||
|
/// <param name="datItem">DatItem object to be output</param>
|
||||||
|
private void WriteDatItemDB(JsonTextWriter jtw, KeyValuePair<long, DatItem> datItem)
|
||||||
|
{
|
||||||
|
// Pre-process the item name
|
||||||
|
ProcessItemNameDB(datItem, true);
|
||||||
|
|
||||||
|
// Build the state
|
||||||
|
jtw.WriteStartObject();
|
||||||
|
|
||||||
|
// Write the DatItem
|
||||||
|
jtw.WritePropertyName("datitem");
|
||||||
|
JsonSerializer js = new() { ContractResolver = new BaseFirstContractResolver(), Formatting = Formatting.Indented };
|
||||||
|
js.Serialize(jtw, datItem);
|
||||||
|
|
||||||
|
// End item
|
||||||
|
jtw.WriteEndObject();
|
||||||
|
|
||||||
|
jtw.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write out DAT footer using the supplied JsonTextWriter
|
/// Write out DAT footer using the supplied JsonTextWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
|
|
||||||
// Write out the item if we're not ignoring
|
// Write out the item if we're not ignoring
|
||||||
if (!ShouldIgnore(datItem.Value, ignoreblanks))
|
if (!ShouldIgnore(datItem.Value, ignoreblanks))
|
||||||
WriteDatItem(xtw, datItem.Value);
|
WriteDatItemDB(xtw, datItem);
|
||||||
|
|
||||||
// Set the new data to compare against
|
// Set the new data to compare against
|
||||||
lastgame = machine.Value!.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
lastgame = machine.Value!.GetStringFieldValue(Models.Metadata.Machine.NameKey);
|
||||||
@@ -433,6 +433,25 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
xtw.Flush();
|
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>
|
/// <summary>
|
||||||
/// Write out DAT footer using the supplied StreamWriter
|
/// Write out DAT footer using the supplied StreamWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user