Support more AttractMode fields

This commit is contained in:
Matt Nadareski
2020-08-20 14:36:36 -07:00
parent a33d88aab3
commit 4a6a3699e7
7 changed files with 770 additions and 251 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using SabreTools.Library.Data;
using SabreTools.Library.DatFiles;
using SabreTools.Library.DatItems;
@@ -13,10 +14,12 @@ namespace SabreTools.Library.Filtering
/// TODO: Can clever use of Filtering allow for easier external splitting methods?
public class Filter
{
#region Pubically facing variables
#region Fields
#region Machine Filters
#region Common
/// <summary>
/// Include or exclude machine names
/// </summary>
@@ -67,10 +70,48 @@ namespace SabreTools.Library.Filtering
/// </summary>
public FilterItem<string> SampleOf { get; private set; } = new FilterItem<string>();
#endregion
#region AttractMode
/// <summary>
/// Include or exclude items with the "Supported" tag
/// Include or exclude machine players
/// </summary>
public FilterItem<bool?> Supported { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Players { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine rotation
/// </summary>
public FilterItem<string> Rotation { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine control
/// </summary>
public FilterItem<string> Control { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine support status
/// </summary>
public FilterItem<string> SupportStatus { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine display count
/// </summary>
public FilterItem<string> DisplayCount { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine display type
/// </summary>
public FilterItem<string> DisplayType { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine buttons
/// </summary>
public FilterItem<string> Buttons { get; private set; } = new FilterItem<string>();
#endregion
#region ListXML
/// <summary>
/// Include or exclude machine source file
@@ -82,16 +123,6 @@ namespace SabreTools.Library.Filtering
/// </summary>
public FilterItem<bool?> Runnable { get; private set; } = new FilterItem<bool?>() { Neutral = null };
/// <summary>
/// Include or exclude machine board
/// </summary>
public FilterItem<string> Board { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine rebuildto
/// </summary>
public FilterItem<string> RebuildTo { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine devices
/// </summary>
@@ -111,6 +142,31 @@ namespace SabreTools.Library.Filtering
#endregion
#region Logiqx
/// <summary>
/// Include or exclude machine board
/// </summary>
public FilterItem<string> Board { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude machine rebuildto
/// </summary>
public FilterItem<string> RebuildTo { get; private set; } = new FilterItem<string>();
#endregion
#region SoftwareList
/// <summary>
/// Include or exclude items with the "Supported" tag
/// </summary>
public FilterItem<bool?> Supported { get; private set; } = new FilterItem<bool?>() { Neutral = null };
#endregion
#endregion // Machine Filters
#region DatItem Filters
/// <summary>
@@ -300,7 +356,7 @@ namespace SabreTools.Library.Filtering
#endregion
#endregion // Pubically facing variables
#endregion // Fields
#region Instance methods
@@ -362,6 +418,8 @@ namespace SabreTools.Library.Filtering
{
#region Machine Filters
#region Common
case Field.MachineName:
if (negate)
MachineName.NegativeSet.Add(value);
@@ -432,13 +490,63 @@ namespace SabreTools.Library.Filtering
SampleOf.PositiveSet.Add(value);
break;
case Field.Supported:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Supported.Neutral = false;
#endregion
#region AttractMode
case Field.Players:
if (negate)
Players.NegativeSet.Add(value);
else
Supported.Neutral = true;
Players.PositiveSet.Add(value);
break;
case Field.Rotation:
if (negate)
Rotation.NegativeSet.Add(value);
else
Rotation.PositiveSet.Add(value);
break;
case Field.Control:
if (negate)
Control.NegativeSet.Add(value);
else
Control.PositiveSet.Add(value);
break;
case Field.SupportStatus:
if (negate)
SupportStatus.NegativeSet.Add(value);
else
SupportStatus.PositiveSet.Add(value);
break;
case Field.DisplayCount:
if (negate)
DisplayCount.NegativeSet.Add(value);
else
DisplayCount.PositiveSet.Add(value);
break;
case Field.DisplayType:
if (negate)
DisplayType.NegativeSet.Add(value);
else
DisplayType.PositiveSet.Add(value);
break;
case Field.Buttons:
if (negate)
Buttons.NegativeSet.Add(value);
else
Buttons.PositiveSet.Add(value);
break;
#endregion
#region ListXML
case Field.SourceFile:
if (negate)
SourceFile.NegativeSet.Add(value);
@@ -453,20 +561,6 @@ namespace SabreTools.Library.Filtering
Runnable.Neutral = true;
break;
case Field.Board:
if (negate)
Board.NegativeSet.Add(value);
else
Board.PositiveSet.Add(value);
break;
case Field.RebuildTo:
if (negate)
RebuildTo.NegativeSet.Add(value);
else
RebuildTo.PositiveSet.Add(value);
break;
case Field.Devices:
if (negate)
Devices.NegativeSet.Add(value);
@@ -490,6 +584,37 @@ namespace SabreTools.Library.Filtering
#endregion
#region Logiqx
case Field.Board:
if (negate)
Board.NegativeSet.Add(value);
else
Board.PositiveSet.Add(value);
break;
case Field.RebuildTo:
if (negate)
RebuildTo.NegativeSet.Add(value);
else
RebuildTo.PositiveSet.Add(value);
break;
#endregion
#region SoftwareList
case Field.Supported:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Supported.Neutral = false;
else
Supported.Neutral = true;
break;
#endregion
#endregion // Machine Filters
#region DatItem Filters
case Field.ItemType: