mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Analog early, promot Configuration
This commit is contained in:
@@ -83,6 +83,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public long AdjusterCount { get; private set; } = 0;
|
public long AdjusterCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Analog items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long AnalogCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Archive items
|
/// Number of Archive items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -101,6 +107,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public long ChipCount { get; private set; } = 0;
|
public long ChipCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of top-level Condition items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long ConditionCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Configuration items
|
/// Number of Configuration items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -514,6 +526,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Adjuster:
|
case ItemType.Adjuster:
|
||||||
AdjusterCount++;
|
AdjusterCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Analog:
|
||||||
|
AnalogCount++;
|
||||||
|
break;
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
ArchiveCount++;
|
ArchiveCount++;
|
||||||
break;
|
break;
|
||||||
@@ -523,6 +538,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount++;
|
ChipCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Condition:
|
||||||
|
ConditionCount++;
|
||||||
|
break;
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
ConfigurationCount++;
|
ConfigurationCount++;
|
||||||
break;
|
break;
|
||||||
@@ -673,6 +691,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Adjuster:
|
case ItemType.Adjuster:
|
||||||
AdjusterCount--;
|
AdjusterCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Analog:
|
||||||
|
AnalogCount--;
|
||||||
|
break;
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
ArchiveCount--;
|
ArchiveCount--;
|
||||||
break;
|
break;
|
||||||
@@ -682,6 +703,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount--;
|
ChipCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Condition:
|
||||||
|
ConditionCount--;
|
||||||
|
break;
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
ConfigurationCount--;
|
ConfigurationCount--;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -211,6 +211,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Adjuster:
|
case ItemType.Adjuster:
|
||||||
datItem = datItemObj.ToObject<Adjuster>();
|
datItem = datItemObj.ToObject<Adjuster>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Analog:
|
||||||
|
datItem = datItemObj.ToObject<Analog>();
|
||||||
|
break;
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
datItem = datItemObj.ToObject<Archive>();
|
datItem = datItemObj.ToObject<Archive>();
|
||||||
break;
|
break;
|
||||||
@@ -223,6 +226,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
datItem = datItemObj.ToObject<Chip>();
|
datItem = datItemObj.ToObject<Chip>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Condition:
|
||||||
|
datItem = datItemObj.ToObject<Condition>();
|
||||||
|
break;
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
datItem = datItemObj.ToObject<Configuration>();
|
datItem = datItemObj.ToObject<Configuration>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -172,6 +172,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Default = reader.GetAttribute("default").AsYesNo(),
|
Default = reader.GetAttribute("default").AsYesNo(),
|
||||||
Conditions = new List<Condition>(),
|
Conditions = new List<Condition>(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
@@ -218,6 +224,24 @@ namespace SabreTools.Library.DatFiles
|
|||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "condition":
|
||||||
|
datItems.Add(new Condition
|
||||||
|
{
|
||||||
|
Tag = reader.GetAttribute("tag"),
|
||||||
|
Mask = reader.GetAttribute("mask"),
|
||||||
|
Relation = reader.GetAttribute("relation"),
|
||||||
|
ConditionValue = reader.GetAttribute("value"),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
reader.Read();
|
||||||
|
break;
|
||||||
|
|
||||||
case "configuration":
|
case "configuration":
|
||||||
var configuration = new Configuration
|
var configuration = new Configuration
|
||||||
{
|
{
|
||||||
@@ -227,6 +251,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Conditions = new List<Condition>(),
|
Conditions = new List<Condition>(),
|
||||||
Locations = new List<Location>(),
|
Locations = new List<Location>(),
|
||||||
Settings = new List<Setting>(),
|
Settings = new List<Setting>(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
@@ -242,6 +272,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
datItems.Add(new DeviceReference
|
datItems.Add(new DeviceReference
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
@@ -256,6 +292,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Conditions = new List<Condition>(),
|
Conditions = new List<Condition>(),
|
||||||
Locations = new List<Location>(),
|
Locations = new List<Location>(),
|
||||||
Values = new List<Setting>(),
|
Values = new List<Setting>(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
@@ -296,6 +338,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Emulation = reader.GetAttribute("emulation").AsSupportStatus(),
|
Emulation = reader.GetAttribute("emulation").AsSupportStatus(),
|
||||||
Cocktail = reader.GetAttribute("cocktail").AsSupportStatus(),
|
Cocktail = reader.GetAttribute("cocktail").AsSupportStatus(),
|
||||||
SaveState = reader.GetAttribute("savestate").AsSupported(),
|
SaveState = reader.GetAttribute("savestate").AsSupported(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
@@ -307,6 +355,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Type = reader.GetAttribute("type").AsFeatureType(),
|
Type = reader.GetAttribute("type").AsFeatureType(),
|
||||||
Status = reader.GetAttribute("status").AsFeatureStatus(),
|
Status = reader.GetAttribute("status").AsFeatureStatus(),
|
||||||
Overall = reader.GetAttribute("overall").AsFeatureStatus(),
|
Overall = reader.GetAttribute("overall").AsFeatureStatus(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
@@ -342,6 +396,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Default = reader.GetAttribute("default").AsYesNo(),
|
Default = reader.GetAttribute("default").AsYesNo(),
|
||||||
Content = reader.ReadElementContentAsString(),
|
Content = reader.ReadElementContentAsString(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -366,6 +426,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
SlotOptions = new List<SlotOption>(),
|
SlotOptions = new List<SlotOption>(),
|
||||||
|
|
||||||
|
Source = new Source
|
||||||
|
{
|
||||||
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
@@ -435,22 +501,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "condition":
|
|
||||||
var condition = new Condition();
|
|
||||||
condition.Tag = reader.GetAttribute("tag");
|
|
||||||
condition.Mask = reader.GetAttribute("mask");
|
|
||||||
condition.Relation = reader.GetAttribute("relation");
|
|
||||||
condition.Value = reader.GetAttribute("value");
|
|
||||||
|
|
||||||
// Ensure the list exists
|
|
||||||
if (machine.Conditions == null)
|
|
||||||
machine.Conditions = new List<Condition>();
|
|
||||||
|
|
||||||
machine.Conditions.Add(condition);
|
|
||||||
|
|
||||||
reader.Read();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "input":
|
case "input":
|
||||||
var input = new Input();
|
var input = new Input();
|
||||||
input.Service = reader.GetAttribute("service").AsYesNo();
|
input.Service = reader.GetAttribute("service").AsYesNo();
|
||||||
@@ -1190,13 +1240,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalElementString("year", datItem.Machine.Year);
|
xtw.WriteOptionalElementString("year", datItem.Machine.Year);
|
||||||
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer);
|
||||||
|
|
||||||
// TODO: These should go *after* the datitems
|
// TODO: These are all going away due to promotions
|
||||||
if (datItem.Machine.Displays != null)
|
if (datItem.Machine.Displays != null)
|
||||||
{
|
{
|
||||||
foreach (var display in datItem.Machine.Displays)
|
foreach (var display in datItem.Machine.Displays)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("display");
|
xtw.WriteStartElement("display");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("tag", display.Tag);
|
xtw.WriteOptionalAttributeString("tag", display.Tag);
|
||||||
xtw.WriteOptionalAttributeString("type", display.Type);
|
xtw.WriteOptionalAttributeString("type", display.Type);
|
||||||
xtw.WriteOptionalAttributeString("rotate", display.Rotate);
|
xtw.WriteOptionalAttributeString("rotate", display.Rotate);
|
||||||
@@ -1211,23 +1260,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("vtotal", display.VTotal);
|
xtw.WriteOptionalAttributeString("vtotal", display.VTotal);
|
||||||
xtw.WriteOptionalAttributeString("vbend", display.VBEnd);
|
xtw.WriteOptionalAttributeString("vbend", display.VBEnd);
|
||||||
xtw.WriteOptionalAttributeString("vbstart", display.VBStart);
|
xtw.WriteOptionalAttributeString("vbstart", display.VBStart);
|
||||||
|
|
||||||
// End display
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (datItem.Machine.Conditions != null)
|
|
||||||
{
|
|
||||||
foreach (var condition in datItem.Machine.Conditions)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("condition");
|
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
|
||||||
|
|
||||||
// End condition
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1236,18 +1268,15 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (var input in datItem.Machine.Inputs)
|
foreach (var input in datItem.Machine.Inputs)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("input");
|
xtw.WriteStartElement("input");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("service", input.Service.FromYesNo());
|
xtw.WriteOptionalAttributeString("service", input.Service.FromYesNo());
|
||||||
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
||||||
xtw.WriteOptionalAttributeString("players", input.Players);
|
xtw.WriteOptionalAttributeString("players", input.Players);
|
||||||
xtw.WriteOptionalAttributeString("coins", input.Coins);
|
xtw.WriteOptionalAttributeString("coins", input.Coins);
|
||||||
|
|
||||||
if (input.Controls != null)
|
if (input.Controls != null)
|
||||||
{
|
{
|
||||||
foreach (var control in input.Controls)
|
foreach (var control in input.Controls)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("control");
|
xtw.WriteStartElement("control");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("type", control.Type);
|
xtw.WriteOptionalAttributeString("type", control.Type);
|
||||||
xtw.WriteOptionalAttributeString("player", control.Player);
|
xtw.WriteOptionalAttributeString("player", control.Player);
|
||||||
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
|
xtw.WriteOptionalAttributeString("buttons", control.Buttons);
|
||||||
@@ -1260,13 +1289,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("ways", control.Ways);
|
xtw.WriteOptionalAttributeString("ways", control.Ways);
|
||||||
xtw.WriteOptionalAttributeString("ways2", control.Ways2);
|
xtw.WriteOptionalAttributeString("ways2", control.Ways2);
|
||||||
xtw.WriteOptionalAttributeString("ways3", control.Ways3);
|
xtw.WriteOptionalAttributeString("ways3", control.Ways3);
|
||||||
|
|
||||||
// End control
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End input
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1275,23 +1300,16 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (var port in datItem.Machine.Ports)
|
foreach (var port in datItem.Machine.Ports)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("port");
|
xtw.WriteStartElement("port");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("tag", port.Tag);
|
xtw.WriteOptionalAttributeString("tag", port.Tag);
|
||||||
|
|
||||||
if (port.Analogs != null)
|
if (port.Analogs != null)
|
||||||
{
|
{
|
||||||
foreach (var analog in port.Analogs)
|
foreach (var analog in port.Analogs)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("analog");
|
xtw.WriteStartElement("analog");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("mask", analog.Mask);
|
xtw.WriteOptionalAttributeString("mask", analog.Mask);
|
||||||
|
|
||||||
// End analog
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End port
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1300,23 +1318,18 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (var device in datItem.Machine.Devices)
|
foreach (var device in datItem.Machine.Devices)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("device");
|
xtw.WriteStartElement("device");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("type", device.Type);
|
xtw.WriteOptionalAttributeString("type", device.Type);
|
||||||
xtw.WriteOptionalAttributeString("tag", device.Tag);
|
xtw.WriteOptionalAttributeString("tag", device.Tag);
|
||||||
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
||||||
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory);
|
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory);
|
||||||
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
||||||
|
|
||||||
if (device.Instances != null)
|
if (device.Instances != null)
|
||||||
{
|
{
|
||||||
foreach (var instance in device.Instances)
|
foreach (var instance in device.Instances)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("instance");
|
xtw.WriteStartElement("instance");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("name", instance.Name);
|
xtw.WriteOptionalAttributeString("name", instance.Name);
|
||||||
xtw.WriteOptionalAttributeString("briefname", instance.BriefName);
|
xtw.WriteOptionalAttributeString("briefname", instance.BriefName);
|
||||||
|
|
||||||
// End instance
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1325,15 +1338,10 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (var extension in device.Extensions)
|
foreach (var extension in device.Extensions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("extension");
|
xtw.WriteStartElement("extension");
|
||||||
|
|
||||||
xtw.WriteOptionalAttributeString("name", extension.Name);
|
xtw.WriteOptionalAttributeString("name", extension.Name);
|
||||||
|
|
||||||
// End extension
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End device
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1395,13 +1403,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||||
if (adjuster.Conditions != null)
|
if (adjuster.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in adjuster.Conditions)
|
foreach (var adjusterCondition in adjuster.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", adjusterCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", adjusterCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", adjusterCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", adjusterCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1427,6 +1435,16 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Condition:
|
||||||
|
var condition = datItem as Condition;
|
||||||
|
xtw.WriteStartElement("condition");
|
||||||
|
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||||
|
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||||
|
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||||
|
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
var configuration = datItem as Configuration;
|
var configuration = datItem as Configuration;
|
||||||
xtw.WriteStartElement("configuration");
|
xtw.WriteStartElement("configuration");
|
||||||
@@ -1436,13 +1454,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
if (configuration.Conditions != null)
|
if (configuration.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in configuration.Conditions)
|
foreach (var configurationCondition in configuration.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", configurationCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", configurationCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", configurationCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", configurationCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1486,13 +1504,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
||||||
if (dipSwitch.Conditions != null)
|
if (dipSwitch.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in dipSwitch.Conditions)
|
foreach (var dipSwitchCondition in dipSwitch.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", dipSwitchCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipSwitchCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", dipSwitchCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", dipSwitchCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1517,13 +1535,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
||||||
if (value.Conditions != null)
|
if (value.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in value.Conditions)
|
foreach (var dipValueCondition in value.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", dipValueCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipValueCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", dipValueCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", dipValueCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1216,19 +1216,27 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||||
if (adjuster.Conditions != null)
|
if (adjuster.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in adjuster.Conditions)
|
foreach (var adjusterCondition in adjuster.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", adjusterCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", adjusterCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", adjusterCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", adjusterCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Analog:
|
||||||
|
var analog = datItem as Analog;
|
||||||
|
xtw.WriteStartElement("file");
|
||||||
|
xtw.WriteAttributeString("type", "analog");
|
||||||
|
xtw.WriteOptionalAttributeString("mask", analog.Mask);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
var archive = datItem as Archive;
|
var archive = datItem as Archive;
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
@@ -1258,6 +1266,17 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Condition:
|
||||||
|
var condition = datItem as Condition;
|
||||||
|
xtw.WriteStartElement("file");
|
||||||
|
xtw.WriteAttributeString("type", "condition");
|
||||||
|
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||||
|
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||||
|
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||||
|
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
var configuration = datItem as Configuration;
|
var configuration = datItem as Configuration;
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
@@ -1268,13 +1287,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
if (configuration.Conditions != null)
|
if (configuration.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in configuration.Conditions)
|
foreach (var configurationCondition in configuration.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", configurationCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", configurationCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", configurationCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", configurationCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1320,13 +1339,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
||||||
if (dipSwitch.Conditions != null)
|
if (dipSwitch.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in dipSwitch.Conditions)
|
foreach (var dipSwitchCondition in dipSwitch.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", dipSwitchCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipSwitchCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", dipSwitchCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", dipSwitchCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1351,13 +1370,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
||||||
if (value.Conditions != null)
|
if (value.Conditions != null)
|
||||||
{
|
{
|
||||||
foreach (var condition in value.Conditions)
|
foreach (var dipValueCondition in value.Conditions)
|
||||||
{
|
{
|
||||||
xtw.WriteStartElement("condition");
|
xtw.WriteStartElement("condition");
|
||||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
xtw.WriteOptionalAttributeString("tag", dipValueCondition.Tag);
|
||||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
xtw.WriteOptionalAttributeString("mask", dipValueCondition.Mask);
|
||||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
xtw.WriteOptionalAttributeString("relation", dipValueCondition.Relation);
|
||||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
xtw.WriteOptionalAttributeString("value", dipValueCondition.Value);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
173
SabreTools.Library/DatItems/Analog.cs
Normal file
173
SabreTools.Library/DatItems/Analog.cs
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using SabreTools.Library.Filtering;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.DatItems
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a single analog item
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("analog")]
|
||||||
|
public class Analog : DatItem
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Analog mask value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Mask { 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 Analog-specific fields
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Mask))
|
||||||
|
Mask = mappings[Field.DatItem_Mask];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a default, empty Analog object
|
||||||
|
/// </summary>
|
||||||
|
public Analog()
|
||||||
|
{
|
||||||
|
ItemType = ItemType.Analog;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning Methods
|
||||||
|
|
||||||
|
public override object Clone()
|
||||||
|
{
|
||||||
|
return new Analog()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
||||||
|
Mask = this.Mask,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comparision Methods
|
||||||
|
|
||||||
|
public override bool Equals(DatItem other)
|
||||||
|
{
|
||||||
|
// If we don't have a Analog, return false
|
||||||
|
if (ItemType != other.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, treat it as a Analog
|
||||||
|
Analog newOther = other as Analog;
|
||||||
|
|
||||||
|
// If the Feature information matches
|
||||||
|
return (Mask == newOther.Mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 mask
|
||||||
|
if (filter.DatItem_Mask.MatchesPositiveSet(Mask) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Mask.MatchesNegativeSet(Mask) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
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_Mask))
|
||||||
|
Mask = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 Analog to replace from, ignore specific fields
|
||||||
|
if (item.ItemType != ItemType.Analog)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Cast for easier access
|
||||||
|
Analog newItem = item as Analog;
|
||||||
|
|
||||||
|
// Replace the fields
|
||||||
|
if (fields.Contains(Field.DatItem_Mask))
|
||||||
|
Mask = newItem.Mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using SabreTools.Library.DatItems;
|
||||||
|
using SabreTools.Library.Filtering;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
@@ -12,77 +15,87 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#region ListXML
|
#region ListXML
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents one ListXML analog
|
|
||||||
/// </summary>
|
|
||||||
[JsonObject("analog")]
|
|
||||||
public class Analog
|
|
||||||
{
|
|
||||||
[JsonProperty("mask")]
|
|
||||||
public string Mask { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents one ListXML condition
|
|
||||||
/// </summary>
|
|
||||||
/// TODO: Promote to DatItem level (Both used at ListXML level AND under a lot of stuff)
|
|
||||||
[JsonObject("condition")]
|
|
||||||
public class Condition
|
|
||||||
{
|
|
||||||
[JsonProperty("tag")]
|
|
||||||
public string Tag { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("mask")]
|
|
||||||
public string Mask { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("relation")]
|
|
||||||
public string Relation { get; set; } // TODO: (eq|ne|gt|le|lt|ge)
|
|
||||||
|
|
||||||
[JsonProperty("value")]
|
|
||||||
public string Value { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML control
|
/// Represents one ListXML control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonObject("control")]
|
[JsonObject("control")]
|
||||||
public class Control
|
public class Control
|
||||||
{
|
{
|
||||||
[JsonProperty("type")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Control type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("player")]
|
/// <summary>
|
||||||
|
/// Player ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("player", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Player { get; set; } // TODO: Int32?
|
public string Player { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("buttons")]
|
/// <summary>
|
||||||
|
/// Button count
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("buttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Buttons { get; set; } // TODO: Int32?
|
public string Buttons { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("regbuttons")]
|
/// <summary>
|
||||||
|
/// Regular button count
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("regbuttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string RegButtons { get; set; } // TODO: Int32?
|
public string RegButtons { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("minimum")]
|
/// <summary>
|
||||||
|
/// Minimum value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("minimum", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Minimum { get; set; } // TODO: Int32? Float?
|
public string Minimum { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("maximum")]
|
/// <summary>
|
||||||
|
/// Maximum value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("maximum", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Maximum { get; set; } // TODO: Int32? Float?
|
public string Maximum { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("sensitivity")]
|
/// <summary>
|
||||||
|
/// Sensitivity value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sensitivity", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Sensitivity { get; set; } // TODO: Int32? Float?
|
public string Sensitivity { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("keydelta")]
|
/// <summary>
|
||||||
|
/// Keypress delta
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("keydelta", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string KeyDelta { get; set; } // TODO: Int32? Float?
|
public string KeyDelta { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("reverse")]
|
/// <summary>
|
||||||
|
/// Determines if the control is reversed
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("reverse", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Reverse { get; set; }
|
public bool? Reverse { get; set; }
|
||||||
|
|
||||||
[JsonProperty("ways")]
|
/// <summary>
|
||||||
|
/// First set of ways
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ways", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Ways { get; set; } // TODO: Int32? Float?
|
public string Ways { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("ways2")]
|
/// <summary>
|
||||||
|
/// Second set of ways
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ways2", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Ways2 { get; set; } // TODO: Int32? Float?
|
public string Ways2 { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("ways3")]
|
/// <summary>
|
||||||
|
/// Third set of ways
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("ways3", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Ways3 { get; set; } // TODO: Int32? Float?
|
public string Ways3 { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -92,26 +105,51 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("device")]
|
[JsonObject("device")]
|
||||||
public class Device
|
public class Device
|
||||||
{
|
{
|
||||||
[JsonProperty("type")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Device type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
[JsonProperty("tag")]
|
/// <summary>
|
||||||
|
/// Device tag
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
[JsonProperty("fixed_image")]
|
/// <summary>
|
||||||
|
/// Fixed image format
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("fixed_image", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string FixedImage { get; set; }
|
public string FixedImage { get; set; }
|
||||||
|
|
||||||
[JsonProperty("mandatory")]
|
/// <summary>
|
||||||
|
/// Determines if the devices is mandatory
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Mandatory { get; set; } // TODO: bool?
|
public string Mandatory { get; set; } // TODO: bool?
|
||||||
|
|
||||||
[JsonProperty("interface")]
|
/// <summary>
|
||||||
|
/// Device interface
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("interface", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Interface { get; set; }
|
public string Interface { get; set; }
|
||||||
|
|
||||||
[JsonProperty("instances")]
|
/// <summary>
|
||||||
|
/// Device instances
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("instances", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Instance> Instances { get; set; }
|
public List<Instance> Instances { get; set; }
|
||||||
|
|
||||||
[JsonProperty("extensions")]
|
/// <summary>
|
||||||
|
/// Device extensions
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("extensions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Extension> Extensions { get; set; }
|
public List<Extension> Extensions { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -121,47 +159,93 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("display")]
|
[JsonObject("display")]
|
||||||
public class Display
|
public class Display
|
||||||
{
|
{
|
||||||
[JsonProperty("tag")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Display tag
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
[JsonProperty("type")]
|
/// <summary>
|
||||||
|
/// Display type
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Type { get; set; } // TODO: (raster|vector|lcd|svg|unknown)
|
public string Type { get; set; } // TODO: (raster|vector|lcd|svg|unknown)
|
||||||
|
|
||||||
[JsonProperty("rotate")]
|
/// <summary>
|
||||||
|
/// Display rotation
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("rotate", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Rotate { get; set; } // TODO: (0|90|180|270) Int32?
|
public string Rotate { get; set; } // TODO: (0|90|180|270) Int32?
|
||||||
|
|
||||||
[JsonProperty("flipx")]
|
/// <summary>
|
||||||
|
/// Determines if display is flipped in the X-coordinates
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("flipx", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? FlipX { get; set; }
|
public bool? FlipX { get; set; }
|
||||||
|
|
||||||
[JsonProperty("width")]
|
/// <summary>
|
||||||
|
/// Display width
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Width { get; set; } // TODO: Int32?
|
public string Width { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("height")]
|
/// <summary>
|
||||||
|
/// Display height
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Height { get; set; } // TODO: Int32?
|
public string Height { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("refresh")]
|
/// <summary>
|
||||||
|
/// Refresh rate
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Refresh { get; set; } // TODO: Int32? Float?
|
public string Refresh { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("pixclock")]
|
/// <summary>
|
||||||
|
/// Pixel clock timer
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("pixclock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string PixClock { get; set; } // TODO: Int32? Float?
|
public string PixClock { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("htotal")]
|
/// <summary>
|
||||||
|
/// Total horizontal lines
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string HTotal { get; set; } // TODO: Int32? Float?
|
public string HTotal { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("hbend")]
|
/// <summary>
|
||||||
|
/// Horizontal blank end
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string HBEnd { get; set; } // TODO: Int32? Float?
|
public string HBEnd { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("hbstart")]
|
/// <summary>
|
||||||
|
/// Horizontal blank start
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string HBStart { get; set; } // TODO: Int32? Float?
|
public string HBStart { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("vtotal")]
|
/// <summary>
|
||||||
|
/// Total vertical lines
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string VTotal { get; set; } // TODO: Int32? Float?
|
public string VTotal { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("vbend")]
|
/// <summary>
|
||||||
|
/// Vertical blank end
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string VBEnd { get; set; } // TODO: Int32? Float?
|
public string VBEnd { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
[JsonProperty("vbstart")]
|
/// <summary>
|
||||||
|
/// Vertical blank start
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string VBStart { get; set; } // TODO: Int32? Float?
|
public string VBStart { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -170,8 +254,15 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("extension")]
|
[JsonObject("extension")]
|
||||||
public class Extension
|
public class Extension
|
||||||
{
|
{
|
||||||
[JsonProperty("name")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extension name
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -181,20 +272,39 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("input")]
|
[JsonObject("input")]
|
||||||
public class Input
|
public class Input
|
||||||
{
|
{
|
||||||
[JsonProperty("service")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Input service ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("service", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Service { get; set; }
|
public bool? Service { get; set; }
|
||||||
|
|
||||||
[JsonProperty("tilt")]
|
/// <summary>
|
||||||
|
/// Determins if this has a tilt sensor
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tilt", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Tilt { get; set; }
|
public bool? Tilt { get; set; }
|
||||||
|
|
||||||
[JsonProperty("players")]
|
/// <summary>
|
||||||
|
/// Number of players on the input
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Players { get; set; } // TODO: Int32?
|
public string Players { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("coins")]
|
/// <summary>
|
||||||
|
/// Number of coins required
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("coins", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Coins { get; set; } // TODO: Int32?
|
public string Coins { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
[JsonProperty("controls")]
|
/// <summary>
|
||||||
|
/// Set of controls for the input
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("controls", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Control> Controls { get; set; }
|
public List<Control> Controls { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -203,11 +313,21 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("instance")]
|
[JsonObject("instance")]
|
||||||
public class Instance
|
public class Instance
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the instance
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("briefname")]
|
/// <summary>
|
||||||
|
/// Short name for the instance
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("briefname", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string BriefName { get; set; }
|
public string BriefName { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -216,14 +336,27 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("location")]
|
[JsonObject("location")]
|
||||||
public class Location
|
public class Location
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Location name
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("number")]
|
/// <summary>
|
||||||
|
/// Location ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Number { get; set; }
|
public string Number { get; set; }
|
||||||
|
|
||||||
[JsonProperty("inverted")]
|
/// <summary>
|
||||||
|
/// Determines if location is inverted or not
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Inverted { get; set; }
|
public bool? Inverted { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -233,11 +366,21 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("port")]
|
[JsonObject("port")]
|
||||||
public class Port
|
public class Port
|
||||||
{
|
{
|
||||||
[JsonProperty("tag")]
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tag for the port
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
[JsonProperty("analogs")]
|
/// <summary>
|
||||||
|
/// List of analogs on the port
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("analogs", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Analog> Analogs { get; set; }
|
public List<Analog> Analogs { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -246,17 +389,33 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("setting")]
|
[JsonObject("setting")]
|
||||||
public class Setting
|
public class Setting
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setting name
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("value")]
|
/// <summary>
|
||||||
|
/// Setting value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
[JsonProperty("default")]
|
/// <summary>
|
||||||
|
/// Determines if the setting is default or not
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
|
|
||||||
[JsonProperty("conditions")]
|
/// <summary>
|
||||||
|
/// List of conditions on the setting
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Condition> Conditions { get; set; }
|
public List<Condition> Conditions { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -265,14 +424,27 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonObject("slotoption")]
|
[JsonObject("slotoption")]
|
||||||
public class SlotOption
|
public class SlotOption
|
||||||
{
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Slot option name
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Referenced device name
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("devname")]
|
[JsonProperty("devname")]
|
||||||
public string DeviceName { get; set; }
|
public string DeviceName { get; set; }
|
||||||
|
|
||||||
[JsonProperty("default")]
|
/// <summary>
|
||||||
|
/// Determines if this slot option is default or not
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
246
SabreTools.Library/DatItems/Condition.cs
Normal file
246
SabreTools.Library/DatItems/Condition.cs
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
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 condition on a machine or other item
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("condition")]
|
||||||
|
public class Condition : DatItem
|
||||||
|
{
|
||||||
|
// TODO: Handle obscure field mappings due to this being used *under* other items as well
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Condition tag value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("tag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Condition mask
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("mask", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Mask { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Condition relationship
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("relation", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string Relation { get; set; } // TODO: (eq|ne|gt|le|lt|ge)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Condition value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public string ConditionValue { 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 Condition-specific fields
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Tag))
|
||||||
|
Tag = mappings[Field.DatItem_Tag];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Mask))
|
||||||
|
Mask = mappings[Field.DatItem_Mask];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Relation))
|
||||||
|
Relation = mappings[Field.DatItem_Relation];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_ConditionValue))
|
||||||
|
ConditionValue = mappings[Field.DatItem_ConditionValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a default, empty Condition object
|
||||||
|
/// </summary>
|
||||||
|
public Condition()
|
||||||
|
{
|
||||||
|
ItemType = ItemType.Condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning Methods
|
||||||
|
|
||||||
|
public override object Clone()
|
||||||
|
{
|
||||||
|
return new Condition()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
||||||
|
Tag = this.Tag,
|
||||||
|
Mask = this.Mask,
|
||||||
|
Relation = this.Relation,
|
||||||
|
ConditionValue = this.ConditionValue,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comparision Methods
|
||||||
|
|
||||||
|
public override bool Equals(DatItem other)
|
||||||
|
{
|
||||||
|
// If we don't have a Condition, return false
|
||||||
|
if (ItemType != other.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, treat it as a Condition
|
||||||
|
Condition newOther = other as Condition;
|
||||||
|
|
||||||
|
// If the Feature information matches
|
||||||
|
return (Tag == newOther.Tag
|
||||||
|
&& Mask == newOther.Mask
|
||||||
|
&& Relation == newOther.Relation
|
||||||
|
&& ConditionValue == newOther.ConditionValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 tag
|
||||||
|
if (filter.DatItem_Tag.MatchesPositiveSet(Tag) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Tag.MatchesNegativeSet(Tag) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on mask
|
||||||
|
if (filter.DatItem_Mask.MatchesPositiveSet(Mask) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Mask.MatchesNegativeSet(Mask) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on mask
|
||||||
|
if (filter.DatItem_Relation.MatchesPositiveSet(Relation) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Relation.MatchesNegativeSet(Relation) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on value
|
||||||
|
if (filter.DatItem_ConditionValue.MatchesPositiveSet(ConditionValue) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_ConditionValue.MatchesNegativeSet(ConditionValue) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
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_Tag))
|
||||||
|
Tag = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Mask))
|
||||||
|
Mask = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Relation))
|
||||||
|
Relation = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_ConditionValue))
|
||||||
|
ConditionValue = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 Condition to replace from, ignore specific fields
|
||||||
|
if (item.ItemType != ItemType.Condition)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Cast for easier access
|
||||||
|
Condition newItem = item as Condition;
|
||||||
|
|
||||||
|
// Replace the fields
|
||||||
|
if (fields.Contains(Field.DatItem_Tag))
|
||||||
|
Tag = newItem.Tag;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Mask))
|
||||||
|
Mask = newItem.Mask;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_Relation))
|
||||||
|
Relation = newItem.Relation;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_ConditionValue))
|
||||||
|
ConditionValue = newItem.ConditionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -458,6 +458,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Adjuster:
|
case ItemType.Adjuster:
|
||||||
return new Adjuster();
|
return new Adjuster();
|
||||||
|
|
||||||
|
case ItemType.Analog:
|
||||||
|
return new Analog();
|
||||||
|
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
return new Archive();
|
return new Archive();
|
||||||
|
|
||||||
@@ -470,6 +473,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return new Chip();
|
return new Chip();
|
||||||
|
|
||||||
|
case ItemType.Condition:
|
||||||
|
return new Condition();
|
||||||
|
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
return new Configuration();
|
return new Configuration();
|
||||||
|
|
||||||
@@ -519,10 +525,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
return itemType switch
|
return itemType switch
|
||||||
{
|
{
|
||||||
ItemType.Adjuster => new Adjuster(),
|
ItemType.Adjuster => new Adjuster(),
|
||||||
|
ItemType.Analog => new Analog(),
|
||||||
ItemType.Archive => new Archive(),
|
ItemType.Archive => new Archive(),
|
||||||
ItemType.BiosSet => new BiosSet(),
|
ItemType.BiosSet => new BiosSet(),
|
||||||
ItemType.Blank => new Blank(),
|
ItemType.Blank => new Blank(),
|
||||||
ItemType.Chip => new Chip(),
|
ItemType.Chip => new Chip(),
|
||||||
|
ItemType.Condition => new Condition(),
|
||||||
ItemType.Configuration => new Configuration(),
|
ItemType.Configuration => new Configuration(),
|
||||||
ItemType.DeviceReference => new DeviceReference(),
|
ItemType.DeviceReference => new DeviceReference(),
|
||||||
ItemType.DipSwitch => new DipSwitch(),
|
ItemType.DipSwitch => new DipSwitch(),
|
||||||
|
|||||||
@@ -203,13 +203,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
Machine_Display_VBEnd,
|
Machine_Display_VBEnd,
|
||||||
Machine_Display_VBStart,
|
Machine_Display_VBStart,
|
||||||
|
|
||||||
// Conditions
|
|
||||||
Machine_Conditions,
|
|
||||||
Machine_Condition_Tag,
|
|
||||||
Machine_Condition_Mask,
|
|
||||||
Machine_Condition_Relation,
|
|
||||||
Machine_Condition_Value,
|
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
Machine_Inputs,
|
Machine_Inputs,
|
||||||
Machine_Input_Service,
|
Machine_Input_Service,
|
||||||
@@ -393,6 +386,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
DatItem_Condition_Relation,
|
DatItem_Condition_Relation,
|
||||||
DatItem_Condition_Value,
|
DatItem_Condition_Value,
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
DatItem_Mask,
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
DatItem_Description,
|
DatItem_Description,
|
||||||
|
|
||||||
@@ -401,8 +397,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
DatItem_ChipType,
|
DatItem_ChipType,
|
||||||
DatItem_Clock,
|
DatItem_Clock,
|
||||||
|
|
||||||
// Configuration
|
// Condition
|
||||||
DatItem_Mask,
|
DatItem_ConditionValue,
|
||||||
|
DatItem_Relation,
|
||||||
|
|
||||||
// Configuration.Locations
|
// Configuration.Locations
|
||||||
DatItem_Locations,
|
DatItem_Locations,
|
||||||
@@ -489,9 +486,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
// "Auxiliary" item types
|
// "Auxiliary" item types
|
||||||
Adjuster,
|
Adjuster,
|
||||||
|
Analog,
|
||||||
Archive,
|
Archive,
|
||||||
BiosSet,
|
BiosSet,
|
||||||
Chip,
|
Chip,
|
||||||
|
Condition,
|
||||||
Configuration,
|
Configuration,
|
||||||
DeviceReference,
|
DeviceReference,
|
||||||
DipSwitch,
|
DipSwitch,
|
||||||
|
|||||||
@@ -158,12 +158,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("displays", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("displays", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public List<Display> Displays { get; set; } = null;
|
public List<Display> Displays { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of associated conditions
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<Condition> Conditions { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of associated inputs
|
/// List of associated inputs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -535,7 +529,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
SourceFile = this.SourceFile,
|
SourceFile = this.SourceFile,
|
||||||
Runnable = this.Runnable,
|
Runnable = this.Runnable,
|
||||||
Displays = this.Displays,
|
Displays = this.Displays,
|
||||||
Conditions = this.Conditions,
|
|
||||||
Inputs = this.Inputs,
|
Inputs = this.Inputs,
|
||||||
Ports = this.Ports,
|
Ports = this.Ports,
|
||||||
Devices = this.Devices,
|
Devices = this.Devices,
|
||||||
@@ -1018,105 +1011,13 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Conditions
|
|
||||||
|
|
||||||
// Machine_Conditions
|
|
||||||
if (filter.Machine_Conditions.MatchesNeutral(null, Conditions?.Any() ?? null) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Machine_Condition_Tag
|
|
||||||
if (Conditions?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var condition in Conditions)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Condition_Tag.MatchesPositiveSet(condition?.Tag) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Condition_Tag.MatchesNegativeSet(condition?.Tag) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Machine_Condition_Mask
|
|
||||||
if (Conditions?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var condition in Conditions)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Condition_Mask.MatchesPositiveSet(condition?.Mask) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Condition_Mask.MatchesNegativeSet(condition?.Mask) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Machine_Condition_Relation
|
|
||||||
if (Conditions?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var condition in Conditions)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Condition_Relation.MatchesPositiveSet(condition?.Relation) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Condition_Relation.MatchesNegativeSet(condition?.Relation) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Machine_Condition_Value
|
|
||||||
if (Conditions?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var condition in Conditions)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Condition_Value.MatchesPositiveSet(condition?.Value) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Condition_Value.MatchesNegativeSet(condition?.Value) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
// TODO: Inputs
|
// TODO: Inputs
|
||||||
// TODO: Inputs.Controls
|
// TODO: Inputs.Controls
|
||||||
// TODO: Ports
|
// TODO: Ports
|
||||||
// TODO: Ports.Analogs
|
// TODO: Ports.Analogs
|
||||||
// TODO: Drivers
|
|
||||||
// TODO: Features
|
|
||||||
// TODO: Devices
|
// TODO: Devices
|
||||||
// TODO: Devices.Instances
|
// TODO: Devices.Instances
|
||||||
// TODO: Devices.Extensions
|
// TODO: Devices.Extensions
|
||||||
// TODO: Slots
|
|
||||||
// TODO: Slots.SlotOptions
|
|
||||||
|
|
||||||
#endregion // ListXML
|
#endregion // ListXML
|
||||||
|
|
||||||
|
|||||||
@@ -68,13 +68,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<string> Machine_Display_VBEnd { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> Machine_Display_VBEnd { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> Machine_Display_VBStart { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> Machine_Display_VBStart { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Conditions
|
|
||||||
public FilterItem<bool?> Machine_Conditions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_Condition_Tag { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Condition_Mask { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Condition_Relation { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Condition_Value { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
public FilterItem<bool?> Machine_Inputs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> Machine_Inputs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<bool?> Machine_Input_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> Machine_Input_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
@@ -257,6 +250,9 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<string> DatItem_Condition_Relation { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Condition_Relation { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_Condition_Value { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Condition_Value { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
public FilterItem<string> DatItem_Mask { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
@@ -266,8 +262,9 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<ChipType> DatItem_ChipType { get; private set; } = new FilterItem<ChipType>() { Positive = ChipType.NULL, Negative = ChipType.NULL };
|
public FilterItem<ChipType> DatItem_ChipType { get; private set; } = new FilterItem<ChipType>() { Positive = ChipType.NULL, Negative = ChipType.NULL };
|
||||||
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Configuration
|
// Condition
|
||||||
public FilterItem<string> DatItem_Mask { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Relation { get; private set; } = new FilterItem<string>();
|
||||||
|
public FilterItem<string> DatItem_ConditionValue { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Configuration.Locations
|
// Configuration.Locations
|
||||||
public FilterItem<bool?> DatItem_Locations { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Locations { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
@@ -650,42 +647,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
Machine_Display_VBStart.PositiveSet.Add(value);
|
Machine_Display_VBStart.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Conditions
|
|
||||||
case Field.Machine_Conditions:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_Conditions.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_Conditions.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Condition_Tag:
|
|
||||||
if (negate)
|
|
||||||
Machine_Condition_Tag.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Condition_Tag.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Condition_Mask:
|
|
||||||
if (negate)
|
|
||||||
Machine_Condition_Mask.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Condition_Mask.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Condition_Relation:
|
|
||||||
if (negate)
|
|
||||||
Machine_Condition_Relation.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Condition_Relation.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Condition_Value:
|
|
||||||
if (negate)
|
|
||||||
Machine_Condition_Value.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Condition_Value.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
case Field.Machine_Inputs:
|
case Field.Machine_Inputs:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -1534,6 +1495,14 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_Condition_Value.PositiveSet.Add(value);
|
DatItem_Condition_Value.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
case Field.DatItem_Mask:
|
||||||
|
if (negate)
|
||||||
|
DatItem_Mask.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_Mask.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
case Field.DatItem_Description:
|
case Field.DatItem_Description:
|
||||||
if (negate)
|
if (negate)
|
||||||
@@ -1564,12 +1533,19 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_Clock.PositiveSet.Add(value);
|
DatItem_Clock.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Configuration
|
// Condition
|
||||||
case Field.DatItem_Mask:
|
case Field.DatItem_Relation:
|
||||||
if (negate)
|
if (negate)
|
||||||
DatItem_Mask.NegativeSet.Add(value);
|
DatItem_Relation.NegativeSet.Add(value);
|
||||||
else
|
else
|
||||||
DatItem_Mask.PositiveSet.Add(value);
|
DatItem_Relation.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Field.DatItem_ConditionValue:
|
||||||
|
if (negate)
|
||||||
|
DatItem_ConditionValue.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_ConditionValue.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Configurations.Locations
|
// Configurations.Locations
|
||||||
|
|||||||
@@ -617,21 +617,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "display_vbstart":
|
case "display_vbstart":
|
||||||
return Field.Machine_Display_VBStart;
|
return Field.Machine_Display_VBStart;
|
||||||
|
|
||||||
case "conditions":
|
|
||||||
return Field.Machine_Conditions;
|
|
||||||
|
|
||||||
case "condition_tag":
|
|
||||||
return Field.Machine_Condition_Tag;
|
|
||||||
|
|
||||||
case "condition_mask":
|
|
||||||
return Field.Machine_Condition_Mask;
|
|
||||||
|
|
||||||
case "condition_relation":
|
|
||||||
return Field.Machine_Condition_Relation;
|
|
||||||
|
|
||||||
case "condition_value":
|
|
||||||
return Field.Machine_Condition_Value;
|
|
||||||
|
|
||||||
case "inputs":
|
case "inputs":
|
||||||
return Field.Machine_Inputs;
|
return Field.Machine_Inputs;
|
||||||
|
|
||||||
@@ -1046,6 +1031,10 @@ namespace SabreTools.Library.Tools
|
|||||||
case "condition_value":
|
case "condition_value":
|
||||||
return Field.DatItem_Condition_Value;
|
return Field.DatItem_Condition_Value;
|
||||||
|
|
||||||
|
// Analog
|
||||||
|
case "mask":
|
||||||
|
return Field.DatItem_Mask;
|
||||||
|
|
||||||
// BiosSet
|
// BiosSet
|
||||||
case "description":
|
case "description":
|
||||||
case "biosdescription":
|
case "biosdescription":
|
||||||
@@ -1063,10 +1052,14 @@ namespace SabreTools.Library.Tools
|
|||||||
case "clock":
|
case "clock":
|
||||||
return Field.DatItem_Clock;
|
return Field.DatItem_Clock;
|
||||||
|
|
||||||
// Configuration
|
// Condition
|
||||||
case "mask":
|
case "relation":
|
||||||
return Field.DatItem_Mask;
|
return Field.DatItem_Relation;
|
||||||
|
|
||||||
|
case "conditionvalue":
|
||||||
|
return Field.DatItem_ConditionValue;
|
||||||
|
|
||||||
|
// Configuration
|
||||||
case "locations":
|
case "locations":
|
||||||
return Field.DatItem_Locations;
|
return Field.DatItem_Locations;
|
||||||
|
|
||||||
@@ -1665,6 +1658,8 @@ namespace SabreTools.Library.Tools
|
|||||||
{
|
{
|
||||||
case "adjuster":
|
case "adjuster":
|
||||||
return ItemType.Adjuster;
|
return ItemType.Adjuster;
|
||||||
|
case "analog":
|
||||||
|
return ItemType.Analog;
|
||||||
case "archive":
|
case "archive":
|
||||||
return ItemType.Archive;
|
return ItemType.Archive;
|
||||||
case "biosset":
|
case "biosset":
|
||||||
@@ -1673,6 +1668,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return ItemType.Blank;
|
return ItemType.Blank;
|
||||||
case "chip":
|
case "chip":
|
||||||
return ItemType.Chip;
|
return ItemType.Chip;
|
||||||
|
case "condition":
|
||||||
|
return ItemType.Condition;
|
||||||
case "configuration":
|
case "configuration":
|
||||||
return ItemType.Configuration;
|
return ItemType.Configuration;
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
@@ -1708,10 +1705,12 @@ namespace SabreTools.Library.Tools
|
|||||||
return itemType?.ToLowerInvariant() switch
|
return itemType?.ToLowerInvariant() switch
|
||||||
{
|
{
|
||||||
"adjuster" => ItemType.Adjuster,
|
"adjuster" => ItemType.Adjuster,
|
||||||
|
"analog" => ItemType.Analog,
|
||||||
"archive" => ItemType.Archive,
|
"archive" => ItemType.Archive,
|
||||||
"biosset" => ItemType.BiosSet,
|
"biosset" => ItemType.BiosSet,
|
||||||
"blank" => ItemType.Blank,
|
"blank" => ItemType.Blank,
|
||||||
"chip" => ItemType.Chip,
|
"chip" => ItemType.Chip,
|
||||||
|
"condition" => ItemType.Condition,
|
||||||
"configuration" => ItemType.Configuration,
|
"configuration" => ItemType.Configuration,
|
||||||
"device_ref" => ItemType.DeviceReference,
|
"device_ref" => ItemType.DeviceReference,
|
||||||
"dipswitch" => ItemType.DipSwitch,
|
"dipswitch" => ItemType.DipSwitch,
|
||||||
@@ -2270,6 +2269,8 @@ namespace SabreTools.Library.Tools
|
|||||||
{
|
{
|
||||||
case ItemType.Adjuster:
|
case ItemType.Adjuster:
|
||||||
return "adjuster";
|
return "adjuster";
|
||||||
|
case ItemType.Analog:
|
||||||
|
return "analog";
|
||||||
case ItemType.Archive:
|
case ItemType.Archive:
|
||||||
return "archive";
|
return "archive";
|
||||||
case ItemType.BiosSet:
|
case ItemType.BiosSet:
|
||||||
@@ -2278,6 +2279,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return "blank";
|
return "blank";
|
||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return "chip";
|
return "chip";
|
||||||
|
case ItemType.Condition:
|
||||||
|
return "condition";
|
||||||
case ItemType.Configuration:
|
case ItemType.Configuration:
|
||||||
return "configuration";
|
return "configuration";
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
@@ -2313,10 +2316,12 @@ namespace SabreTools.Library.Tools
|
|||||||
return itemType switch
|
return itemType switch
|
||||||
{
|
{
|
||||||
ItemType.Adjuster => "adjuster",
|
ItemType.Adjuster => "adjuster",
|
||||||
|
ItemType.Analog => "analog",
|
||||||
ItemType.Archive => "archive",
|
ItemType.Archive => "archive",
|
||||||
ItemType.BiosSet => "biosset",
|
ItemType.BiosSet => "biosset",
|
||||||
ItemType.Blank => "blank",
|
ItemType.Blank => "blank",
|
||||||
ItemType.Chip => "chip",
|
ItemType.Chip => "chip",
|
||||||
|
ItemType.Condition => "condition",
|
||||||
ItemType.Configuration => "configuration",
|
ItemType.Configuration => "configuration",
|
||||||
ItemType.DeviceReference => "device_ref",
|
ItemType.DeviceReference => "device_ref",
|
||||||
ItemType.DipSwitch => "dipswitch",
|
ItemType.DipSwitch => "dipswitch",
|
||||||
|
|||||||
Reference in New Issue
Block a user