mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add history tag support (fixes #34)
This commit is contained in:
@@ -741,6 +741,7 @@ namespace SabreTools.Core
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
History,
|
||||||
SourceFile,
|
SourceFile,
|
||||||
Runnable,
|
Runnable,
|
||||||
|
|
||||||
|
|||||||
@@ -1051,6 +1051,9 @@ namespace SabreTools.Core.Tools
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
case "history":
|
||||||
|
return MachineField.History;
|
||||||
|
|
||||||
case "sourcefile":
|
case "sourcefile":
|
||||||
case "source_file":
|
case "source_file":
|
||||||
return MachineField.SourceFile;
|
return MachineField.SourceFile;
|
||||||
|
|||||||
@@ -337,6 +337,10 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
machine.Manufacturer = reader.ReadElementContentAsString();
|
machine.Manufacturer = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "history":
|
||||||
|
machine.History = reader.ReadElementContentAsString();
|
||||||
|
break;
|
||||||
|
|
||||||
case "adjuster":
|
case "adjuster":
|
||||||
var adjuster = new Adjuster
|
var adjuster = new Adjuster
|
||||||
{
|
{
|
||||||
@@ -1473,6 +1477,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
xtw.WriteOptionalElementString("description", datItem.Machine.Description);
|
xtw.WriteOptionalElementString("description", datItem.Machine.Description);
|
||||||
xtw.WriteOptionalElementString("year", datItem.Machine.Year);
|
xtw.WriteOptionalElementString("year", datItem.Machine.Year);
|
||||||
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
||||||
|
xtw.WriteOptionalElementString("history", datItem.Machine.History);
|
||||||
|
|
||||||
xtw.Flush();
|
xtw.Flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -902,6 +902,9 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
if (fields.Contains(MachineField.History))
|
||||||
|
machine.History = null;
|
||||||
|
|
||||||
if (fields.Contains(MachineField.SourceFile))
|
if (fields.Contains(MachineField.SourceFile))
|
||||||
machine.SourceFile = null;
|
machine.SourceFile = null;
|
||||||
|
|
||||||
@@ -1891,6 +1894,9 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
if (machineFields.Contains(MachineField.History))
|
||||||
|
machine.History = repMachine.History;
|
||||||
|
|
||||||
if (machineFields.Contains(MachineField.SourceFile))
|
if (machineFields.Contains(MachineField.SourceFile))
|
||||||
machine.SourceFile = repMachine.SourceFile;
|
machine.SourceFile = repMachine.SourceFile;
|
||||||
|
|
||||||
@@ -2839,6 +2845,9 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(MachineField.History))
|
||||||
|
machine.History = mappings[MachineField.History];
|
||||||
|
|
||||||
if (mappings.Keys.Contains(MachineField.SourceFile))
|
if (mappings.Keys.Contains(MachineField.SourceFile))
|
||||||
machine.SourceFile = mappings[MachineField.SourceFile];
|
machine.SourceFile = mappings[MachineField.SourceFile];
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,13 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// History.dat entry for the machine
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("history", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
[XmlElement("history")]
|
||||||
|
public string History { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emulator source file related to the machine
|
/// Emulator source file related to the machine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -370,6 +377,7 @@ namespace SabreTools.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
History = this.History,
|
||||||
SourceFile = this.SourceFile,
|
SourceFile = this.SourceFile,
|
||||||
Runnable = this.Runnable,
|
Runnable = this.Runnable,
|
||||||
|
|
||||||
|
|||||||
@@ -1699,6 +1699,10 @@ namespace SabreTools.Filtering
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
// Machine_History
|
||||||
|
if (!Filter.PassStringFilter(MachineFilter.History, machine.History))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Machine_SourceFile
|
// Machine_SourceFile
|
||||||
if (!Filter.PassStringFilter(MachineFilter.SourceFile, machine.SourceFile))
|
if (!Filter.PassStringFilter(MachineFilter.SourceFile, machine.SourceFile))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
|
using SabreTools.DatItems;
|
||||||
using SabreTools.Logging;
|
using SabreTools.Logging;
|
||||||
|
|
||||||
namespace SabreTools.Filtering
|
namespace SabreTools.Filtering
|
||||||
@@ -45,6 +46,7 @@ namespace SabreTools.Filtering
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
public FilterItem<string> History { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> SourceFile { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> SourceFile { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<Runnable> Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Core.Runnable.NULL, Negative = Core.Runnable.NULL };
|
public FilterItem<Runnable> Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Core.Runnable.NULL, Negative = Core.Runnable.NULL };
|
||||||
|
|
||||||
@@ -221,6 +223,10 @@ namespace SabreTools.Filtering
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
|
case MachineField.History:
|
||||||
|
SetStringFilter(History, value, negate);
|
||||||
|
break;
|
||||||
|
|
||||||
case MachineField.SourceFile:
|
case MachineField.SourceFile:
|
||||||
SetStringFilter(SourceFile, value, negate);
|
SetStringFilter(SourceFile, value, negate);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<description>Game! (Version 1)</description>
|
<description>Game! (Version 1)</description>
|
||||||
<year>1980</year>
|
<year>1980</year>
|
||||||
<manufacturer>Manufacturer</manufacturer>
|
<manufacturer>Manufacturer</manufacturer>
|
||||||
|
<history>A long and storied history</history>
|
||||||
<adjuster name="adjuster" default="yes">
|
<adjuster name="adjuster" default="yes">
|
||||||
<condition tag="tag" mask="mask" relation="eq" value="value" />
|
<condition tag="tag" mask="mask" relation="eq" value="value" />
|
||||||
</adjuster>
|
</adjuster>
|
||||||
|
|||||||
Reference in New Issue
Block a user