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:
@@ -205,7 +205,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Tag = reader.GetAttribute("tag"),
|
Tag = reader.GetAttribute("tag"),
|
||||||
ChipType = reader.GetAttribute("type"),
|
ChipType = reader.GetAttribute("type").AsChipType(),
|
||||||
Clock = reader.GetAttribute("clock"),
|
Clock = reader.GetAttribute("clock"),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source
|
||||||
@@ -293,8 +293,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
datItems.Add(new Feature
|
datItems.Add(new Feature
|
||||||
{
|
{
|
||||||
Type = reader.GetAttribute("type").AsFeatureType(),
|
Type = reader.GetAttribute("type").AsFeatureType(),
|
||||||
Status = reader.GetAttribute("status"),
|
Status = reader.GetAttribute("status").AsEmulationStatus(),
|
||||||
Overall = reader.GetAttribute("overall"),
|
Overall = reader.GetAttribute("overall").AsEmulationStatus(),
|
||||||
});
|
});
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
@@ -1441,7 +1441,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteStartElement("chip");
|
xtw.WriteStartElement("chip");
|
||||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||||
xtw.WriteOptionalAttributeString("type", chip.ChipType);
|
xtw.WriteOptionalAttributeString("type", chip.ChipType.FromChipType());
|
||||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
@@ -1570,8 +1570,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
var feature = datItem as Feature;
|
var feature = datItem as Feature;
|
||||||
xtw.WriteStartElement("feature");
|
xtw.WriteStartElement("feature");
|
||||||
xtw.WriteOptionalAttributeString("type", feature.Type.FromFeatureType());
|
xtw.WriteOptionalAttributeString("type", feature.Type.FromFeatureType());
|
||||||
xtw.WriteOptionalAttributeString("status", feature.Status);
|
xtw.WriteOptionalAttributeString("status", feature.Status.FromEmulationStatus());
|
||||||
xtw.WriteOptionalAttributeString("overall", feature.Overall);
|
xtw.WriteOptionalAttributeString("overall", feature.Overall.FromEmulationStatus());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Tag = reader.GetAttribute("tag"),
|
Tag = reader.GetAttribute("tag"),
|
||||||
ChipType = reader.GetAttribute("chiptype"),
|
ChipType = reader.GetAttribute("chiptype").AsChipType(),
|
||||||
Clock = reader.GetAttribute("clock"),
|
Clock = reader.GetAttribute("clock"),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source
|
||||||
@@ -1253,7 +1253,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteAttributeString("type", "chip");
|
xtw.WriteAttributeString("type", "chip");
|
||||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||||
xtw.WriteOptionalAttributeString("chiptype", chip.ChipType);
|
xtw.WriteOptionalAttributeString("chiptype", chip.ChipType.FromChipType());
|
||||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
@@ -1394,8 +1394,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
xtw.WriteAttributeString("type", "feature");
|
xtw.WriteAttributeString("type", "feature");
|
||||||
xtw.WriteOptionalAttributeString("type", feature.Type.FromFeatureType());
|
xtw.WriteOptionalAttributeString("type", feature.Type.FromFeatureType());
|
||||||
xtw.WriteOptionalAttributeString("status", feature.Status);
|
xtw.WriteOptionalAttributeString("status", feature.Status.FromEmulationStatus());
|
||||||
xtw.WriteOptionalAttributeString("overall", feature.Overall);
|
xtw.WriteOptionalAttributeString("overall", feature.Overall.FromEmulationStatus());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Conditions associated with the adjustment
|
/// Conditions associated with the adjustment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Condition> Conditions { get; set; }
|
public List<Condition> Conditions { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using SabreTools.Library.Filtering;
|
using SabreTools.Library.Filtering;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace SabreTools.Library.DatItems
|
namespace SabreTools.Library.DatItems
|
||||||
{
|
{
|
||||||
@@ -25,19 +26,20 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal tag
|
/// Internal tag
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("tag")]
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Type of the chip
|
/// Type of the chip
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("chiptype")]
|
[JsonProperty("chiptype", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string ChipType { get; set; } // TODO: (cpu|audio)
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public ChipType ChipType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clock speed
|
/// Clock speed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("clock")]
|
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Clock { get; set; }
|
public string Clock { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -70,7 +72,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Tag = mappings[Field.DatItem_Tag];
|
Tag = mappings[Field.DatItem_Tag];
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.DatItem_ChipType))
|
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))
|
if (mappings.Keys.Contains(Field.DatItem_Clock))
|
||||||
Clock = mappings[Field.DatItem_Clock];
|
Clock = mappings[Field.DatItem_Clock];
|
||||||
@@ -204,9 +206,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// DatItem_ChipType
|
// DatItem_ChipType
|
||||||
if (filter.DatItem_ChipType.MatchesPositiveSet(ChipType) == false)
|
if (filter.DatItem_ChipType.MatchesPositive(ChipType.NULL, ChipType) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.DatItem_ChipType.MatchesNegativeSet(ChipType) == true)
|
if (filter.DatItem_ChipType.MatchesNegative(ChipType.NULL, ChipType) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// DatItem_Clock
|
// DatItem_Clock
|
||||||
@@ -235,7 +237,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Tag = null;
|
Tag = null;
|
||||||
|
|
||||||
if (fields.Contains(Field.DatItem_ChipType))
|
if (fields.Contains(Field.DatItem_ChipType))
|
||||||
ChipType = null;
|
ChipType = ChipType.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.DatItem_Clock))
|
if (fields.Contains(Field.DatItem_Clock))
|
||||||
Clock = null;
|
Clock = null;
|
||||||
|
|||||||
@@ -37,19 +37,19 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Conditions associated with the configuration
|
/// Conditions associated with the configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Condition> Conditions { get; set; }
|
public List<Condition> Conditions { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locations associated with the configuration
|
/// Locations associated with the configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("locations")]
|
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Location> Locations { get; set; }
|
public List<Location> Locations { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings associated with the configuration
|
/// Settings associated with the configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("settings")]
|
[JsonProperty("settings", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Setting> Settings { get; set; }
|
public List<Setting> Settings { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -37,19 +37,19 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Conditions associated with the dipswitch
|
/// Conditions associated with the dipswitch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("conditions")]
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Condition> Conditions { get; set; }
|
public List<Condition> Conditions { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locations associated with the dipswitch
|
/// Locations associated with the dipswitch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("locations")]
|
[JsonProperty("locations", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Location> Locations { get; set; }
|
public List<Location> Locations { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings associated with the dipswitch
|
/// Settings associated with the dipswitch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("values")]
|
[JsonProperty("values", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Setting> Values { get; set; }
|
public List<Setting> Values { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -2,6 +2,22 @@
|
|||||||
|
|
||||||
namespace SabreTools.Library.DatItems
|
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>
|
/// <summary>
|
||||||
/// Determines which type of duplicate a file is
|
/// Determines which type of duplicate a file is
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -17,6 +33,21 @@ namespace SabreTools.Library.DatItems
|
|||||||
External = 1 << 3,
|
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>
|
/// <summary>
|
||||||
/// Determine the feature type
|
/// Determine the feature type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using SabreTools.Library.Filtering;
|
using SabreTools.Library.Filtering;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace SabreTools.Library.DatItems
|
namespace SabreTools.Library.DatItems
|
||||||
{
|
{
|
||||||
@@ -18,20 +19,23 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Type of feature
|
/// Type of feature
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("type")]
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public FeatureType Type { get; set; }
|
public FeatureType Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Emulation status
|
/// Emulation status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("status")]
|
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Status { get; set; } // TODO: (unemulated|imperfect)
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public EmulationStatus Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overall status
|
/// Overall status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("overall")]
|
[JsonProperty("overall", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Overall { get; set; } // TODO: (unemulated|imperfect)
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public EmulationStatus Overall { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -51,10 +55,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
Type = mappings[Field.DatItem_FeatureType].AsFeatureType();
|
Type = mappings[Field.DatItem_FeatureType].AsFeatureType();
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.DatItem_FeatureStatus))
|
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))
|
if (mappings.Keys.Contains(Field.DatItem_FeatureOverall))
|
||||||
Overall = mappings[Field.DatItem_FeatureOverall];
|
Overall = mappings[Field.DatItem_FeatureOverall].AsEmulationStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -147,15 +151,15 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on status
|
// Filter on status
|
||||||
if (filter.DatItem_FeatureStatus.MatchesPositiveSet(Status) == false)
|
if (filter.DatItem_FeatureStatus.MatchesPositive(EmulationStatus.NULL, Status) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.DatItem_FeatureStatus.MatchesNegativeSet(Status) == true)
|
if (filter.DatItem_FeatureStatus.MatchesNegative(EmulationStatus.NULL, Status) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on overall
|
// Filter on overall
|
||||||
if (filter.DatItem_FeatureOverall.MatchesPositiveSet(Overall) == false)
|
if (filter.DatItem_FeatureOverall.MatchesPositive(EmulationStatus.NULL, Overall) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.DatItem_FeatureOverall.MatchesNegativeSet(Overall) == true)
|
if (filter.DatItem_FeatureOverall.MatchesNegative(EmulationStatus.NULL, Overall) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -175,10 +179,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
Type = FeatureType.NULL;
|
Type = FeatureType.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.DatItem_FeatureStatus))
|
if (fields.Contains(Field.DatItem_FeatureStatus))
|
||||||
Status = null;
|
Status = EmulationStatus.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.DatItem_FeatureOverall))
|
if (fields.Contains(Field.DatItem_FeatureOverall))
|
||||||
Overall = null;
|
Overall = EmulationStatus.NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Slot options associated with the slot
|
/// Slot options associated with the slot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("slotoptions")]
|
[JsonProperty("slotoptions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<SlotOption> SlotOptions { get; set; }
|
public List<SlotOption> SlotOptions { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using SabreTools.Library.Filtering;
|
using SabreTools.Library.Filtering;
|
||||||
using SabreTools.Library.Tools;
|
using SabreTools.Library.Tools;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace SabreTools.Library.DatItems
|
namespace SabreTools.Library.DatItems
|
||||||
{
|
{
|
||||||
@@ -26,6 +27,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// Status of the softare list according to the machine
|
/// Status of the softare list according to the machine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public SoftwareListStatus Status { get; set; }
|
public SoftwareListStatus Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of channels
|
/// Number of channels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("channels")]
|
[JsonProperty("channels", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Channels { get; set; } // TODO: Int32?
|
public string Channels { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
// Chip
|
// Chip
|
||||||
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_ChipType { get; private set; } = new FilterItem<string>();
|
public FilterItem<ChipType> DatItem_ChipType { get; private set; } = new FilterItem<ChipType>() { Positive = ChipType.NULL, Negative = ChipType.NULL };
|
||||||
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
@@ -296,8 +296,8 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
// Feature
|
// Feature
|
||||||
public FilterItem<FeatureType> DatItem_FeatureType { get; private set; } = new FilterItem<FeatureType>() { Positive = FeatureType.NULL, Negative = FeatureType.NULL };
|
public FilterItem<FeatureType> DatItem_FeatureType { get; private set; } = new FilterItem<FeatureType>() { Positive = FeatureType.NULL, Negative = FeatureType.NULL };
|
||||||
public FilterItem<string> DatItem_FeatureStatus { get; private set; } = new FilterItem<string>();
|
public FilterItem<EmulationStatus> DatItem_FeatureStatus { get; private set; } = new FilterItem<EmulationStatus>() { Positive = EmulationStatus.NULL, Negative = EmulationStatus.NULL };
|
||||||
public FilterItem<string> DatItem_FeatureOverall { get; private set; } = new FilterItem<string>();
|
public FilterItem<EmulationStatus> DatItem_FeatureOverall { get; private set; } = new FilterItem<EmulationStatus>() { Positive = EmulationStatus.NULL, Negative = EmulationStatus.NULL };
|
||||||
|
|
||||||
|
|
||||||
// Ram Option
|
// Ram Option
|
||||||
@@ -1590,9 +1590,9 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
case Field.DatItem_ChipType:
|
case Field.DatItem_ChipType:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_ChipType.NegativeSet.Add(value);
|
DatItem_ChipType.Negative |= value.AsChipType();
|
||||||
else
|
else
|
||||||
DatItem_ChipType.PositiveSet.Add(value);
|
DatItem_ChipType.Positive |= value.AsChipType();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Clock:
|
case Field.DatItem_Clock:
|
||||||
@@ -1707,16 +1707,16 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
case Field.DatItem_FeatureStatus:
|
case Field.DatItem_FeatureStatus:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_FeatureStatus.NegativeSet.Add(value);
|
DatItem_FeatureStatus.Negative |= value.AsEmulationStatus();
|
||||||
else
|
else
|
||||||
DatItem_FeatureStatus.PositiveSet.Add(value);
|
DatItem_FeatureStatus.Positive |= value.AsEmulationStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_FeatureOverall:
|
case Field.DatItem_FeatureOverall:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_FeatureOverall.NegativeSet.Add(value);
|
DatItem_FeatureOverall.Negative |= value.AsEmulationStatus();
|
||||||
else
|
else
|
||||||
DatItem_FeatureOverall.PositiveSet.Add(value);
|
DatItem_FeatureOverall.Positive |= value.AsEmulationStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Ram Option
|
// Ram Option
|
||||||
|
|||||||
@@ -66,6 +66,33 @@ namespace SabreTools.Library.Tools
|
|||||||
|
|
||||||
#region String to Enum
|
#region String to Enum
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get ChipType value from input string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="chipType">String to get value from</param>
|
||||||
|
/// <returns>ChipType value corresponding to the string</returns>
|
||||||
|
public static ChipType AsChipType(this string chipType)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (chipType?.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "cpu":
|
||||||
|
return ChipType.CPU;
|
||||||
|
case "audio":
|
||||||
|
return ChipType.Audio;
|
||||||
|
default:
|
||||||
|
return ChipType.NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return chipType?.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"cpu" => ChipType.CPU,
|
||||||
|
"audio" => ChipType.Audio,
|
||||||
|
_ => ChipType.NULL,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get DatFormat value from input string
|
/// Get DatFormat value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -145,10 +172,37 @@ namespace SabreTools.Library.Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get EmulationStatus value from input string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="emulationStatus">String to get value from</param>
|
||||||
|
/// <returns>EmulationStatus value corresponding to the string</returns>
|
||||||
|
public static EmulationStatus AsEmulationStatus(this string emulationStatus)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (emulationStatus?.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "unemulated":
|
||||||
|
return EmulationStatus.Unemulated;
|
||||||
|
case "imperfect":
|
||||||
|
return EmulationStatus.Imperfect;
|
||||||
|
default:
|
||||||
|
return EmulationStatus.NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return emulationStatus?.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"unemulated" => EmulationStatus.Unemulated,
|
||||||
|
"imperfect" => EmulationStatus.Imperfect,
|
||||||
|
_ => EmulationStatus.NULL,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get FeatureType value from input string
|
/// Get FeatureType value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="featureType">String to get value from</param>
|
/// <param name="emulationStatus">String to get value from</param>
|
||||||
/// <returns>FeatureType value corresponding to the string</returns>
|
/// <returns>FeatureType value corresponding to the string</returns>
|
||||||
public static FeatureType AsFeatureType(this string featureType)
|
public static FeatureType AsFeatureType(this string featureType)
|
||||||
{
|
{
|
||||||
@@ -2018,6 +2072,60 @@ namespace SabreTools.Library.Tools
|
|||||||
// TODO: DatFormat -> string
|
// TODO: DatFormat -> string
|
||||||
// TODO: Field -> string
|
// TODO: Field -> string
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get string value from input ChipType
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="chipType">ChipType to get value from</param>
|
||||||
|
/// <returns>String value corresponding to the ChipType</returns>
|
||||||
|
public static string FromChipType(this ChipType chipType)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (chipType)
|
||||||
|
{
|
||||||
|
case ChipType.CPU:
|
||||||
|
return "cpu";
|
||||||
|
case ChipType.Audio:
|
||||||
|
return "audio";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return chipType switch
|
||||||
|
{
|
||||||
|
ChipType.CPU => "cpu",
|
||||||
|
ChipType.Audio => "audio",
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get string value from input EmulationStatus
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="emulationStatus">EmulationStatus to get value from</param>
|
||||||
|
/// <returns>String value corresponding to the EmulationStatus</returns>
|
||||||
|
public static string FromEmulationStatus(this EmulationStatus emulationStatus)
|
||||||
|
{
|
||||||
|
#if NET_FRAMEWORK
|
||||||
|
switch (emulationStatus)
|
||||||
|
{
|
||||||
|
case EmulationStatus.Unemulated:
|
||||||
|
return "unemulated";
|
||||||
|
case EmulationStatus.Imperfect:
|
||||||
|
return "imperfect";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return emulationStatus switch
|
||||||
|
{
|
||||||
|
EmulationStatus.Unemulated => "unemulated",
|
||||||
|
EmulationStatus.Imperfect => "imperfect",
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get string value from input FeatureType
|
/// Get string value from input FeatureType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user