Promote Control

This commit is contained in:
Matt Nadareski
2020-09-02 23:02:06 -07:00
parent 54e7e4b276
commit dfa56a240b
11 changed files with 456 additions and 105 deletions

View File

@@ -232,6 +232,9 @@ namespace SabreTools.Library.DatFiles
case ItemType.Configuration:
datItem = datItemObj.ToObject<Configuration>();
break;
case ItemType.Control:
datItem = datItemObj.ToObject<Control>();
break;
case ItemType.Device:
datItem = datItemObj.ToObject<Device>();
break;

View File

@@ -686,7 +686,7 @@ namespace SabreTools.Library.DatFiles
{
case "control":
var control = new Control();
control.Type = reader.GetAttribute("type");
control.ControlType = reader.GetAttribute("type");
control.Player = reader.GetAttribute("player");
control.Buttons = reader.GetAttribute("buttons");
control.RegButtons = reader.GetAttribute("regbuttons");
@@ -1558,7 +1558,7 @@ namespace SabreTools.Library.DatFiles
foreach (var control in input.Controls)
{
xtw.WriteStartElement("control");
xtw.WriteOptionalAttributeString("type", control.Type);
xtw.WriteOptionalAttributeString("type", control.ControlType);
xtw.WriteOptionalAttributeString("player", control.Player);
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
xtw.WriteOptionalAttributeString("regbuttons", control.RegButtons);

View File

@@ -196,7 +196,7 @@ namespace SabreTools.Library.DatFiles
int indexId)
{
List<DatItem> items = new List<DatItem>();
OpenMSXOriginal original = null;
Original original = null;
while (!reader.EOF)
{
@@ -238,7 +238,7 @@ namespace SabreTools.Library.DatFiles
break;
case "original":
original = new OpenMSXOriginal();
original = new Original();
original.Value = reader.GetAttribute("value").AsYesNo();
original.Content = reader.ReadElementContentAsString();
break;

View File

@@ -1486,7 +1486,7 @@ namespace SabreTools.Library.DatFiles
foreach (var control in input.Controls)
{
xtw.WriteStartElement("control");
xtw.WriteOptionalAttributeString("type", control.Type);
xtw.WriteOptionalAttributeString("type", control.ControlType);
xtw.WriteOptionalAttributeString("player", control.Player);
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
xtw.WriteOptionalAttributeString("regbuttons", control.RegButtons);

View File

@@ -164,13 +164,13 @@ namespace SabreTools.Library.DatFiles
break;
case "info":
var info = new SoftwareListInfo();
var info = new Info();
info.Name = reader.GetAttribute("name");
info.Value = reader.GetAttribute("value");
// Ensure the list exists
if (machine.Infos == null)
machine.Infos = new List<SoftwareListInfo>();
machine.Infos = new List<Info>();
machine.Infos.Add(info);
@@ -178,13 +178,13 @@ namespace SabreTools.Library.DatFiles
break;
case "sharedfeat":
var sharedFeature = new SoftwareListSharedFeature();
var sharedFeature = new SharedFeature();
sharedFeature.Name = reader.GetAttribute("name");
sharedFeature.Value = reader.GetAttribute("value");
// Ensure the list exists
if (machine.SharedFeatures == null)
machine.SharedFeatures = new List<SoftwareListSharedFeature>();
machine.SharedFeatures = new List<SharedFeature>();
machine.SharedFeatures.Add(sharedFeature);
@@ -701,7 +701,7 @@ namespace SabreTools.Library.DatFiles
if (datItem.Machine.Infos != null && datItem.Machine.Infos.Count > 0)
{
foreach (SoftwareListInfo kvp in datItem.Machine.Infos)
foreach (Info kvp in datItem.Machine.Infos)
{
xtw.WriteStartElement("info");
xtw.WriteRequiredAttributeString("name", kvp.Name);
@@ -712,7 +712,7 @@ namespace SabreTools.Library.DatFiles
if (datItem.Machine.SharedFeatures != null && datItem.Machine.SharedFeatures.Count > 0)
{
foreach (SoftwareListSharedFeature kvp in datItem.Machine.SharedFeatures)
foreach (SharedFeature kvp in datItem.Machine.SharedFeatures)
{
xtw.WriteStartElement("sharedfeat");
xtw.WriteRequiredAttributeString("name", kvp.Name);