mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Device
This commit is contained in:
@@ -119,6 +119,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public long ConfigurationCount { get; private set; } = 0;
|
public long ConfigurationCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Device items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long DeviceCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Device Reference items
|
/// Number of Device Reference items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -544,6 +550,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
ConfigurationCount++;
|
ConfigurationCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Device:
|
||||||
|
DeviceCount++;
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
DeviceReferenceCount++;
|
DeviceReferenceCount++;
|
||||||
break;
|
break;
|
||||||
@@ -709,6 +718,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
ConfigurationCount--;
|
ConfigurationCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Device:
|
||||||
|
DeviceCount--;
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
DeviceReferenceCount--;
|
DeviceReferenceCount--;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
datItem = datItemObj.ToObject<Configuration>();
|
datItem = datItemObj.ToObject<Configuration>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Device:
|
||||||
|
datItem = datItemObj.ToObject<Device>();
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
datItem = datItemObj.ToObject<DeviceReference>();
|
datItem = datItemObj.ToObject<DeviceReference>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -268,6 +268,31 @@ namespace SabreTools.Library.DatFiles
|
|||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "device":
|
||||||
|
var device = new Device
|
||||||
|
{
|
||||||
|
DeviceType = reader.GetAttribute("type"),
|
||||||
|
Tag = reader.GetAttribute("tag"),
|
||||||
|
FixedImage = reader.GetAttribute("fixed_image"),
|
||||||
|
Mandatory = reader.GetAttribute("mandatory"),
|
||||||
|
Interface = reader.GetAttribute("interface"),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Now read the internal tags
|
||||||
|
ReadDevice(reader.ReadSubtree(), device);
|
||||||
|
|
||||||
|
datItems.Add(device);
|
||||||
|
|
||||||
|
// Skip the device now that we've processed it
|
||||||
|
reader.Skip();
|
||||||
|
break;
|
||||||
|
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
datItems.Add(new DeviceReference
|
datItems.Add(new DeviceReference
|
||||||
{
|
{
|
||||||
@@ -538,27 +563,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "device":
|
|
||||||
var device = new Device();
|
|
||||||
device.Type = reader.GetAttribute("type");
|
|
||||||
device.Tag = reader.GetAttribute("tag");
|
|
||||||
device.FixedImage = reader.GetAttribute("fixed_image");
|
|
||||||
device.Mandatory = reader.GetAttribute("mandatory");
|
|
||||||
device.Interface = reader.GetAttribute("interface");
|
|
||||||
|
|
||||||
// Now read the internal tags
|
|
||||||
ReadDevice(reader.ReadSubtree(), device);
|
|
||||||
|
|
||||||
// Ensure the list exists
|
|
||||||
if (machine.Devices == null)
|
|
||||||
machine.Devices = new List<Device>();
|
|
||||||
|
|
||||||
machine.Devices.Add(device);
|
|
||||||
|
|
||||||
// Skip the device now that we've processed it
|
|
||||||
reader.Skip();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1317,38 +1321,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (datItem.Machine.Devices != null)
|
|
||||||
{
|
|
||||||
foreach (var device in datItem.Machine.Devices)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("device");
|
|
||||||
xtw.WriteOptionalAttributeString("type", device.Type);
|
|
||||||
xtw.WriteOptionalAttributeString("tag", device.Tag);
|
|
||||||
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
|
||||||
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory);
|
|
||||||
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
|
||||||
if (device.Instances != null)
|
|
||||||
{
|
|
||||||
foreach (var instance in device.Instances)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("instance");
|
|
||||||
xtw.WriteOptionalAttributeString("name", instance.Name);
|
|
||||||
xtw.WriteOptionalAttributeString("briefname", instance.BriefName);
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (device.Extensions != null)
|
|
||||||
{
|
|
||||||
foreach (var extension in device.Extensions)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("extension");
|
|
||||||
xtw.WriteOptionalAttributeString("name", extension.Name);
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xtw.Flush();
|
xtw.Flush();
|
||||||
}
|
}
|
||||||
@@ -1493,6 +1465,36 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Device:
|
||||||
|
var device = datItem as Device;
|
||||||
|
xtw.WriteStartElement("device");
|
||||||
|
xtw.WriteOptionalAttributeString("type", device.DeviceType);
|
||||||
|
xtw.WriteOptionalAttributeString("tag", device.Tag);
|
||||||
|
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
||||||
|
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory);
|
||||||
|
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
||||||
|
if (device.Instances != null)
|
||||||
|
{
|
||||||
|
foreach (var instance in device.Instances)
|
||||||
|
{
|
||||||
|
xtw.WriteStartElement("instance");
|
||||||
|
xtw.WriteOptionalAttributeString("name", instance.Name);
|
||||||
|
xtw.WriteOptionalAttributeString("briefname", instance.BriefName);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (device.Extensions != null)
|
||||||
|
{
|
||||||
|
foreach (var extension in device.Extensions)
|
||||||
|
{
|
||||||
|
xtw.WriteStartElement("extension");
|
||||||
|
xtw.WriteOptionalAttributeString("name", extension.Name);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
var deviceRef = datItem as DeviceReference;
|
var deviceRef = datItem as DeviceReference;
|
||||||
xtw.WriteStartElement("device_ref");
|
xtw.WriteStartElement("device_ref");
|
||||||
|
|||||||
@@ -1322,6 +1322,37 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Device:
|
||||||
|
var device = datItem as Device;
|
||||||
|
xtw.WriteStartElement("file");
|
||||||
|
xtw.WriteAttributeString("type", "device");
|
||||||
|
xtw.WriteOptionalAttributeString("type", device.DeviceType);
|
||||||
|
xtw.WriteOptionalAttributeString("tag", device.Tag);
|
||||||
|
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
||||||
|
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory);
|
||||||
|
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
||||||
|
if (device.Instances != null)
|
||||||
|
{
|
||||||
|
foreach (var instance in device.Instances)
|
||||||
|
{
|
||||||
|
xtw.WriteStartElement("instance");
|
||||||
|
xtw.WriteOptionalAttributeString("name", instance.Name);
|
||||||
|
xtw.WriteOptionalAttributeString("briefname", instance.BriefName);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (device.Extensions != null)
|
||||||
|
{
|
||||||
|
foreach (var extension in device.Extensions)
|
||||||
|
{
|
||||||
|
xtw.WriteStartElement("extension");
|
||||||
|
xtw.WriteOptionalAttributeString("name", extension.Name);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
var deviceRef = datItem as DeviceReference;
|
var deviceRef = datItem as DeviceReference;
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
|
|||||||
@@ -98,60 +98,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents one ListXML device
|
|
||||||
/// </summary>
|
|
||||||
/// TODO: Promote to DatItem level (contains list)
|
|
||||||
[JsonObject("device")]
|
|
||||||
public class Device
|
|
||||||
{
|
|
||||||
#region Fields
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device type
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public string Type { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device tag
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public string Tag { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fixed image format
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("fixed_image", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public string FixedImage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines if the devices is mandatory
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public string Mandatory { get; set; } // TODO: bool?
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device interface
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("interface", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public string Interface { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device instances
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("instances", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<Instance> Instances { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Device extensions
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("extensions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<Extension> Extensions { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML display
|
/// Represents one ListXML display
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -479,6 +479,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
return new Configuration();
|
return new Configuration();
|
||||||
|
|
||||||
|
case ItemType.Device:
|
||||||
|
return new Device();
|
||||||
|
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
return new DeviceReference();
|
return new DeviceReference();
|
||||||
|
|
||||||
@@ -538,6 +541,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
ItemType.Chip => new Chip(),
|
ItemType.Chip => new Chip(),
|
||||||
ItemType.Condition => new Condition(),
|
ItemType.Condition => new Condition(),
|
||||||
ItemType.Configuration => new Configuration(),
|
ItemType.Configuration => new Configuration(),
|
||||||
|
ItemType.Device => new Device(),
|
||||||
ItemType.DeviceReference => new DeviceReference(),
|
ItemType.DeviceReference => new DeviceReference(),
|
||||||
ItemType.DipSwitch => new DipSwitch(),
|
ItemType.DipSwitch => new DipSwitch(),
|
||||||
ItemType.Disk => new Disk(),
|
ItemType.Disk => new Disk(),
|
||||||
|
|||||||
297
SabreTools.Library/DatItems/Device.cs
Normal file
297
SabreTools.Library/DatItems/Device.cs
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using SabreTools.Library.Filtering;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This holds all of the auxiliary types needed for proper parsing
|
||||||
|
/// </summary>
|
||||||
|
namespace SabreTools.Library.DatItems
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a single device on the machine
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("device")]
|
||||||
|
public class Device : DatItem
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string DeviceType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device tag
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fixed image format
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("fixed_image", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string FixedImage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the devices is mandatory
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Mandatory { get; set; } // TODO: bool?
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device interface
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("interface", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Interface { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device instances
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("instances", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public List<Instance> Instances { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device extensions
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("extensions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public List<Extension> Extensions { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Accessors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set fields with given values
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mappings">Mappings dictionary</param>
|
||||||
|
public override void SetFields(Dictionary<Field, string> mappings)
|
||||||
|
{
|
||||||
|
// Set base fields
|
||||||
|
base.SetFields(mappings);
|
||||||
|
|
||||||
|
// Handle Device-specific fields
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_DeviceType))
|
||||||
|
DeviceType = mappings[Field.DatItem_DeviceType];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Tag))
|
||||||
|
Tag = mappings[Field.DatItem_Tag];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_FixedImage))
|
||||||
|
FixedImage = mappings[Field.DatItem_FixedImage];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Mandatory))
|
||||||
|
Mandatory = mappings[Field.DatItem_Mandatory];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Interface))
|
||||||
|
Interface = mappings[Field.DatItem_Interface];
|
||||||
|
|
||||||
|
// TODO: Handle DatItem_Instance*
|
||||||
|
// TODO: Handle DatItem_Extension*
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a default, empty Device object
|
||||||
|
/// </summary>
|
||||||
|
public Device()
|
||||||
|
{
|
||||||
|
ItemType = ItemType.Device;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning Methods
|
||||||
|
|
||||||
|
public override object Clone()
|
||||||
|
{
|
||||||
|
return new Device()
|
||||||
|
{
|
||||||
|
ItemType = this.ItemType,
|
||||||
|
DupeType = this.DupeType,
|
||||||
|
|
||||||
|
AltName = this.AltName,
|
||||||
|
AltTitle = this.AltTitle,
|
||||||
|
|
||||||
|
Original = this.Original,
|
||||||
|
OpenMSXSubType = this.OpenMSXSubType,
|
||||||
|
OpenMSXType = this.OpenMSXType,
|
||||||
|
Remark = this.Remark,
|
||||||
|
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,
|
||||||
|
|
||||||
|
Machine = this.Machine.Clone() as Machine,
|
||||||
|
Source = this.Source.Clone() as Source,
|
||||||
|
Remove = this.Remove,
|
||||||
|
|
||||||
|
DeviceType = this.DeviceType,
|
||||||
|
Tag = this.Tag,
|
||||||
|
FixedImage = this.FixedImage,
|
||||||
|
Mandatory = this.Mandatory,
|
||||||
|
Interface = this.Interface,
|
||||||
|
Instances = this.Instances,
|
||||||
|
Extensions = this.Extensions,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comparision Methods
|
||||||
|
|
||||||
|
public override bool Equals(DatItem other)
|
||||||
|
{
|
||||||
|
// If we don't have a Device, return false
|
||||||
|
if (ItemType != other.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, treat it as a Device
|
||||||
|
Device newOther = other as Device;
|
||||||
|
|
||||||
|
// If the Device information matches
|
||||||
|
return (DeviceType == newOther.DeviceType
|
||||||
|
&& Tag == newOther.Tag
|
||||||
|
&& FixedImage == newOther.FixedImage
|
||||||
|
&& Mandatory == newOther.Mandatory
|
||||||
|
&& Interface == newOther.Interface);
|
||||||
|
|
||||||
|
// TODO: Handle DatItem_Instance*
|
||||||
|
// TODO: Handle DatItem_Extension*
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Filtering
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check to see if a DatItem passes the filter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">Filter to check against</param>
|
||||||
|
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||||
|
public override bool PassesFilter(Filter filter)
|
||||||
|
{
|
||||||
|
// Check common fields first
|
||||||
|
if (!base.PassesFilter(filter))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on device type
|
||||||
|
if (filter.DatItem_DeviceType.MatchesPositiveSet(DeviceType) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_DeviceType.MatchesNegativeSet(DeviceType) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on tag
|
||||||
|
if (filter.DatItem_Tag.MatchesPositiveSet(Tag) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Tag.MatchesNegativeSet(Tag) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on fixed image
|
||||||
|
if (filter.DatItem_FixedImage.MatchesPositiveSet(FixedImage) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_FixedImage.MatchesNegativeSet(FixedImage) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on mandatory
|
||||||
|
if (filter.DatItem_Mandatory.MatchesPositiveSet(Mandatory) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Mandatory.MatchesNegativeSet(Mandatory) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on interface
|
||||||
|
if (filter.DatItem_Interface.MatchesPositiveSet(Interface) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Interface.MatchesNegativeSet(Interface) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// TODO: Handle DatItem_Instance*
|
||||||
|
// TODO: Handle DatItem_Extension*
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove fields from the DatItem
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fields">List of Fields to remove</param>
|
||||||
|
public override void RemoveFields(List<Field> fields)
|
||||||
|
{
|
||||||
|
// Remove common fields first
|
||||||
|
base.RemoveFields(fields);
|
||||||
|
|
||||||
|
// Remove the fields
|
||||||
|
if (fields.Contains(Field.DatItem_DeviceType))
|
||||||
|
DeviceType = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Tag))
|
||||||
|
Tag = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_FixedImage))
|
||||||
|
FixedImage = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Mandatory))
|
||||||
|
Mandatory = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Interface))
|
||||||
|
Interface = null;
|
||||||
|
|
||||||
|
// TODO: Handle DatItem_Instance*
|
||||||
|
// TODO: Handle DatItem_Extension*
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Sorting and Merging
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replace fields from another item
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">DatItem to pull new information from</param>
|
||||||
|
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||||
|
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||||
|
{
|
||||||
|
// Replace common fields first
|
||||||
|
base.ReplaceFields(item, fields);
|
||||||
|
|
||||||
|
// If we don't have a Device to replace from, ignore specific fields
|
||||||
|
if (item.ItemType != ItemType.Device)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Cast for easier access
|
||||||
|
Device newItem = item as Device;
|
||||||
|
|
||||||
|
// Replace the fields
|
||||||
|
if (fields.Contains(Field.DatItem_DeviceType))
|
||||||
|
DeviceType = newItem.DeviceType;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Tag))
|
||||||
|
Tag = newItem.Tag;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_FixedImage))
|
||||||
|
FixedImage = newItem.FixedImage;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Mandatory))
|
||||||
|
Mandatory = newItem.Mandatory;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Interface))
|
||||||
|
Interface = newItem.Interface;
|
||||||
|
|
||||||
|
// TODO: Handle DatItem_Instance*
|
||||||
|
// TODO: Handle DatItem_Extension*
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -233,23 +233,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Port_Analogs,
|
Machine_Port_Analogs,
|
||||||
Machine_Port_Analog_Mask,
|
Machine_Port_Analog_Mask,
|
||||||
|
|
||||||
// Devices
|
|
||||||
Machine_Devices,
|
|
||||||
Machine_Device_Type,
|
|
||||||
Machine_Device_Tag,
|
|
||||||
Machine_Device_FixedImage,
|
|
||||||
Machine_Device_Mandatory,
|
|
||||||
Machine_Device_Interface,
|
|
||||||
|
|
||||||
// Devices.Instances
|
|
||||||
Machine_Device_Instances,
|
|
||||||
Machine_Device_Instance_Name,
|
|
||||||
Machine_Device_Instance_BriefName,
|
|
||||||
|
|
||||||
// Devices.Extensions
|
|
||||||
Machine_Device_Extensions,
|
|
||||||
Machine_Device_Extension_Name,
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -413,6 +396,21 @@ namespace SabreTools.Library.DatItems
|
|||||||
DatItem_Setting_Value,
|
DatItem_Setting_Value,
|
||||||
DatItem_Setting_Default,
|
DatItem_Setting_Default,
|
||||||
|
|
||||||
|
// Device
|
||||||
|
DatItem_DeviceType,
|
||||||
|
DatItem_FixedImage,
|
||||||
|
DatItem_Mandatory,
|
||||||
|
DatItem_Interface,
|
||||||
|
|
||||||
|
// Device.Instances
|
||||||
|
DatItem_Instances,
|
||||||
|
DatItem_Instance_Name,
|
||||||
|
DatItem_Instance_BriefName,
|
||||||
|
|
||||||
|
// Device.Extensions
|
||||||
|
DatItem_Extensions,
|
||||||
|
DatItem_Extension_Name,
|
||||||
|
|
||||||
// DipSwitch.Values
|
// DipSwitch.Values
|
||||||
DatItem_Values,
|
DatItem_Values,
|
||||||
DatItem_Value_Name,
|
DatItem_Value_Name,
|
||||||
@@ -492,6 +490,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Chip,
|
Chip,
|
||||||
Condition,
|
Condition,
|
||||||
Configuration,
|
Configuration,
|
||||||
|
Device,
|
||||||
DeviceReference,
|
DeviceReference,
|
||||||
DipSwitch,
|
DipSwitch,
|
||||||
Driver,
|
Driver,
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
base.SetFields(mappings);
|
base.SetFields(mappings);
|
||||||
|
|
||||||
// Handle Sample-specific fields
|
// Handle Sample-specific fields
|
||||||
if (mappings.Keys.Contains(Field.Machine_Device_Extension_Name))
|
if (mappings.Keys.Contains(Field.DatItem_Extension_Name))
|
||||||
Name = mappings[Field.Machine_Device_Extension_Name];
|
Name = mappings[Field.DatItem_Extension_Name];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -158,9 +158,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on item name
|
// Filter on item name
|
||||||
if (filter.Machine_Device_Extension_Name.MatchesPositiveSet(Name) == false)
|
if (filter.DatItem_Extension_Name.MatchesPositiveSet(Name) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.Machine_Device_Extension_Name.MatchesNegativeSet(Name) == true)
|
if (filter.DatItem_Extension_Name.MatchesNegativeSet(Name) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -176,7 +176,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
base.RemoveFields(fields);
|
base.RemoveFields(fields);
|
||||||
|
|
||||||
// Remove the fields
|
// Remove the fields
|
||||||
if (fields.Contains(Field.Machine_Device_Extension_Name))
|
if (fields.Contains(Field.DatItem_Extension_Name))
|
||||||
Name = null;
|
Name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Extension newItem = item as Extension;
|
Extension newItem = item as Extension;
|
||||||
|
|
||||||
// Replace the fields
|
// Replace the fields
|
||||||
if (fields.Contains(Field.Machine_Device_Extension_Name))
|
if (fields.Contains(Field.DatItem_Extension_Name))
|
||||||
Name = newItem.Name;
|
Name = newItem.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
base.SetFields(mappings);
|
base.SetFields(mappings);
|
||||||
|
|
||||||
// Handle Instance-specific fields
|
// Handle Instance-specific fields
|
||||||
if (mappings.Keys.Contains(Field.Machine_Device_Instance_Name))
|
if (mappings.Keys.Contains(Field.DatItem_Instance_Name))
|
||||||
Name = mappings[Field.Machine_Device_Instance_Name];
|
Name = mappings[Field.DatItem_Instance_Name];
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.Machine_Device_Instance_BriefName))
|
if (mappings.Keys.Contains(Field.DatItem_Instance_BriefName))
|
||||||
BriefName = mappings[Field.Machine_Device_Instance_BriefName];
|
BriefName = mappings[Field.DatItem_Instance_BriefName];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -169,15 +169,15 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on item name
|
// Filter on item name
|
||||||
if (filter.Machine_Device_Instance_Name.MatchesPositiveSet(Name) == false)
|
if (filter.DatItem_Instance_Name.MatchesPositiveSet(Name) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.Machine_Device_Instance_Name.MatchesNegativeSet(Name) == true)
|
if (filter.DatItem_Instance_Name.MatchesNegativeSet(Name) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on brief name
|
// Filter on brief name
|
||||||
if (filter.Machine_Device_Instance_BriefName.MatchesPositiveSet(Name) == false)
|
if (filter.DatItem_Instance_BriefName.MatchesPositiveSet(Name) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.Machine_Device_Instance_BriefName.MatchesNegativeSet(Name) == true)
|
if (filter.DatItem_Instance_BriefName.MatchesNegativeSet(Name) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -193,10 +193,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
base.RemoveFields(fields);
|
base.RemoveFields(fields);
|
||||||
|
|
||||||
// Remove the fields
|
// Remove the fields
|
||||||
if (fields.Contains(Field.Machine_Device_Instance_Name))
|
if (fields.Contains(Field.DatItem_Instance_Name))
|
||||||
Name = null;
|
Name = null;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Device_Instance_BriefName))
|
if (fields.Contains(Field.DatItem_Instance_BriefName))
|
||||||
BriefName = null;
|
BriefName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,10 +232,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
Instance newItem = item as Instance;
|
Instance newItem = item as Instance;
|
||||||
|
|
||||||
// Replace the fields
|
// Replace the fields
|
||||||
if (fields.Contains(Field.Machine_Device_Instance_Name))
|
if (fields.Contains(Field.DatItem_Instance_Name))
|
||||||
Name = newItem.Name;
|
Name = newItem.Name;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Device_Instance_BriefName))
|
if (fields.Contains(Field.DatItem_Instance_BriefName))
|
||||||
BriefName = newItem.BriefName;
|
BriefName = newItem.BriefName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,12 +170,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Port> Ports { get; set; } = null;
|
public List<Port> Ports { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of associated devices
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<Device> Devices { get; set; } = null;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx Fields
|
#region Logiqx Fields
|
||||||
@@ -531,7 +525,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
Displays = this.Displays,
|
Displays = this.Displays,
|
||||||
Inputs = this.Inputs,
|
Inputs = this.Inputs,
|
||||||
Ports = this.Ports,
|
Ports = this.Ports,
|
||||||
Devices = this.Devices,
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -98,23 +98,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<bool?> Machine_Port_Analogs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> Machine_Port_Analogs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<string> Machine_Port_Analog_Mask { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> Machine_Port_Analog_Mask { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Devices
|
|
||||||
public FilterItem<bool?> Machine_Devices { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_Device_Type { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Device_Tag { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Device_FixedImage { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Device_Mandatory { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Device_Interface { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Devices.Instances
|
|
||||||
public FilterItem<bool?> Machine_Device_Instances { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_Device_Instance_Name { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Device_Instance_BriefName { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Devices.Extensions
|
|
||||||
public FilterItem<bool?> Machine_Device_Extensions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_Device_Extension_Name { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -278,6 +261,21 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<string> DatItem_Setting_Value { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Setting_Value { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<bool?> DatItem_Setting_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Setting_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
|
||||||
|
// Device
|
||||||
|
public FilterItem<string> DatItem_DeviceType { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_FixedImage { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Mandatory { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Interface { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
// Device.Instances
|
||||||
|
public FilterItem<bool?> DatItem_Instances { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
public FilterItem<string> DatItem_Instance_Name { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_Instance_BriefName { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
// Device.Extensions
|
||||||
|
public FilterItem<bool?> DatItem_Extensions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
|
public FilterItem<string> DatItem_Extension_Name { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// DipSwitch.Values
|
// DipSwitch.Values
|
||||||
public FilterItem<bool?> DatItem_Values { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Values { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<string> DatItem_Value_Name { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Value_Name { get; private set; } = new FilterItem<string>();
|
||||||
@@ -805,86 +803,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
Machine_Port_Analog_Mask.PositiveSet.Add(value);
|
Machine_Port_Analog_Mask.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Devices
|
|
||||||
case Field.Machine_Devices:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_Devices.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_Devices.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Type:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Type.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Type.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Tag:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Tag.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Tag.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_FixedImage:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_FixedImage.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_FixedImage.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Mandatory:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Mandatory.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Mandatory.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Interface:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Interface.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Interface.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Devices.Instances
|
|
||||||
case Field.Machine_Device_Instances:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_Device_Instances.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_Device_Instances.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Instance_Name:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Instance_Name.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Instance_Name.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Instance_BriefName:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Instance_BriefName.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Instance_BriefName.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Devices.Extensions
|
|
||||||
case Field.Machine_Device_Extensions:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_Device_Extensions.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_Device_Extensions.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Device_Extension_Name:
|
|
||||||
if (negate)
|
|
||||||
Machine_Device_Extension_Name.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Device_Extension_Name.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -1606,6 +1524,72 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_Setting_Default.Neutral = true;
|
DatItem_Setting_Default.Neutral = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Device
|
||||||
|
case Field.DatItem_DeviceType:
|
||||||
|
if (negate)
|
||||||
|
DatItem_DeviceType.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_DeviceType.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_FixedImage:
|
||||||
|
if (negate)
|
||||||
|
DatItem_FixedImage.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_FixedImage.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Mandatory:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Mandatory.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Mandatory.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Interface:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Interface.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Interface.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Devices.Instances
|
||||||
|
case Field.DatItem_Instances:
|
||||||
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
DatItem_Instances.Neutral = false;
|
||||||
|
else
|
||||||
|
DatItem_Instances.Neutral = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Instance_Name:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Instance_Name.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Instance_Name.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Instance_BriefName:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Instance_BriefName.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Instance_BriefName.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Devices.Extensions
|
||||||
|
case Field.DatItem_Extensions:
|
||||||
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
DatItem_Extensions.Neutral = false;
|
||||||
|
else
|
||||||
|
DatItem_Extensions.Neutral = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_Extension_Name:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Extension_Name.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Extension_Name.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
// DipSwitches.Values
|
// DipSwitches.Values
|
||||||
case Field.DatItem_Values:
|
case Field.DatItem_Values:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|||||||
@@ -683,39 +683,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "port_analog_mask":
|
case "port_analog_mask":
|
||||||
return Field.Machine_Port_Analog_Mask;
|
return Field.Machine_Port_Analog_Mask;
|
||||||
|
|
||||||
case "devices":
|
|
||||||
return Field.Machine_Devices;
|
|
||||||
|
|
||||||
case "device_type":
|
|
||||||
return Field.Machine_Device_Type;
|
|
||||||
|
|
||||||
case "device_tag":
|
|
||||||
return Field.Machine_Device_Tag;
|
|
||||||
|
|
||||||
case "device_fixedimage":
|
|
||||||
return Field.Machine_Device_FixedImage;
|
|
||||||
|
|
||||||
case "device_mandatory":
|
|
||||||
return Field.Machine_Device_Mandatory;
|
|
||||||
|
|
||||||
case "device_interface":
|
|
||||||
return Field.Machine_Device_Interface;
|
|
||||||
|
|
||||||
case "device_instances":
|
|
||||||
return Field.Machine_Device_Instances;
|
|
||||||
|
|
||||||
case "device_instance_name":
|
|
||||||
return Field.Machine_Device_Instance_Name;
|
|
||||||
|
|
||||||
case "device_instance_briefname":
|
|
||||||
return Field.Machine_Device_Instance_BriefName;
|
|
||||||
|
|
||||||
case "device_extensions":
|
|
||||||
return Field.Machine_Device_Extensions;
|
|
||||||
|
|
||||||
case "device_extension_name":
|
|
||||||
return Field.Machine_Device_Extension_Name;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -1097,6 +1064,34 @@ namespace SabreTools.Library.Tools
|
|||||||
case "value_default":
|
case "value_default":
|
||||||
return Field.DatItem_Value_Default;
|
return Field.DatItem_Value_Default;
|
||||||
|
|
||||||
|
// Device
|
||||||
|
case "devicetype":
|
||||||
|
return Field.DatItem_DeviceType;
|
||||||
|
|
||||||
|
case "fixedimage":
|
||||||
|
return Field.DatItem_FixedImage;
|
||||||
|
|
||||||
|
case "mandatory":
|
||||||
|
return Field.DatItem_Mandatory;
|
||||||
|
|
||||||
|
case "interface":
|
||||||
|
return Field.DatItem_Interface;
|
||||||
|
|
||||||
|
case "instances":
|
||||||
|
return Field.DatItem_Instances;
|
||||||
|
|
||||||
|
case "instance_name":
|
||||||
|
return Field.DatItem_Instance_Name;
|
||||||
|
|
||||||
|
case "instance_briefname":
|
||||||
|
return Field.DatItem_Instance_BriefName;
|
||||||
|
|
||||||
|
case "extensions":
|
||||||
|
return Field.DatItem_Extensions;
|
||||||
|
|
||||||
|
case "extension_name":
|
||||||
|
return Field.DatItem_Extension_Name;
|
||||||
|
|
||||||
// Driver
|
// Driver
|
||||||
case "supportstatus":
|
case "supportstatus":
|
||||||
return Field.DatItem_SupportStatus;
|
return Field.DatItem_SupportStatus;
|
||||||
@@ -1672,6 +1667,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return ItemType.Condition;
|
return ItemType.Condition;
|
||||||
case "configuration":
|
case "configuration":
|
||||||
return ItemType.Configuration;
|
return ItemType.Configuration;
|
||||||
|
case "device":
|
||||||
|
return ItemType.Device;
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
return ItemType.DeviceReference;
|
return ItemType.DeviceReference;
|
||||||
case "dipswitch":
|
case "dipswitch":
|
||||||
@@ -1716,6 +1713,7 @@ namespace SabreTools.Library.Tools
|
|||||||
"chip" => ItemType.Chip,
|
"chip" => ItemType.Chip,
|
||||||
"condition" => ItemType.Condition,
|
"condition" => ItemType.Condition,
|
||||||
"configuration" => ItemType.Configuration,
|
"configuration" => ItemType.Configuration,
|
||||||
|
"device" => ItemType.Device,
|
||||||
"device_ref" => ItemType.DeviceReference,
|
"device_ref" => ItemType.DeviceReference,
|
||||||
"dipswitch" => ItemType.DipSwitch,
|
"dipswitch" => ItemType.DipSwitch,
|
||||||
"disk" => ItemType.Disk,
|
"disk" => ItemType.Disk,
|
||||||
@@ -2289,6 +2287,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return "condition";
|
return "condition";
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
return "configuration";
|
return "configuration";
|
||||||
|
case ItemType.Device:
|
||||||
|
return "device";
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
return "device_ref";
|
return "device_ref";
|
||||||
case ItemType.DipSwitch:
|
case ItemType.DipSwitch:
|
||||||
@@ -2333,6 +2333,7 @@ namespace SabreTools.Library.Tools
|
|||||||
ItemType.Chip => "chip",
|
ItemType.Chip => "chip",
|
||||||
ItemType.Condition => "condition",
|
ItemType.Condition => "condition",
|
||||||
ItemType.Configuration => "configuration",
|
ItemType.Configuration => "configuration",
|
||||||
|
ItemType.Device => "device",
|
||||||
ItemType.DeviceReference => "device_ref",
|
ItemType.DeviceReference => "device_ref",
|
||||||
ItemType.DipSwitch => "dipswitch",
|
ItemType.DipSwitch => "dipswitch",
|
||||||
ItemType.Disk => "disk",
|
ItemType.Disk => "disk",
|
||||||
|
|||||||
Reference in New Issue
Block a user