mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Part is only part of DipSwitch, Disk, and Rom
This commit is contained in:
@@ -313,7 +313,19 @@ namespace SabreTools.Library.DatFiles
|
||||
foreach (DatItem item in items)
|
||||
{
|
||||
// Add all missing information
|
||||
item.Part = part;
|
||||
switch (item.ItemType)
|
||||
{
|
||||
case ItemType.DipSwitch:
|
||||
(item as DipSwitch).Part = part;
|
||||
break;
|
||||
case ItemType.Disk:
|
||||
(item as Disk).Part = part;
|
||||
break;
|
||||
case ItemType.Rom:
|
||||
(item as Rom).Part = part;
|
||||
break;
|
||||
}
|
||||
|
||||
item.Source = new Source(indexId, filename);
|
||||
item.CopyMachineInformation(machine);
|
||||
|
||||
@@ -693,12 +705,12 @@ namespace SabreTools.Library.DatFiles
|
||||
diskAreaName = "cdrom";
|
||||
|
||||
xtw.WriteStartElement("part");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", datItem.Part?.Interface);
|
||||
xtw.WriteRequiredAttributeString("name", disk.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", disk.Part?.Interface);
|
||||
|
||||
if (datItem.Part?.Features != null && datItem.Part?.Features.Count > 0)
|
||||
if (disk.Part?.Features != null && disk.Part?.Features.Count > 0)
|
||||
{
|
||||
foreach (PartFeature partFeature in datItem.Part.Features)
|
||||
foreach (PartFeature partFeature in disk.Part.Features)
|
||||
{
|
||||
xtw.WriteStartElement("feature");
|
||||
xtw.WriteRequiredAttributeString("name", partFeature.Name);
|
||||
@@ -740,12 +752,12 @@ namespace SabreTools.Library.DatFiles
|
||||
dataAreaName = "rom";
|
||||
|
||||
xtw.WriteStartElement("part");
|
||||
xtw.WriteRequiredAttributeString("name", datItem.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", datItem.Part?.Interface);
|
||||
xtw.WriteRequiredAttributeString("name", rom.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", rom.Part?.Interface);
|
||||
|
||||
if (datItem.Part?.Features != null && datItem.Part?.Features.Count > 0)
|
||||
if (rom.Part?.Features != null && rom.Part?.Features.Count > 0)
|
||||
{
|
||||
foreach (PartFeature kvp in datItem.Part.Features)
|
||||
foreach (PartFeature kvp in rom.Part.Features)
|
||||
{
|
||||
xtw.WriteStartElement("feature");
|
||||
xtw.WriteRequiredAttributeString("name", kvp.Name);
|
||||
|
||||
@@ -107,7 +107,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -146,7 +146,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -170,7 +170,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -104,12 +104,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList Fields
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Part Part { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SoftwareList value associated with the item
|
||||
/// </summary>
|
||||
@@ -769,18 +763,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
// Filter on part name
|
||||
if (filter.DatItem_Part_Name.MatchesPositiveSet(Part?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Name.MatchesNegativeSet(Part?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part interface
|
||||
if (filter.DatItem_Part_Interface.MatchesPositiveSet(Part?.Interface) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Interface.MatchesNegativeSet(Part?.Interface) == true)
|
||||
return false;
|
||||
|
||||
// Filter on softwarelist value
|
||||
if (filter.DatItem_Value.MatchesPositiveSet(Value) == false)
|
||||
return false;
|
||||
@@ -838,15 +820,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name) && Part != null)
|
||||
Part.Name = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface) && Part != null)
|
||||
Part.Interface = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features) && Part != null)
|
||||
Part.Features = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = null;
|
||||
|
||||
@@ -974,30 +947,6 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Name = item.Part?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Interface = item.Part?.Interface;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Features = item.Part?.Features;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = item.Value;
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace SabreTools.Library.DatItems
|
||||
{
|
||||
#region Fields
|
||||
|
||||
#region Common
|
||||
|
||||
/// <summary>
|
||||
/// Name of the item
|
||||
/// </summary>
|
||||
@@ -54,6 +56,18 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Part Part { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
@@ -123,7 +137,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -136,6 +149,8 @@ namespace SabreTools.Library.DatItems
|
||||
Conditions = this.Conditions,
|
||||
Locations = this.Locations,
|
||||
Values = this.Values,
|
||||
|
||||
Part = this.Part,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -202,6 +217,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
#region Common
|
||||
|
||||
// Filter on item name
|
||||
if (filter.DatItem_Name.MatchesPositiveSet(Name) == false)
|
||||
return false;
|
||||
@@ -224,6 +241,24 @@ namespace SabreTools.Library.DatItems
|
||||
// TODO: Handle DatItem_Location*
|
||||
// TODO: Handle DatItem_Value*
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
// Filter on part name
|
||||
if (filter.DatItem_Part_Name.MatchesPositiveSet(Part?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Name.MatchesNegativeSet(Part?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part interface
|
||||
if (filter.DatItem_Part_Interface.MatchesPositiveSet(Part?.Interface) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Interface.MatchesNegativeSet(Part?.Interface) == true)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -237,6 +272,9 @@ namespace SabreTools.Library.DatItems
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = null;
|
||||
|
||||
@@ -258,6 +296,21 @@ namespace SabreTools.Library.DatItems
|
||||
// TODO: Handle DatItem_Condition*
|
||||
// TODO: Handle DatItem_Location*
|
||||
// TODO: Handle DatItem_Value*
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name) && Part != null)
|
||||
Part.Name = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface) && Part != null)
|
||||
Part.Interface = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features) && Part != null)
|
||||
Part.Features = null;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,6 +345,9 @@ namespace SabreTools.Library.DatItems
|
||||
DipSwitch newItem = item as DipSwitch;
|
||||
|
||||
// Replace the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = newItem.Name;
|
||||
|
||||
@@ -313,6 +369,36 @@ namespace SabreTools.Library.DatItems
|
||||
// TODO: Handle DatItem_Condition*
|
||||
// TODO: Handle DatItem_Location*
|
||||
// TODO: Handle DatItem_Value*
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Name = newItem.Part?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Interface = newItem.Part?.Interface;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Features = newItem.Part?.Features;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -100,6 +100,12 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("diskarea", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DiskArea DiskArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Part Part { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Fields
|
||||
@@ -212,7 +218,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -230,6 +235,7 @@ namespace SabreTools.Library.DatItems
|
||||
Optional = this.Optional,
|
||||
|
||||
DiskArea = this.DiskArea,
|
||||
Part = this.Part,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -254,7 +260,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -271,6 +276,7 @@ namespace SabreTools.Library.DatItems
|
||||
SHA1 = this.SHA1,
|
||||
|
||||
DataArea = new DataArea { Name = this.DiskArea.Name },
|
||||
Part = this.Part,
|
||||
};
|
||||
|
||||
return rom;
|
||||
@@ -418,6 +424,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
#region Common
|
||||
|
||||
// Filter on item name
|
||||
if (filter.DatItem_Name.MatchesPositiveSet(Name) == false)
|
||||
return false;
|
||||
@@ -468,12 +476,30 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_Optional.MatchesNeutral(null, Optional) == false)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
// Filter on area name
|
||||
if (filter.DatItem_AreaName.MatchesPositiveSet(DiskArea?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaName.MatchesNegativeSet(DiskArea?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part name
|
||||
if (filter.DatItem_Part_Name.MatchesPositiveSet(Part?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Name.MatchesNegativeSet(Part?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part interface
|
||||
if (filter.DatItem_Part_Interface.MatchesPositiveSet(Part?.Interface) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Interface.MatchesNegativeSet(Part?.Interface) == true)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -487,6 +513,9 @@ namespace SabreTools.Library.DatItems
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = null;
|
||||
|
||||
@@ -514,11 +543,26 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Optional))
|
||||
Optional = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DiskArea != null)
|
||||
DiskArea.Name = null;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name) && Part != null)
|
||||
Part.Name = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface) && Part != null)
|
||||
Part.Interface = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features) && Part != null)
|
||||
Part.Features = null;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -588,6 +632,9 @@ namespace SabreTools.Library.DatItems
|
||||
Disk newItem = item as Disk;
|
||||
|
||||
// Replace the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = newItem.Name;
|
||||
|
||||
@@ -621,6 +668,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Optional))
|
||||
Optional = newItem.Optional;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DiskArea == null)
|
||||
@@ -628,6 +679,32 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
DiskArea.Name = newItem.DiskArea?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Name = newItem.Part?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Interface = newItem.Part?.Interface;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Features = newItem.Part?.Features;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -187,7 +187,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -148,7 +148,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -183,7 +182,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -179,6 +179,12 @@ namespace SabreTools.Library.DatItems
|
||||
[JsonProperty("dataarea", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DataArea DataArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Part Part { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Fields
|
||||
@@ -374,7 +380,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
@@ -402,6 +407,7 @@ namespace SabreTools.Library.DatItems
|
||||
Inverted = this.Inverted,
|
||||
|
||||
DataArea = this.DataArea,
|
||||
Part = this.Part,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -602,6 +608,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
#region Common
|
||||
|
||||
// Filter on item name
|
||||
if (filter.DatItem_Name.MatchesPositiveSet(Name) == false)
|
||||
return false;
|
||||
@@ -704,6 +712,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_Inverted.MatchesNeutral(null, Inverted) == false)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
// Filter on area name
|
||||
if (filter.DatItem_AreaName.MatchesPositiveSet(DataArea?.Name) == false)
|
||||
return false;
|
||||
@@ -730,6 +742,20 @@ namespace SabreTools.Library.DatItems
|
||||
if (filter.DatItem_AreaEndianness.MatchesNegativeSet(DataArea?.Endianness) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part name
|
||||
if (filter.DatItem_Part_Name.MatchesPositiveSet(Part?.Name) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Name.MatchesNegativeSet(Part?.Name) == true)
|
||||
return false;
|
||||
|
||||
// Filter on part interface
|
||||
if (filter.DatItem_Part_Interface.MatchesPositiveSet(Part?.Interface) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Part_Interface.MatchesNegativeSet(Part?.Interface) == true)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -743,6 +769,9 @@ namespace SabreTools.Library.DatItems
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = null;
|
||||
|
||||
@@ -796,6 +825,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Inverted))
|
||||
Inverted = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DataArea != null)
|
||||
@@ -819,6 +852,17 @@ namespace SabreTools.Library.DatItems
|
||||
if (DataArea != null)
|
||||
DataArea.Endianness = null;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name) && Part != null)
|
||||
Part.Name = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface) && Part != null)
|
||||
Part.Interface = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features) && Part != null)
|
||||
Part.Features = null;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -910,6 +954,9 @@ namespace SabreTools.Library.DatItems
|
||||
Rom newItem = item as Rom;
|
||||
|
||||
// Replace the fields
|
||||
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = newItem.Name;
|
||||
|
||||
@@ -984,6 +1031,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Inverted))
|
||||
Inverted = newItem.Inverted;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(Field.DatItem_AreaName))
|
||||
{
|
||||
if (DataArea == null)
|
||||
@@ -1015,6 +1066,32 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
DataArea.Endianness = newItem.DataArea?.Endianness;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Name))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Name = newItem.Part?.Name;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Interface = newItem.Part?.Interface;
|
||||
}
|
||||
|
||||
if (fields.Contains(Field.DatItem_Features))
|
||||
{
|
||||
if (Part == null)
|
||||
Part = new Part();
|
||||
|
||||
Part.Features = newItem.Part?.Features;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ namespace SabreTools.Library.DatItems
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user