mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Create and use ParentablePath
This commit is contained in:
@@ -5,7 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NaturalSort;
|
||||
|
||||
using SabreTools.Library.Data;
|
||||
using SabreTools.Library.DatItems;
|
||||
using SabreTools.Library.Tools;
|
||||
@@ -97,8 +97,16 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
private FilterItem<string> RebuildTo = new FilterItem<string>();
|
||||
|
||||
// TODO: Machine.Devices - List<string>
|
||||
// TODO: Machine.SlotOptions - List<string>
|
||||
/// <summary>
|
||||
/// Include or exclude machine devices
|
||||
/// </summary>
|
||||
private FilterItem<string> Devices = new FilterItem<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Include or exclude machine slotoptions
|
||||
/// </summary>
|
||||
private FilterItem<string> SlotOptions = new FilterItem<string>();
|
||||
|
||||
// TODO: Machine.Infos - List<KeyValuePair<string, string>>
|
||||
|
||||
/// <summary>
|
||||
@@ -463,6 +471,20 @@ namespace SabreTools.Library.DatFiles
|
||||
RebuildTo.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Devices:
|
||||
if (negate)
|
||||
Devices.NegativeSet.Add(value);
|
||||
else
|
||||
Devices.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.SlotOptions:
|
||||
if (negate)
|
||||
SlotOptions.NegativeSet.Add(value);
|
||||
else
|
||||
SlotOptions.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.MachineType:
|
||||
if (negate)
|
||||
MachineTypes.Negative |= value.AsMachineType();
|
||||
@@ -1085,6 +1107,30 @@ namespace SabreTools.Library.DatFiles
|
||||
if (this.RebuildTo.MatchesNegativeSet(item.RebuildTo) == true)
|
||||
return false;
|
||||
|
||||
// Filter on devices
|
||||
bool anyPositiveDevice = false;
|
||||
bool anyNegativeDevice = false;
|
||||
foreach (string device in item.Devices)
|
||||
{
|
||||
anyPositiveDevice |= this.Devices.MatchesPositiveSet(device) == true;
|
||||
anyNegativeDevice |= this.Devices.MatchesNegativeSet(device) == false;
|
||||
}
|
||||
|
||||
if (!anyPositiveDevice || anyNegativeDevice)
|
||||
return false;
|
||||
|
||||
// Filter on slot options
|
||||
bool anyPositiveSlotOption = false;
|
||||
bool anyNegativeSlotOption = false;
|
||||
foreach (string device in item.SlotOptions)
|
||||
{
|
||||
anyPositiveSlotOption |= this.SlotOptions.MatchesPositiveSet(device) == true;
|
||||
anyNegativeSlotOption |= this.SlotOptions.MatchesNegativeSet(device) == false;
|
||||
}
|
||||
|
||||
if (!anyPositiveSlotOption || anyNegativeSlotOption)
|
||||
return false;
|
||||
|
||||
// Filter on machine type
|
||||
if (this.MachineTypes.MatchesPositive(MachineType.NULL, item.MachineType) == false)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user