mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add ControlType, fix a bunch of numerics
This commit is contained in:
@@ -76,10 +76,7 @@ namespace SabreTools.Library.DatItems
|
||||
ChipType = mappings[Field.DatItem_ChipType].AsChipType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Clock))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Clock], out long clock))
|
||||
Clock = clock;
|
||||
}
|
||||
Clock = Sanitizer.CleanLong(mappings[Field.DatItem_Clock]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -198,9 +195,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// DatItem_Clock
|
||||
if (filter.DatItem_Clock.MatchesPositive(null, Clock) == false)
|
||||
if (filter.DatItem_Clock.MatchesNeutral(null, Clock) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Clock.MatchesNegative(null, Clock) == true)
|
||||
else if (filter.DatItem_Clock.MatchesPositive(null, Clock) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Clock.MatchesNegative(null, Clock) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,56 +17,55 @@ namespace SabreTools.Library.DatItems
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Control type
|
||||
/// General type of input
|
||||
/// </summary>
|
||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string ControlType { get; set; }
|
||||
public ControlType ControlType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Player ID
|
||||
/// Player which the input belongs to
|
||||
/// </summary>
|
||||
[JsonProperty("player", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Player { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Button count
|
||||
/// Total number of buttons
|
||||
/// </summary>
|
||||
[JsonProperty("buttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Buttons { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Regular button count
|
||||
/// Total number of non-optional buttons
|
||||
/// </summary>
|
||||
/// <remarks>Couldn't find this used in newest ListXML</remarks>
|
||||
[JsonProperty("regbuttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RegButtons { get; set; } // TODO: Int32?
|
||||
[JsonProperty("reqbuttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? RequiredButtons { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minimum value
|
||||
/// Analog minimum value
|
||||
/// </summary>
|
||||
[JsonProperty("minimum", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Minimum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum value
|
||||
/// Analog maximum value
|
||||
/// </summary>
|
||||
[JsonProperty("maximum", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Maximum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sensitivity value
|
||||
/// Default analog sensitivity
|
||||
/// </summary>
|
||||
[JsonProperty("sensitivity", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Sensitivity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Keypress delta
|
||||
/// Default analog keydelta
|
||||
/// </summary>
|
||||
[JsonProperty("keydelta", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? KeyDelta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the control is reversed
|
||||
/// Default analog reverse setting
|
||||
/// </summary>
|
||||
[JsonProperty("reverse", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Reverse { get; set; }
|
||||
@@ -104,46 +103,28 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
// Handle Control-specific fields
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Type))
|
||||
ControlType = mappings[Field.DatItem_Control_Type];
|
||||
ControlType = mappings[Field.DatItem_Control_Type].AsControlType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Player))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_Player], out long player))
|
||||
Player = player;
|
||||
}
|
||||
Player = Sanitizer.CleanLong(mappings[Field.DatItem_Control_Player]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Buttons))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_Buttons], out long buttons))
|
||||
Buttons = buttons;
|
||||
}
|
||||
Buttons = Sanitizer.CleanLong(mappings[Field.DatItem_Control_Buttons]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_RegButtons))
|
||||
RegButtons = mappings[Field.DatItem_Control_RegButtons];
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_RequiredButtons))
|
||||
RequiredButtons = Sanitizer.CleanLong(mappings[Field.DatItem_Control_RequiredButtons]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Minimum))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_Minimum], out long minimum))
|
||||
Minimum = minimum;
|
||||
}
|
||||
Minimum = Sanitizer.CleanLong(mappings[Field.DatItem_Control_Minimum]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Maximum))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_Maximum], out long maximum))
|
||||
Maximum = maximum;
|
||||
}
|
||||
Maximum = Sanitizer.CleanLong(mappings[Field.DatItem_Control_Maximum]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Sensitivity))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_Sensitivity], out long sensitivity))
|
||||
Sensitivity = sensitivity;
|
||||
}
|
||||
Sensitivity = Sanitizer.CleanLong(mappings[Field.DatItem_Control_Sensitivity]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_KeyDelta))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Control_KeyDelta], out long keyDelta))
|
||||
KeyDelta = keyDelta;
|
||||
}
|
||||
KeyDelta = Sanitizer.CleanLong(mappings[Field.DatItem_Control_KeyDelta]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Control_Reverse))
|
||||
Reverse = mappings[Field.DatItem_Control_Reverse].AsYesNo();
|
||||
@@ -188,7 +169,7 @@ namespace SabreTools.Library.DatItems
|
||||
ControlType = this.ControlType,
|
||||
Player = this.Player,
|
||||
Buttons = this.Buttons,
|
||||
RegButtons = this.RegButtons,
|
||||
RequiredButtons = this.RequiredButtons,
|
||||
Minimum = this.Minimum,
|
||||
Maximum = this.Maximum,
|
||||
Sensitivity = this.Sensitivity,
|
||||
@@ -217,7 +198,7 @@ namespace SabreTools.Library.DatItems
|
||||
return (ControlType == newOther.ControlType
|
||||
&& Player == newOther.Player
|
||||
&& Buttons == newOther.Buttons
|
||||
&& RegButtons == newOther.RegButtons
|
||||
&& RequiredButtons == newOther.RequiredButtons
|
||||
&& Minimum == newOther.Minimum
|
||||
&& Maximum == newOther.Maximum
|
||||
&& Sensitivity == newOther.Sensitivity
|
||||
@@ -244,51 +225,65 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on control type
|
||||
if (filter.DatItem_Control_Type.MatchesPositiveSet(ControlType) == false)
|
||||
if (filter.DatItem_Control_Type.MatchesPositive(ControlType.NULL, ControlType) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Type.MatchesNegativeSet(ControlType) == true)
|
||||
if (filter.DatItem_Control_Type.MatchesNegative(ControlType.NULL, ControlType) == true)
|
||||
return false;
|
||||
|
||||
// Filter on display type
|
||||
if (filter.DatItem_Control_Player.MatchesPositive(null, Player) == false)
|
||||
// Filter on player
|
||||
if (filter.DatItem_Control_Player.MatchesNeutral(null, Player) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Player.MatchesNegative(null, Player) == true)
|
||||
else if (filter.DatItem_Control_Player.MatchesPositive(null, Player) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_Player.MatchesNegative(null, Player) == false)
|
||||
return false;
|
||||
|
||||
// Filter on buttons
|
||||
if (filter.DatItem_Control_Buttons.MatchesPositive(null, Buttons) == false)
|
||||
if (filter.DatItem_Control_Buttons.MatchesNeutral(null, Buttons) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Buttons.MatchesNegative(null, Buttons) == true)
|
||||
else if (filter.DatItem_Control_Buttons.MatchesPositive(null, Buttons) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_Buttons.MatchesNegative(null, Buttons) == false)
|
||||
return false;
|
||||
|
||||
// Filter on regbuttons
|
||||
if (filter.DatItem_Control_RegButtons.MatchesPositiveSet(RegButtons) == false)
|
||||
// Filter on reqbuttons
|
||||
if (filter.DatItem_Control_ReqButtons.MatchesNeutral(null, RequiredButtons) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_RegButtons.MatchesNegativeSet(RegButtons) == true)
|
||||
else if (filter.DatItem_Control_ReqButtons.MatchesPositive(null, RequiredButtons) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_ReqButtons.MatchesNegative(null, RequiredButtons) == false)
|
||||
return false;
|
||||
|
||||
// Filter on minimum
|
||||
if (filter.DatItem_Control_Minimum.MatchesPositive(null, Minimum) == false)
|
||||
if (filter.DatItem_Control_Minimum.MatchesNeutral(null, Minimum) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Minimum.MatchesNegative(null, Minimum) == true)
|
||||
else if (filter.DatItem_Control_Minimum.MatchesPositive(null, Minimum) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_Minimum.MatchesNegative(null, Minimum) == false)
|
||||
return false;
|
||||
|
||||
// Filter on maximum
|
||||
if (filter.DatItem_Control_Maximum.MatchesPositive(null, Maximum) == false)
|
||||
if (filter.DatItem_Control_Maximum.MatchesNeutral(null, Maximum) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Maximum.MatchesNegative(null, Maximum) == true)
|
||||
else if (filter.DatItem_Control_Maximum.MatchesPositive(null, Maximum) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_Maximum.MatchesNegative(null, Maximum) == false)
|
||||
return false;
|
||||
|
||||
// Filter on sensitivity
|
||||
if (filter.DatItem_Control_Sensitivity.MatchesPositive(null, Sensitivity) == false)
|
||||
if (filter.DatItem_Control_Sensitivity.MatchesNeutral(null, Sensitivity) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_Sensitivity.MatchesNegative(null, Sensitivity) == true)
|
||||
else if (filter.DatItem_Control_Sensitivity.MatchesPositive(null, Sensitivity) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_Sensitivity.MatchesNegative(null, Sensitivity) == false)
|
||||
return false;
|
||||
|
||||
// Filter on keydelta
|
||||
if (filter.DatItem_Control_KeyDelta.MatchesPositive(null, KeyDelta) == false)
|
||||
if (filter.DatItem_Control_KeyDelta.MatchesNeutral(null, KeyDelta) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Control_KeyDelta.MatchesNegative(null, KeyDelta) == true)
|
||||
else if (filter.DatItem_Control_KeyDelta.MatchesPositive(null, KeyDelta) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Control_KeyDelta.MatchesNegative(null, KeyDelta) == false)
|
||||
return false;
|
||||
|
||||
// Filter on reverse
|
||||
@@ -327,7 +322,7 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_Control_Type))
|
||||
ControlType = null;
|
||||
ControlType = ControlType.NULL;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Control_Player))
|
||||
Player = null;
|
||||
@@ -335,8 +330,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Control_Buttons))
|
||||
Buttons = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Control_RegButtons))
|
||||
RegButtons = null;
|
||||
if (fields.Contains(Field.DatItem_Control_RequiredButtons))
|
||||
RequiredButtons = null;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Control_Minimum))
|
||||
Minimum = null;
|
||||
@@ -394,8 +389,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.DatItem_Control_Buttons))
|
||||
Buttons = newItem.Buttons;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Control_RegButtons))
|
||||
RegButtons = newItem.RegButtons;
|
||||
if (fields.Contains(Field.DatItem_Control_RequiredButtons))
|
||||
RequiredButtons = newItem.RequiredButtons;
|
||||
|
||||
if (fields.Contains(Field.DatItem_Control_Minimum))
|
||||
Minimum = newItem.Minimum;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace SabreTools.Library.DatItems
|
||||
Field.DatItem_Control_Type,
|
||||
Field.DatItem_Control_Player,
|
||||
Field.DatItem_Control_Buttons,
|
||||
Field.DatItem_Control_RegButtons,
|
||||
Field.DatItem_Control_RequiredButtons,
|
||||
Field.DatItem_Control_Minimum,
|
||||
Field.DatItem_Control_Maximum,
|
||||
Field.DatItem_Control_Sensitivity,
|
||||
|
||||
@@ -69,16 +69,10 @@ namespace SabreTools.Library.DatItems
|
||||
Name = mappings[Field.DatItem_AreaName];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaSize))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_AreaSize], out long areaSize))
|
||||
Size = areaSize;
|
||||
}
|
||||
Size = Sanitizer.CleanLong(mappings[Field.DatItem_AreaSize]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaWidth))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_AreaWidth], out long areaWidth))
|
||||
Width = areaWidth;
|
||||
}
|
||||
Width = Sanitizer.CleanLong(mappings[Field.DatItem_AreaWidth]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaEndianness))
|
||||
Endianness = mappings[Field.DatItem_AreaEndianness].AsEndianness();
|
||||
@@ -196,9 +190,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on area byte width
|
||||
if (filter.DatItem_AreaWidth.MatchesPositive(null, Width) == false)
|
||||
if (filter.DatItem_AreaWidth.MatchesNeutral(null, Width) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaWidth.MatchesNegative(null, Width) == true)
|
||||
else if (filter.DatItem_AreaWidth.MatchesPositive(null, Width) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_AreaWidth.MatchesNegative(null, Width) == false)
|
||||
return false;
|
||||
|
||||
// Filter on area endianness
|
||||
|
||||
@@ -123,25 +123,16 @@ namespace SabreTools.Library.DatItems
|
||||
DisplayType = mappings[Field.DatItem_DisplayType].AsDisplayType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Rotate))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Rotate], out long rotate))
|
||||
Rotate = rotate;
|
||||
}
|
||||
Rotate = Sanitizer.CleanLong(mappings[Field.DatItem_Rotate]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_FlipX))
|
||||
FlipX = mappings[Field.DatItem_FlipX].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Width))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Width], out long width))
|
||||
Width = width;
|
||||
}
|
||||
Width = Sanitizer.CleanLong(mappings[Field.DatItem_Width]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Height))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Height], out long height))
|
||||
Height = height;
|
||||
}
|
||||
Height = Sanitizer.CleanLong(mappings[Field.DatItem_Height]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Refresh))
|
||||
{
|
||||
@@ -150,46 +141,25 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_PixClock))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_PixClock], out long pixClock))
|
||||
PixClock = pixClock;
|
||||
}
|
||||
PixClock = Sanitizer.CleanLong(mappings[Field.DatItem_PixClock]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_HTotal))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_HTotal], out long hTotal))
|
||||
HTotal = hTotal;
|
||||
}
|
||||
HTotal = Sanitizer.CleanLong(mappings[Field.DatItem_HTotal]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_HBEnd))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_HBEnd], out long hbEnd))
|
||||
HBEnd = hbEnd;
|
||||
}
|
||||
HBEnd = Sanitizer.CleanLong(mappings[Field.DatItem_HBEnd]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_HBStart))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_HBStart], out long hbStart))
|
||||
HBStart = hbStart;
|
||||
}
|
||||
HBStart = Sanitizer.CleanLong(mappings[Field.DatItem_HBStart]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_VTotal))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_VTotal], out long vTotal))
|
||||
VTotal = vTotal;
|
||||
}
|
||||
VTotal = Sanitizer.CleanLong(mappings[Field.DatItem_VTotal]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_VBEnd))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_VBEnd], out long vbEnd))
|
||||
VBEnd = vbEnd;
|
||||
}
|
||||
VBEnd = Sanitizer.CleanLong(mappings[Field.DatItem_VBEnd]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_VBStart))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_VBStart], out long vbStart))
|
||||
VBStart = vbStart;
|
||||
}
|
||||
VBStart = Sanitizer.CleanLong(mappings[Field.DatItem_VBStart]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -294,9 +264,11 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on rotation
|
||||
if (filter.DatItem_Rotate.MatchesPositive(null, Rotate) == false)
|
||||
if (filter.DatItem_Rotate.MatchesNeutral(null, Rotate) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Rotate.MatchesNegative(null, Rotate) == true)
|
||||
else if (filter.DatItem_Rotate.MatchesPositive(null, Rotate) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Rotate.MatchesNegative(null, Rotate) == false)
|
||||
return false;
|
||||
|
||||
// Filter on flipx
|
||||
@@ -304,63 +276,83 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on width
|
||||
if (filter.DatItem_Width.MatchesPositiveSet(Width) == false)
|
||||
if (filter.DatItem_Width.MatchesNeutral(null, Width) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Width.MatchesNegativeSet(Width) == true)
|
||||
else if (filter.DatItem_Width.MatchesPositive(null, Width) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Width.MatchesNegative(null, Width) == false)
|
||||
return false;
|
||||
|
||||
// Filter on height
|
||||
if (filter.DatItem_Height.MatchesPositiveSet(Height) == false)
|
||||
if (filter.DatItem_Height.MatchesNeutral(null, Height) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Height.MatchesNegativeSet(Height) == true)
|
||||
else if (filter.DatItem_Height.MatchesPositive(null, Height) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Height.MatchesNegative(null, Height) == false)
|
||||
return false;
|
||||
|
||||
// Filter on refresh
|
||||
if (filter.DatItem_Refresh.MatchesPositive(null, Refresh) == false)
|
||||
if (filter.DatItem_Refresh.MatchesNeutral(null, Refresh) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Refresh.MatchesNegative(null, Refresh) == true)
|
||||
else if (filter.DatItem_Refresh.MatchesPositive(null, Refresh) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_Refresh.MatchesNegative(null, Refresh) == false)
|
||||
return false;
|
||||
|
||||
// Filter on pixclock
|
||||
if (filter.DatItem_PixClock.MatchesPositive(null, PixClock) == false)
|
||||
if (filter.DatItem_PixClock.MatchesNeutral(null, PixClock) == false)
|
||||
return false;
|
||||
if (filter.DatItem_PixClock.MatchesNegative(null, PixClock) == true)
|
||||
else if (filter.DatItem_PixClock.MatchesPositive(null, PixClock) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_PixClock.MatchesNegative(null, PixClock) == false)
|
||||
return false;
|
||||
|
||||
// Filter on htotal
|
||||
if (filter.DatItem_HTotal.MatchesPositive(null, HTotal) == false)
|
||||
if (filter.DatItem_HTotal.MatchesNeutral(null, HTotal) == false)
|
||||
return false;
|
||||
if (filter.DatItem_HTotal.MatchesNegative(null, HTotal) == true)
|
||||
else if (filter.DatItem_HTotal.MatchesPositive(null, HTotal) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_HTotal.MatchesNegative(null, HTotal) == false)
|
||||
return false;
|
||||
|
||||
// Filter on hbend
|
||||
if (filter.DatItem_HBEnd.MatchesPositive(null, HBEnd) == false)
|
||||
if (filter.DatItem_HBEnd.MatchesNeutral(null, HBEnd) == false)
|
||||
return false;
|
||||
if (filter.DatItem_HBEnd.MatchesNegative(null, HBEnd) == true)
|
||||
else if (filter.DatItem_HBEnd.MatchesPositive(null, HBEnd) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_HBEnd.MatchesNegative(null, HBEnd) == false)
|
||||
return false;
|
||||
|
||||
// Filter on hbstart
|
||||
if (filter.DatItem_HBStart.MatchesPositive(null, HBStart) == false)
|
||||
if (filter.DatItem_HBStart.MatchesNeutral(null, HBStart) == false)
|
||||
return false;
|
||||
if (filter.DatItem_HBStart.MatchesNegative(null, HBStart) == true)
|
||||
else if (filter.DatItem_HBStart.MatchesPositive(null, HBStart) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_HBStart.MatchesNegative(null, HBStart) == false)
|
||||
return false;
|
||||
|
||||
// Filter on vtotal
|
||||
if (filter.DatItem_VTotal.MatchesPositive(null, VTotal) == false)
|
||||
if (filter.DatItem_VTotal.MatchesNeutral(null, VTotal) == false)
|
||||
return false;
|
||||
if (filter.DatItem_VTotal.MatchesNegative(null, VTotal) == true)
|
||||
else if (filter.DatItem_VTotal.MatchesPositive(null, VTotal) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_VTotal.MatchesNegative(null, VTotal) == false)
|
||||
return false;
|
||||
|
||||
// Filter on vbend
|
||||
if (filter.DatItem_VBEnd.MatchesPositive(null, VBEnd) == false)
|
||||
if (filter.DatItem_VBEnd.MatchesNeutral(null, VBEnd) == false)
|
||||
return false;
|
||||
if (filter.DatItem_VBEnd.MatchesNegative(null, VBEnd) == true)
|
||||
else if (filter.DatItem_VBEnd.MatchesPositive(null, VBEnd) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_VBEnd.MatchesNegative(null, VBEnd) == false)
|
||||
return false;
|
||||
|
||||
// Filter on vbstart
|
||||
if (filter.DatItem_VBStart.MatchesPositive(null, VBStart) == false)
|
||||
if (filter.DatItem_VBStart.MatchesNeutral(null, VBStart) == false)
|
||||
return false;
|
||||
if (filter.DatItem_VBStart.MatchesNegative(null, VBStart) == true)
|
||||
else if (filter.DatItem_VBStart.MatchesPositive(null, VBStart) == false)
|
||||
return false;
|
||||
else if (filter.DatItem_VBStart.MatchesNegative(null, VBStart) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,34 @@ namespace SabreTools.Library.DatItems
|
||||
Audio = 1 << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the control type
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ControlType
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
|
||||
Joy = 1 << 0,
|
||||
Stick = 1 << 1,
|
||||
Paddle = 1 << 2,
|
||||
Pedal = 1 << 3,
|
||||
Lightgun = 1 << 4,
|
||||
Positional = 1 << 5,
|
||||
Dial = 1 << 6,
|
||||
Trackball = 1 << 7,
|
||||
Mouse = 1 << 8,
|
||||
OnlyButtons = 1 << 9,
|
||||
Keypad = 1 << 10,
|
||||
Keyboard = 1 << 11,
|
||||
Mahjong = 1 << 12,
|
||||
Hanafuda = 1 << 13,
|
||||
Gambling = 1 << 14,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the display type
|
||||
/// </summary>
|
||||
@@ -338,7 +366,7 @@ namespace SabreTools.Library.DatItems
|
||||
DatItem_Control_Type,
|
||||
DatItem_Control_Player,
|
||||
DatItem_Control_Buttons,
|
||||
DatItem_Control_RegButtons,
|
||||
DatItem_Control_RequiredButtons,
|
||||
DatItem_Control_Minimum,
|
||||
DatItem_Control_Maximum,
|
||||
DatItem_Control_Sensitivity,
|
||||
|
||||
@@ -67,16 +67,10 @@ namespace SabreTools.Library.DatItems
|
||||
Tilt = mappings[Field.DatItem_Tilt].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Players))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Players], out long players))
|
||||
Players = players;
|
||||
}
|
||||
Players = Sanitizer.CleanLong(mappings[Field.DatItem_Players]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Coins))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Coins], out long coins))
|
||||
Coins = coins;
|
||||
}
|
||||
Coins = Sanitizer.CleanLong(mappings[Field.DatItem_Coins]);
|
||||
|
||||
if (Controls != null)
|
||||
{
|
||||
|
||||
@@ -297,10 +297,7 @@ namespace SabreTools.Library.DatItems
|
||||
Bios = mappings[Field.DatItem_Bios];
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Size))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Size], out long size))
|
||||
Size = size;
|
||||
}
|
||||
Size = Sanitizer.CleanLong(mappings[Field.DatItem_Size]);
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_CRC))
|
||||
CRC = mappings[Field.DatItem_CRC];
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using SabreTools.Library.Tools;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
@@ -16,7 +17,7 @@ namespace SabreTools.Library.DatItems
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Number of channels
|
||||
/// Number of speakers or channels
|
||||
/// </summary>
|
||||
[JsonProperty("channels", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? Channels { get; set; }
|
||||
@@ -36,10 +37,7 @@ namespace SabreTools.Library.DatItems
|
||||
|
||||
// Handle Sound-specific fields
|
||||
if (mappings.Keys.Contains(Field.DatItem_Channels))
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Channels], out long channels))
|
||||
Channels = channels;
|
||||
}
|
||||
Channels = Sanitizer.CleanLong(mappings[Field.DatItem_Channels]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user