mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Wire up partial support for dipswitches
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
/// <summary>
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// This holds all of the auxiliary types needed for proper parsing
|
||||
/// </summary>
|
||||
namespace SabreTools.Library.DatItems
|
||||
@@ -26,6 +28,42 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList dipswitch
|
||||
/// </summary>
|
||||
public class SoftwareListDipSwitch
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string Mask { get; set; }
|
||||
public List<SoftwareListDipValue> Values { get; set; }
|
||||
|
||||
public SoftwareListDipSwitch(string name, string tag, string mask)
|
||||
{
|
||||
Name = name;
|
||||
Tag = tag;
|
||||
Mask = mask;
|
||||
Values = new List<SoftwareListDipValue>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList dipswitch
|
||||
/// </summary>
|
||||
public class SoftwareListDipValue
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool? Default { get; set; }
|
||||
|
||||
public SoftwareListDipValue(string name, string value, bool? def)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
Default = def;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList shared feature object
|
||||
/// </summary>
|
||||
|
||||
@@ -254,6 +254,7 @@ namespace SabreTools.Library.DatItems
|
||||
// SoftwareList
|
||||
Field.Supported,
|
||||
Field.SharedFeatures,
|
||||
Field.DipSwitches,
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
Supported,
|
||||
SharedFeatures,
|
||||
DipSwitches,
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user