mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Create and use DiskArea/DataArea
This has the added benefit of clearing out a lot of boilerplate for new DatItem types, since DiskArea only pertains to the Disk type and DataArea only pertains to the Rom type
This commit is contained in:
@@ -108,11 +108,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -71,11 +71,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -84,11 +84,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -34,6 +34,75 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList dataarea object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// One DataArea can contain multiple Rom items
|
||||
/// </remarks>
|
||||
[JsonObject("dataarea")]
|
||||
public class DataArea
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total size of the area
|
||||
/// </summary>
|
||||
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Byte width of the area
|
||||
/// </summary>
|
||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Width { get; set; } // TODO: (8|16|32|64) "8"
|
||||
|
||||
/// <summary>
|
||||
/// Byte endianness of the area
|
||||
/// </summary>
|
||||
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Endianness { get; set; } // TODO: (big|little) "little"
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList diskarea object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// One DiskArea can contain multiple Disk items
|
||||
/// </remarks>
|
||||
[JsonObject("diskarea")]
|
||||
public class DiskArea
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList part object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// One Part can contain multiple PartFeature, DataArea, DiskArea, and DipSwitch items
|
||||
/// </remarks>
|
||||
[JsonObject("part")]
|
||||
public class Part
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("interface")]
|
||||
public string Interface { get; set; }
|
||||
|
||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<PartFeature> Features { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList feature object
|
||||
/// </summary>
|
||||
@@ -48,19 +117,6 @@ namespace SabreTools.Library.DatItems
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one SoftwareList part object
|
||||
/// </summary>
|
||||
[JsonObject("part")]
|
||||
public class SoftwareListPart
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("interface")]
|
||||
public string Interface { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion //DatItem
|
||||
|
||||
@@ -102,11 +102,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -39,11 +39,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -113,11 +113,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -106,11 +106,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -147,11 +147,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -171,11 +171,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -108,39 +108,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public SoftwareListPart Part { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Features provided to/by the item
|
||||
/// </summary>
|
||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<PartFeature> Features { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part name within an item
|
||||
/// </summary>
|
||||
[JsonProperty("areaname", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware size within the part
|
||||
/// </summary>
|
||||
[JsonProperty("areasize", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? AreaSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of the data area in bytes
|
||||
/// </summary>
|
||||
/// TODO: Convert to Int32
|
||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaWidth { get; set; } // (8|16|32|64) "8"
|
||||
|
||||
/// <summary>
|
||||
/// Endianness of the data area
|
||||
/// </summary>
|
||||
/// TODO: Convert to Enum?
|
||||
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaEndianness { get; set; } // (big|little) "little"
|
||||
public Part Part { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SoftwareList value associated with the item
|
||||
@@ -414,22 +382,6 @@ namespace SabreTools.Library.DatItems
|
||||
// TODO: Add DatItem_Part*
|
||||
// TODO: Add DatItem_Feature*
|
||||
|
||||
// TODO: These might be replaced by dataarea/diskarea
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaName))
|
||||
AreaName = mappings[Field.DatItem_AreaName];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaSize))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_AreaSize], out long areaSize))
|
||||
AreaSize = areaSize;
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaWidth))
|
||||
AreaWidth = mappings[Field.DatItem_AreaWidth];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaEndianness))
|
||||
AreaEndianness = mappings[Field.DatItem_AreaEndianness];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Value))
|
||||
Value = mappings[Field.DatItem_Value];
|
||||
|
||||
@@ -829,32 +781,6 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_Part_Interface.MatchesNegativeSet(Part?.Interface) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area name
|
||||
if (filter.DatItem_AreaName.MatchesPositiveSet(AreaName) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaName.MatchesNegativeSet(AreaName) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area size
|
||||
if (filter.DatItem_AreaSize.MatchesNeutral(null, AreaSize) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_AreaSize.MatchesPositive(null, AreaSize) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_AreaSize.MatchesNegative(null, AreaSize) == false)
|
||||
return false;
|
||||
|
||||
// Filter on area byte width
|
||||
if (filter.DatItem_AreaWidth.MatchesPositiveSet(AreaWidth) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaWidth.MatchesNegativeSet(AreaWidth) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area endianness
|
||||
if (filter.DatItem_AreaEndianness.MatchesPositiveSet(AreaEndianness) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaEndianness.MatchesNegativeSet(AreaEndianness) == true)
|
||||
return false;
|
||||
|
||||
// Filter on softwarelist value
|
||||
if (filter.DatItem_Value.MatchesPositiveSet(Value) == false)
|
||||
return false;
|
||||
@@ -918,20 +844,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Part_Interface) && Part != null)
|
||||
Part.Interface = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
Features = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
AreaName = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaSize))
|
||||
AreaSize = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaWidth))
|
||||
AreaWidth = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaEndianness))
|
||||
AreaEndianness = null;
|
||||
if (fields.Contains(Field.DatItem_Features) && Part != null)
|
||||
Part.Features = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = null;
|
||||
@@ -1063,7 +977,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Part_Name))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new SoftwareListPart();
|
||||
Part = new Part();
|
||||
|
||||
Part.Name = item.Part?.Name;
|
||||
}
|
||||
@@ -1071,25 +985,18 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new SoftwareListPart();
|
||||
Part = new Part();
|
||||
|
||||
Part.Interface = item.Part?.Interface;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
Features = item.Features;
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
AreaName = item.AreaName;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaSize))
|
||||
AreaSize = item.AreaSize;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaWidth))
|
||||
AreaWidth = item.AreaWidth;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaEndianness))
|
||||
AreaEndianness = item.AreaEndianness;
|
||||
Part.Features = item.Part?.Features;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = item.Value;
|
||||
|
||||
@@ -122,11 +122,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -84,11 +84,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -124,11 +124,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region Fields
|
||||
|
||||
#region Common
|
||||
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
@@ -90,6 +92,18 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
/// Disk area information
|
||||
/// </summary>
|
||||
[JsonProperty("diskarea", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DiskArea DiskArea { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
@@ -137,6 +151,14 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Optional))
|
||||
Optional = mappings[Field.DatItem_Optional].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DiskArea == null)
|
||||
DiskArea = new DiskArea();
|
||||
|
||||
DiskArea.Name = mappings[Field.DatItem_AreaName];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -191,11 +213,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -211,6 +228,8 @@ namespace SabreTools.Library.DatItems
|
||||
Writable = this.Writable,
|
||||
ItemStatus = this.ItemStatus,
|
||||
Optional = this.Optional,
|
||||
|
||||
DiskArea = this.DiskArea,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -236,11 +255,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -255,6 +269,8 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
MD5 = this.MD5,
|
||||
SHA1 = this.SHA1,
|
||||
|
||||
DataArea = new DataArea { Name = this.DiskArea.Name },
|
||||
};
|
||||
|
||||
return rom;
|
||||
@@ -452,6 +468,12 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_Optional.MatchesNeutral(null, Optional) == false)
|
||||
return false;
|
||||
|
||||
// Filter on area name
|
||||
if (filter.DatItem_AreaName.MatchesPositiveSet(DiskArea?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaName.MatchesNegativeSet(DiskArea?.Name) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -491,6 +513,12 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (fields.Contains(Field.DatItem_Optional))
|
||||
Optional = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DiskArea != null)
|
||||
DiskArea.Name = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -592,6 +620,14 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (fields.Contains(Field.DatItem_Optional))
|
||||
Optional = newItem.Optional;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DiskArea == null)
|
||||
DiskArea = new DiskArea();
|
||||
|
||||
DiskArea.Name = newItem.DiskArea?.Name;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -188,11 +188,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -104,11 +104,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -84,11 +84,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -94,11 +94,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -92,11 +92,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -106,11 +106,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -93,11 +93,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -101,11 +101,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -149,11 +149,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -189,11 +184,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -81,11 +81,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -102,11 +102,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -124,11 +124,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region Fields
|
||||
|
||||
#region Common
|
||||
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
@@ -169,6 +171,18 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
/// Data area information
|
||||
/// </summary>
|
||||
[JsonProperty("dataarea", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DataArea DataArea { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
@@ -245,6 +259,39 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Inverted))
|
||||
Inverted = mappings[Field.DatItem_Optional].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Name = mappings[Field.DatItem_AreaName];
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaSize))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
if (Int64.TryParse(mappings[Field.DatItem_AreaSize], out long areaSize))
|
||||
DataArea.Size = areaSize;
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaWidth))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Width = mappings[Field.DatItem_AreaWidth];
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaEndianness))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Endianness = mappings[Field.DatItem_AreaEndianness];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -328,11 +375,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -358,6 +400,8 @@ namespace SabreTools.Library.DatItems
|
||||
ItemStatus = this.ItemStatus,
|
||||
Optional = this.Optional,
|
||||
Inverted = this.Inverted,
|
||||
|
||||
DataArea = this.DataArea,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -660,6 +704,32 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_Inverted.MatchesNeutral(null, Inverted) == false)
|
||||
return false;
|
||||
|
||||
// Filter on area name
|
||||
if (filter.DatItem_AreaName.MatchesPositiveSet(DataArea?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaName.MatchesNegativeSet(DataArea?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area size
|
||||
if (filter.DatItem_AreaSize.MatchesNeutral(null, DataArea?.Size) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_AreaSize.MatchesPositive(null, DataArea?.Size) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_AreaSize.MatchesNegative(null, DataArea?.Size) == false)
|
||||
return false;
|
||||
|
||||
// Filter on area byte width
|
||||
if (filter.DatItem_AreaWidth.MatchesPositiveSet(DataArea?.Width) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaWidth.MatchesNegativeSet(DataArea?.Width) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area endianness
|
||||
if (filter.DatItem_AreaEndianness.MatchesPositiveSet(DataArea?.Endianness) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaEndianness.MatchesNegativeSet(DataArea?.Endianness) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -725,6 +795,30 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (fields.Contains(Field.DatItem_Inverted))
|
||||
Inverted = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DataArea != null)
|
||||
DataArea.Name = null;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaSize))
|
||||
{
|
||||
if (DataArea != null)
|
||||
DataArea.Size = null;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaWidth))
|
||||
{
|
||||
if (DataArea != null)
|
||||
DataArea.Width = null;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaEndianness))
|
||||
{
|
||||
if (DataArea != null)
|
||||
DataArea.Endianness = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -889,6 +983,38 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
if (fields.Contains(Field.DatItem_Inverted))
|
||||
Inverted = newItem.Inverted;
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Name = newItem.DataArea?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaSize))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Size = newItem.DataArea?.Size;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaWidth))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Width = newItem.DataArea?.Width;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaEndianness))
|
||||
{
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Endianness = newItem.DataArea?.Endianness;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -84,11 +84,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -116,11 +116,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -92,11 +92,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -92,11 +92,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -101,11 +101,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -104,11 +104,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -71,11 +71,6 @@ namespace SabreTools.Library.DatItems
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user