Change display rotation to long?

This commit is contained in:
Matt Nadareski
2020-09-04 10:28:25 -07:00
parent b7dbe728a3
commit 7f8766b0a4
7 changed files with 46 additions and 30 deletions

View File

@@ -35,8 +35,9 @@ namespace SabreTools.Library.DatItems
/// <summary>
/// Determines if the devices is mandatory
/// </summary>
/// <remarks>Only value used seems to be 1. Used like bool, but actually int</remarks>
[JsonProperty("mandatory", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Mandatory { get; set; } // TODO: bool?
public string Mandatory { get; set; } // TODO: long?
/// <summary>
/// Device interface

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using SabreTools.Library.Filtering;
@@ -33,7 +34,7 @@ namespace SabreTools.Library.DatItems
/// Display rotation
/// </summary>
[JsonProperty("rotate", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Rotate { get; set; } // TODO: (0|90|180|270) Int32?
public long? Rotate { get; set; }
/// <summary>
/// Determines if display is flipped in the X-coordinates
@@ -122,7 +123,10 @@ namespace SabreTools.Library.DatItems
DisplayType = mappings[Field.DatItem_DisplayType].AsDisplayType();
if (mappings.Keys.Contains(Field.DatItem_Rotate))
Rotate = mappings[Field.DatItem_Rotate];
{
if (Int64.TryParse(mappings[Field.DatItem_Rotate], out long rotate))
Rotate = rotate;
}
if (mappings.Keys.Contains(Field.DatItem_FlipX))
FlipX = mappings[Field.DatItem_FlipX].AsYesNo();
@@ -260,9 +264,9 @@ namespace SabreTools.Library.DatItems
return false;
// Filter on rotation
if (filter.DatItem_Rotate.MatchesPositiveSet(Rotate) == false)
if (filter.DatItem_Rotate.MatchesPositive(null, Rotate) == false)
return false;
if (filter.DatItem_Rotate.MatchesNegativeSet(Rotate) == true)
if (filter.DatItem_Rotate.MatchesNegative(null, Rotate) == true)
return false;
// Filter on flipx

View File

@@ -51,6 +51,7 @@ namespace SabreTools.Library.DatItems
/// <summary>
/// Byte size of the rom
/// </summary>
/// TODO: Can this be made optional instead of concrete long? Use `null` instead of `-1`?
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore)]
public long Size { get; set; }