mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Sub items should not check types
This commit is contained in:
@@ -1409,7 +1409,7 @@ namespace SabreTools.Library.DatFiles
|
||||
List<string> slotOptions = Items[machine]
|
||||
.Where(i => i.ItemType == ItemType.Slot)
|
||||
.Select(i => i as Slot)
|
||||
.Where(s => s.SlotOptions != null && s.SlotOptions.Count != 0)
|
||||
.Where(s => s.SlotOptionsSpecified)
|
||||
.SelectMany(s => s.SlotOptions)
|
||||
.Select(so => so.DeviceName)
|
||||
.Distinct()
|
||||
@@ -1473,8 +1473,7 @@ namespace SabreTools.Library.DatFiles
|
||||
List<DatItem> slotItems = Items[slotOption];
|
||||
newSlotOptions.AddRange(slotItems
|
||||
.Where(i => i.ItemType == ItemType.Slot)
|
||||
.Where(s => (s as Slot).SlotOptions != null)
|
||||
.Where(s => (s as Slot).SlotOptions.Count != 0)
|
||||
.Where(s => (s as Slot).SlotOptionsSpecified)
|
||||
.SelectMany(s => (s as Slot).SlotOptions)
|
||||
.Select(o => o.DeviceName));
|
||||
|
||||
|
||||
@@ -1330,7 +1330,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("adjuster");
|
||||
xtw.WriteRequiredAttributeString("name", adjuster.Name);
|
||||
xtw.WriteOptionalAttributeString("default", adjuster.Default.FromYesNo());
|
||||
if (adjuster.Conditions != null)
|
||||
if (adjuster.ConditionsSpecified)
|
||||
{
|
||||
foreach (var adjusterCondition in adjuster.Conditions)
|
||||
{
|
||||
@@ -1381,7 +1381,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("tag", configuration.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", configuration.Mask);
|
||||
|
||||
if (configuration.Conditions != null)
|
||||
if (configuration.ConditionsSpecified)
|
||||
{
|
||||
foreach (var configurationCondition in configuration.Conditions)
|
||||
{
|
||||
@@ -1393,7 +1393,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (configuration.Locations != null)
|
||||
if (configuration.LocationsSpecified)
|
||||
{
|
||||
foreach (var location in configuration.Locations)
|
||||
{
|
||||
@@ -1404,7 +1404,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (configuration.Settings != null)
|
||||
if (configuration.SettingsSpecified)
|
||||
{
|
||||
foreach (var setting in configuration.Settings)
|
||||
{
|
||||
@@ -1426,7 +1426,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("fixed_image", device.FixedImage);
|
||||
xtw.WriteOptionalAttributeString("mandatory", device.Mandatory?.ToString());
|
||||
xtw.WriteOptionalAttributeString("interface", device.Interface);
|
||||
if (device.Instances != null)
|
||||
if (device.InstancesSpecified)
|
||||
{
|
||||
foreach (var instance in device.Instances)
|
||||
{
|
||||
@@ -1436,7 +1436,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (device.Extensions != null)
|
||||
if (device.ExtensionsSpecified)
|
||||
{
|
||||
foreach (var extension in device.Extensions)
|
||||
{
|
||||
@@ -1461,7 +1461,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("name", dipSwitch.Name);
|
||||
xtw.WriteOptionalAttributeString("tag", dipSwitch.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask);
|
||||
if (dipSwitch.Conditions != null)
|
||||
if (dipSwitch.ConditionsSpecified)
|
||||
{
|
||||
foreach (var dipSwitchCondition in dipSwitch.Conditions)
|
||||
{
|
||||
@@ -1473,7 +1473,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (dipSwitch.Locations != null)
|
||||
if (dipSwitch.LocationsSpecified)
|
||||
{
|
||||
foreach (var location in dipSwitch.Locations)
|
||||
{
|
||||
@@ -1484,7 +1484,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (dipSwitch.Values != null)
|
||||
if (dipSwitch.ValuesSpecified)
|
||||
{
|
||||
foreach (var value in dipSwitch.Values)
|
||||
{
|
||||
@@ -1492,7 +1492,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("name", value.Name);
|
||||
xtw.WriteOptionalAttributeString("value", value.Value);
|
||||
xtw.WriteOptionalAttributeString("default", value.Default.FromYesNo());
|
||||
if (value.Conditions != null)
|
||||
if (value.ConditionsSpecified)
|
||||
{
|
||||
foreach (var dipValueCondition in value.Conditions)
|
||||
{
|
||||
@@ -1570,7 +1570,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("tilt", input.Tilt.FromYesNo());
|
||||
xtw.WriteOptionalAttributeString("players", input.Players?.ToString());
|
||||
xtw.WriteOptionalAttributeString("coins", input.Coins?.ToString());
|
||||
if (input.Controls != null)
|
||||
if (input.ControlsSpecified)
|
||||
{
|
||||
foreach (var control in input.Controls)
|
||||
{
|
||||
@@ -1597,7 +1597,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var port = datItem as Port;
|
||||
xtw.WriteStartElement("port");
|
||||
xtw.WriteOptionalAttributeString("tag", port.Tag);
|
||||
if (port.Analogs != null)
|
||||
if (port.AnalogsSpecified)
|
||||
{
|
||||
foreach (var analog in port.Analogs)
|
||||
{
|
||||
@@ -1645,7 +1645,7 @@ namespace SabreTools.Library.DatFiles
|
||||
var slot = datItem as Slot;
|
||||
xtw.WriteStartElement("slot");
|
||||
xtw.WriteOptionalAttributeString("name", slot.Name);
|
||||
if (slot.SlotOptions != null)
|
||||
if (slot.SlotOptionsSpecified)
|
||||
{
|
||||
foreach (var slotOption in slot.SlotOptions)
|
||||
{
|
||||
|
||||
@@ -677,7 +677,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("name", dipSwitch.Name);
|
||||
xtw.WriteRequiredAttributeString("tag", dipSwitch.Tag);
|
||||
xtw.WriteRequiredAttributeString("mask", dipSwitch.Mask);
|
||||
if (dipSwitch.Values != null)
|
||||
if (dipSwitch.ValuesSpecified)
|
||||
{
|
||||
foreach (Setting dipValue in dipSwitch.Values)
|
||||
{
|
||||
@@ -701,7 +701,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("name", disk.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", disk.Part?.Interface);
|
||||
|
||||
if (disk.Part?.Features != null && disk.Part?.Features.Count > 0)
|
||||
if (disk.Part?.FeaturesSpecified == true)
|
||||
{
|
||||
foreach (PartFeature partFeature in disk.Part.Features)
|
||||
{
|
||||
@@ -748,7 +748,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("name", rom.Part?.Name);
|
||||
xtw.WriteRequiredAttributeString("interface", rom.Part?.Interface);
|
||||
|
||||
if (rom.Part?.Features != null && rom.Part?.Features.Count > 0)
|
||||
if (rom.Part?.FeaturesSpecified == true)
|
||||
{
|
||||
foreach (PartFeature kvp in rom.Part.Features)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace SabreTools.Library.DatItems
|
||||
Default = mappings[Field.DatItem_Default].AsYesNo();
|
||||
|
||||
// Field.DatItem_Conditions does not apply here
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the conditions match
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Default))
|
||||
Default = null;
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
|
||||
@@ -98,10 +98,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on mask
|
||||
if (!filter.PassStringFilter(filter.DatItem_Analog_Mask, Mask))
|
||||
|
||||
@@ -179,10 +179,6 @@ namespace SabreTools.Library.DatItems
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
if (sub)
|
||||
{
|
||||
// Filter on tag
|
||||
@@ -205,6 +201,10 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// Filter on tag
|
||||
if (!filter.PassStringFilter(filter.DatItem_Tag, Tag))
|
||||
return false;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Mask))
|
||||
Mask = mappings[Field.DatItem_Mask];
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings != null)
|
||||
if (SettingsSpecified)
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the conditions match
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -192,7 +192,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// If the locations match
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// If the settings match
|
||||
if (Settings != null)
|
||||
if (SettingsSpecified)
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
{
|
||||
@@ -267,7 +267,7 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -277,21 +277,21 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// Filter on individual locations
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
if (!location.PassesFilter(filter))
|
||||
if (!location.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Settings != null)
|
||||
if (SettingsSpecified)
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
{
|
||||
if (!setting.PassesFilter(filter))
|
||||
if (!setting.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Mask))
|
||||
Mask = null;
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -326,7 +326,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -334,7 +334,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings != null)
|
||||
if (SettingsSpecified)
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
{
|
||||
|
||||
@@ -261,10 +261,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on control type
|
||||
if (filter.DatItem_Control_Type.MatchesPositive(ControlType.NULL, ControlType) == false)
|
||||
|
||||
@@ -184,10 +184,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on area name
|
||||
if (!filter.PassStringFilter(filter.DatItem_AreaName, Name))
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Interface))
|
||||
Interface = mappings[Field.DatItem_Interface];
|
||||
|
||||
if (Instances != null)
|
||||
if (InstancesSpecified)
|
||||
{
|
||||
foreach (Instance instance in Instances)
|
||||
{
|
||||
@@ -117,7 +117,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Extensions != null)
|
||||
if (ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension extension in Extensions)
|
||||
{
|
||||
@@ -186,7 +186,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the instances match
|
||||
if (Instances != null)
|
||||
if (InstancesSpecified)
|
||||
{
|
||||
foreach (Instance instance in Instances)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// If the extensions match
|
||||
if (Extensions != null)
|
||||
if (ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension extension in Extensions)
|
||||
{
|
||||
@@ -244,21 +244,21 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual instances
|
||||
if (Instances != null)
|
||||
if (InstancesSpecified)
|
||||
{
|
||||
foreach (Instance instance in Instances)
|
||||
{
|
||||
if (!instance.PassesFilter(filter))
|
||||
if (!instance.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on individual extensions
|
||||
if (Extensions != null)
|
||||
if (ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension extension in Extensions)
|
||||
{
|
||||
if (!extension.PassesFilter(filter))
|
||||
if (!extension.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Interface))
|
||||
Interface = null;
|
||||
|
||||
if (Instances != null)
|
||||
if (InstancesSpecified)
|
||||
{
|
||||
foreach (Instance instance in Instances)
|
||||
{
|
||||
@@ -299,7 +299,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Extensions != null)
|
||||
if (ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension extension in Extensions)
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Mask))
|
||||
Mask = mappings[Field.DatItem_Mask];
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Values != null)
|
||||
if (ValuesSpecified)
|
||||
{
|
||||
foreach (Setting value in Values)
|
||||
{
|
||||
@@ -226,11 +226,11 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the part matches
|
||||
if (Part != null)
|
||||
if (PartSpecified)
|
||||
match &= (Part == newOther.Part);
|
||||
|
||||
// If the conditions match
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// If the locations match
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// If the values match
|
||||
if (Values != null)
|
||||
if (ValuesSpecified)
|
||||
{
|
||||
foreach (Setting value in Values)
|
||||
{
|
||||
@@ -316,7 +316,7 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -326,21 +326,21 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
// Filter on individual locations
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
if (!location.PassesFilter(filter))
|
||||
if (!location.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Values != null)
|
||||
if (ValuesSpecified)
|
||||
{
|
||||
foreach (Setting value in Values)
|
||||
{
|
||||
if (!value.PassesFilter(filter))
|
||||
if (!value.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ namespace SabreTools.Library.DatItems
|
||||
// Filter on Part
|
||||
if (PartSpecified)
|
||||
{
|
||||
if (!Part.PassesFilter(filter))
|
||||
if (!Part.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Mask))
|
||||
Mask = null;
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -391,7 +391,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Locations != null)
|
||||
if (LocationsSpecified)
|
||||
{
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
@@ -399,7 +399,7 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
}
|
||||
|
||||
if (Values != null)
|
||||
if (ValuesSpecified)
|
||||
{
|
||||
foreach (Setting value in Values)
|
||||
{
|
||||
@@ -411,7 +411,7 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (Part != null)
|
||||
if (PartSpecified)
|
||||
Part.RemoveFields(fields);
|
||||
|
||||
#endregion
|
||||
@@ -477,7 +477,7 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (Part != null && newItem.Part != null)
|
||||
if (PartSpecified && newItem.PartSpecified)
|
||||
Part.ReplaceFields(newItem.Part, fields);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -493,14 +493,14 @@ namespace SabreTools.Library.DatItems
|
||||
// Filter on DiskArea
|
||||
if (DiskAreaSpecified)
|
||||
{
|
||||
if (!DiskArea.PassesFilter(filter))
|
||||
if (!DiskArea.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on Part
|
||||
if (PartSpecified)
|
||||
{
|
||||
if (!Part.PassesFilter(filter))
|
||||
if (!Part.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -553,10 +553,10 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (DiskArea != null)
|
||||
if (DiskAreaSpecified)
|
||||
DiskArea.RemoveFields(fields);
|
||||
|
||||
if (Part != null)
|
||||
if (PartSpecified)
|
||||
Part.RemoveFields(fields);
|
||||
|
||||
#endregion
|
||||
@@ -669,10 +669,10 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (DiskArea != null && newItem.DiskArea != null)
|
||||
if (DiskAreaSpecified && newItem.DiskAreaSpecified)
|
||||
DiskArea.ReplaceFields(newItem.DiskArea, fields);
|
||||
|
||||
if (Part != null && newItem.Part != null)
|
||||
if (PartSpecified && newItem.PartSpecified)
|
||||
Part.ReplaceFields(newItem.Part, fields);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -139,10 +139,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on area name
|
||||
if (!filter.PassStringFilter(filter.DatItem_AreaName, Name))
|
||||
|
||||
@@ -137,10 +137,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on item name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Extension_Name, Name))
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Coins))
|
||||
Coins = Sanitizer.CleanLong(mappings[Field.DatItem_Coins]);
|
||||
|
||||
if (Controls != null)
|
||||
if (ControlsSpecified)
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the controls match
|
||||
if (Controls != null)
|
||||
if (ControlsSpecified)
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
@@ -202,11 +202,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual controls
|
||||
if (Controls != null)
|
||||
if (ControlsSpecified)
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
if (!control.PassesFilter(filter))
|
||||
if (!control.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Coins))
|
||||
Coins = null;
|
||||
|
||||
if (Controls != null)
|
||||
if (ControlsSpecified)
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
|
||||
@@ -148,10 +148,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on item name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Instance_Name, Name))
|
||||
|
||||
@@ -167,10 +167,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on item name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Location_Name, Name))
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace SabreTools.Library.DatItems
|
||||
Interface = mappings[Field.DatItem_Part_Interface];
|
||||
|
||||
// Handle Feature-specific fields
|
||||
if (Features != null)
|
||||
if (FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature partFeature in Features)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the features match
|
||||
if (Features != null)
|
||||
if (FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature partFeature in Features)
|
||||
{
|
||||
@@ -175,10 +175,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on part name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Part_Name, Name))
|
||||
@@ -189,11 +204,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on features
|
||||
if (Features != null)
|
||||
if (FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature partFeature in Features)
|
||||
{
|
||||
if (!partFeature.PassesFilter(filter))
|
||||
if (!partFeature.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -217,7 +232,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Part_Interface))
|
||||
Interface = null;
|
||||
|
||||
if (Features != null)
|
||||
if (FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature partFeature in Features)
|
||||
{
|
||||
|
||||
@@ -148,10 +148,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Part_Feature_Name, Name))
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Tag))
|
||||
Tag = mappings[Field.DatItem_Tag];
|
||||
|
||||
if (Analogs != null)
|
||||
if (AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog analog in Analogs)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the analogs match
|
||||
if (Analogs != null)
|
||||
if (AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog analog in Analogs)
|
||||
{
|
||||
@@ -140,11 +140,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual analogs
|
||||
if (Analogs != null)
|
||||
if (AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog analog in Analogs)
|
||||
{
|
||||
if (!analog.PassesFilter(filter))
|
||||
if (!analog.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Tag))
|
||||
Tag = null;
|
||||
|
||||
if (Analogs != null)
|
||||
if (AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog analog in Analogs)
|
||||
{
|
||||
|
||||
@@ -943,14 +943,14 @@ namespace SabreTools.Library.DatItems
|
||||
// Filter on DataArea
|
||||
if (DataAreaSpecified)
|
||||
{
|
||||
if (!DataArea.PassesFilter(filter))
|
||||
if (!DataArea.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on Part
|
||||
if (PartSpecified)
|
||||
{
|
||||
if (!Part.PassesFilter(filter))
|
||||
if (!Part.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1067,10 +1067,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = null;
|
||||
|
||||
if (DataArea != null)
|
||||
if (DataAreaSpecified)
|
||||
DataArea.RemoveFields(fields);
|
||||
|
||||
if (Part != null)
|
||||
if (PartSpecified)
|
||||
Part.RemoveFields(fields);
|
||||
|
||||
#endregion
|
||||
@@ -1291,10 +1291,10 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Value))
|
||||
Value = newItem.Value;
|
||||
|
||||
if (DataArea != null && newItem.DataArea != null)
|
||||
if (DataAreaSpecified && newItem.DataAreaSpecified)
|
||||
DataArea.ReplaceFields(newItem.DataArea, fields);
|
||||
|
||||
if (Part != null && newItem.Part != null)
|
||||
if (PartSpecified && newItem.PartSpecified)
|
||||
Part.ReplaceFields(newItem.Part, fields);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Setting_Default))
|
||||
Default = mappings[Field.DatItem_Setting_Default].AsYesNo();
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the conditions match
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -196,10 +196,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on item name
|
||||
if (!filter.PassStringFilter(filter.DatItem_Setting_Name, Name))
|
||||
@@ -214,7 +229,7 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual conditions
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
@@ -245,7 +260,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Setting_Default))
|
||||
Default = null;
|
||||
|
||||
if (Conditions != null)
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (mappings.Keys.Contains(Field.DatItem_Name))
|
||||
Name = mappings[Field.DatItem_Name];
|
||||
|
||||
if (SlotOptions != null)
|
||||
if (SlotOptionsSpecified)
|
||||
{
|
||||
foreach (SlotOption slotOption in SlotOptions)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ namespace SabreTools.Library.DatItems
|
||||
return match;
|
||||
|
||||
// If the slot options match
|
||||
if (SlotOptions != null)
|
||||
if (SlotOptionsSpecified)
|
||||
{
|
||||
foreach (SlotOption slotOption in SlotOptions)
|
||||
{
|
||||
@@ -179,11 +179,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on individual slot options
|
||||
if (SlotOptions != null)
|
||||
if (SlotOptionsSpecified)
|
||||
{
|
||||
foreach (SlotOption slotOption in SlotOptions)
|
||||
{
|
||||
if (!slotOption.PassesFilter(filter))
|
||||
if (!slotOption.PassesFilter(filter, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Name))
|
||||
Name = null;
|
||||
|
||||
if (SlotOptions != null)
|
||||
if (SlotOptionsSpecified)
|
||||
{
|
||||
foreach (SlotOption slotOption in SlotOptions)
|
||||
{
|
||||
|
||||
@@ -164,10 +164,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <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)
|
||||
{
|
||||
return PassesFilter(filter, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public bool PassesFilter(Filter filter, bool sub)
|
||||
{
|
||||
// If we're a top-level item, check common fields
|
||||
if (!sub)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter on item name
|
||||
if (!filter.PassStringFilter(filter.DatItem_SlotOption_Name, Name))
|
||||
|
||||
Reference in New Issue
Block a user