Promote Feature

This commit is contained in:
Matt Nadareski
2020-09-02 13:31:50 -07:00
parent 07cf2135ff
commit 3d55e1462b
11 changed files with 317 additions and 107 deletions

View File

@@ -289,6 +289,17 @@ namespace SabreTools.Library.DatFiles
reader.Read();
break;
case "feature":
datItems.Add(new Feature
{
Type = reader.GetAttribute("type"),
Status = reader.GetAttribute("status"),
Overall = reader.GetAttribute("overall"),
});
reader.Read();
break;
case "rom":
datItems.Add(new Rom
{
@@ -481,21 +492,6 @@ namespace SabreTools.Library.DatFiles
reader.Read();
break;
case "feature":
var feature = new Feature();
feature.Type = reader.GetAttribute("type");
feature.Status = reader.GetAttribute("status");
feature.Overall = reader.GetAttribute("overall");
// Ensure the list exists
if (machine.Features == null)
machine.Features = new List<Feature>();
machine.Features.Add(feature);
reader.Read();
break;
case "device":
var device = new Device();
device.Type = reader.GetAttribute("type");
@@ -1318,20 +1314,6 @@ namespace SabreTools.Library.DatFiles
xtw.WriteEndElement();
}
}
if (datItem.Machine.Features != null)
{
foreach (var feature in datItem.Machine.Features)
{
xtw.WriteStartElement("feature");
xtw.WriteOptionalAttributeString("type", feature.Type);
xtw.WriteOptionalAttributeString("status", feature.Status);
xtw.WriteOptionalAttributeString("overall", feature.Overall);
// End feature
xtw.WriteEndElement();
}
}
if (datItem.Machine.Devices != null)
{
foreach (var device in datItem.Machine.Devices)
@@ -1584,6 +1566,15 @@ namespace SabreTools.Library.DatFiles
xtw.WriteEndElement();
break;
case ItemType.Feature:
var feature = datItem as Feature;
xtw.WriteStartElement("feature");
xtw.WriteOptionalAttributeString("type", feature.Type);
xtw.WriteOptionalAttributeString("status", feature.Status);
xtw.WriteOptionalAttributeString("overall", feature.Overall);
xtw.WriteEndElement();
break;
case ItemType.RamOption:
var ramOption = datItem as RamOption;
xtw.WriteStartElement("ramoption");