Wire up partial support for dipswitches

This commit is contained in:
Matt Nadareski
2020-08-21 16:48:56 -07:00
parent 4d7a4373a9
commit 755b6f030b
8 changed files with 242 additions and 12 deletions

View File

@@ -257,10 +257,16 @@ namespace SabreTools.Library.DatItems
/// <summary>
/// List of shared feature items
/// </summary>
/// <remarks>Also in SoftwareList</remarks>
[JsonProperty("sharedfeat")]
public List<SoftwareListSharedFeature> SharedFeatures { get; set; } = null;
/// <summary>
/// List of shared feature items
/// </summary>
/// <remarks>Also in SoftwareList</remarks>
[JsonProperty("dipswitches")]
public List<SoftwareListDipSwitch> DipSwitches { get; set; } = null;
#endregion
#endregion
@@ -414,6 +420,10 @@ namespace SabreTools.Library.DatItems
case Field.SharedFeatures:
fieldValue = string.Join(";", (SharedFeatures ?? new List<SoftwareListSharedFeature>()).Select(i => $"{i.Name}={i.Value}"));
break;
case Field.DipSwitches:
// TODO: There is no possible way this will work... use placeholder for now
fieldValue = "dipswitches";
break;
#endregion
@@ -596,6 +606,14 @@ namespace SabreTools.Library.DatItems
}
}
if (mappings.Keys.Contains(Field.DipSwitches))
{
if (DipSwitches == null)
DipSwitches = new List<SoftwareListDipSwitch>();
// TODO: There's no way this will work... just create the new list for now
}
#endregion
}
@@ -696,6 +714,7 @@ namespace SabreTools.Library.DatItems
Supported = this.Supported,
SharedFeatures = this.SharedFeatures,
DipSwitches = this.DipSwitches,
#endregion
};
@@ -1104,6 +1123,9 @@ namespace SabreTools.Library.DatItems
if (fields.Contains(Field.SharedFeatures))
SharedFeatures = null;
if (fields.Contains(Field.DipSwitches))
DipSwitches = null;
#endregion
}
@@ -1252,6 +1274,9 @@ namespace SabreTools.Library.DatItems
if (fields.Contains(Field.SharedFeatures))
SharedFeatures = machine.SharedFeatures;
if (fields.Contains(Field.DipSwitches))
DipSwitches = machine.DipSwitches;
#endregion
}