mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add ChipType and EmulationStatus, fix serialization
This commit is contained in:
@@ -31,7 +31,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Conditions associated with the adjustment
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using SabreTools.Library.Filtering;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -25,19 +26,20 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Internal tag
|
||||
/// </summary>
|
||||
[JsonProperty("tag")]
|
||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of the chip
|
||||
/// </summary>
|
||||
[JsonProperty("chiptype")]
|
||||
public string ChipType { get; set; } // TODO: (cpu|audio)
|
||||
[JsonProperty("chiptype", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ChipType ChipType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Clock speed
|
||||
/// </summary>
|
||||
[JsonProperty("clock")]
|
||||
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Clock { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -70,7 +72,7 @@ namespace SabreTools.Library.DatItems
|
||||
Tag = mappings[Field.DatItem_Tag];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_ChipType))
|
||||
ChipType = mappings[Field.DatItem_ChipType];
|
||||
ChipType = mappings[Field.DatItem_ChipType].AsChipType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Clock))
|
||||
Clock = mappings[Field.DatItem_Clock];
|
||||
@@ -204,9 +206,9 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// DatItem_ChipType
|
||||
if (filter.DatItem_ChipType.MatchesPositiveSet(ChipType) == false)
|
||||
if (filter.DatItem_ChipType.MatchesPositive(ChipType.NULL, ChipType) == false)
|
||||
return false;
|
||||
if (filter.DatItem_ChipType.MatchesNegativeSet(ChipType) == true)
|
||||
if (filter.DatItem_ChipType.MatchesNegative(ChipType.NULL, ChipType) == true)
|
||||
return false;
|
||||
|
||||
// DatItem_Clock
|
||||
@@ -235,7 +237,7 @@ namespace SabreTools.Library.DatItems
|
||||
Tag = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_ChipType))
|
||||
ChipType = null;
|
||||
ChipType = ChipType.NULL;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Clock))
|
||||
Clock = null;
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Conditions associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("settings")]
|
||||
[JsonProperty("settings", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Setting> Settings { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Conditions associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("values")]
|
||||
[JsonProperty("values", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Setting> Values { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,22 @@
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Determine the chip type
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ChipType
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
|
||||
// TODO: (cpu|audio)
|
||||
CPU = 1 << 0,
|
||||
Audio = 1 << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines which type of duplicate a file is
|
||||
/// </summary>
|
||||
@@ -17,6 +33,21 @@ namespace SabreTools.Library.DatItems
|
||||
External = 1 << 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the emulation status
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum EmulationStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
|
||||
Unemulated = 1 << 0,
|
||||
Imperfect = 1 << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the feature type
|
||||
/// </summary>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
using System.Linq;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -18,20 +19,23 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Type of feature
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public FeatureType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emulation status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; } // TODO: (unemulated|imperfect)
|
||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public EmulationStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Overall status
|
||||
/// </summary>
|
||||
[JsonProperty("overall")]
|
||||
public string Overall { get; set; } // TODO: (unemulated|imperfect)
|
||||
[JsonProperty("overall", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public EmulationStatus Overall { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -51,10 +55,10 @@ namespace SabreTools.Library.DatItems
|
||||
Type = mappings[Field.DatItem_FeatureType].AsFeatureType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_FeatureStatus))
|
||||
Status = mappings[Field.DatItem_FeatureStatus];
|
||||
Status = mappings[Field.DatItem_FeatureStatus].AsEmulationStatus();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_FeatureOverall))
|
||||
Overall = mappings[Field.DatItem_FeatureOverall];
|
||||
Overall = mappings[Field.DatItem_FeatureOverall].AsEmulationStatus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -147,15 +151,15 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on status
|
||||
if (filter.DatItem_FeatureStatus.MatchesPositiveSet(Status) == false)
|
||||
if (filter.DatItem_FeatureStatus.MatchesPositive(EmulationStatus.NULL, Status) == false)
|
||||
return false;
|
||||
if (filter.DatItem_FeatureStatus.MatchesNegativeSet(Status) == true)
|
||||
if (filter.DatItem_FeatureStatus.MatchesNegative(EmulationStatus.NULL, Status) == true)
|
||||
return false;
|
||||
|
||||
// Filter on overall
|
||||
if (filter.DatItem_FeatureOverall.MatchesPositiveSet(Overall) == false)
|
||||
if (filter.DatItem_FeatureOverall.MatchesPositive(EmulationStatus.NULL, Overall) == false)
|
||||
return false;
|
||||
if (filter.DatItem_FeatureOverall.MatchesNegativeSet(Overall) == true)
|
||||
if (filter.DatItem_FeatureOverall.MatchesNegative(EmulationStatus.NULL, Overall) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -175,10 +179,10 @@ namespace SabreTools.Library.DatItems
|
||||
Type = FeatureType.NULL;
|
||||
|
||||
if (fields.Contains(Field.DatItem_FeatureStatus))
|
||||
Status = null;
|
||||
Status = EmulationStatus.NULL;
|
||||
|
||||
if (fields.Contains(Field.DatItem_FeatureOverall))
|
||||
Overall = null;
|
||||
Overall = EmulationStatus.NULL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Slot options associated with the slot
|
||||
/// </summary>
|
||||
[JsonProperty("slotoptions")]
|
||||
[JsonProperty("slotoptions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<SlotOption> SlotOptions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using SabreTools.Library.Filtering;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
@@ -26,6 +27,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Status of the softare list according to the machine
|
||||
/// </summary>
|
||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SoftwareListStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Number of channels
|
||||
/// </summary>
|
||||
[JsonProperty("channels")]
|
||||
[JsonProperty("channels", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Channels { get; set; } // TODO: Int32?
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user