diff --git a/SabreTools.Library/DatFiles/Listxml.cs b/SabreTools.Library/DatFiles/Listxml.cs
index 07ea5852..8914bac3 100644
--- a/SabreTools.Library/DatFiles/Listxml.cs
+++ b/SabreTools.Library/DatFiles/Listxml.cs
@@ -362,8 +362,6 @@ namespace SabreTools.Library.DatFiles
Tag = reader.GetAttribute("tag"),
DisplayType = reader.GetAttribute("type").AsDisplayType(),
FlipX = reader.GetAttribute("flipx").AsYesNo(),
- Width = reader.GetAttribute("width"),
- Height = reader.GetAttribute("height"),
Refresh = reader.GetAttribute("refresh"),
PixClock = reader.GetAttribute("pixclock"),
HTotal = reader.GetAttribute("htotal"),
@@ -387,6 +385,20 @@ namespace SabreTools.Library.DatFiles
display.Rotate = rotate;
}
+ // Set the width
+ if (reader.GetAttribute("width") != null)
+ {
+ if (Int64.TryParse(reader.GetAttribute("width"), out long width))
+ display.Width = width;
+ }
+
+ // Set the height
+ if (reader.GetAttribute("height") != null)
+ {
+ if (Int64.TryParse(reader.GetAttribute("height"), out long height))
+ display.Height = height;
+ }
+
datItems.Add(display);
reader.Read();
@@ -1541,8 +1553,8 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
- xtw.WriteOptionalAttributeString("width", display.Width);
- xtw.WriteOptionalAttributeString("height", display.Height);
+ xtw.WriteOptionalAttributeString("width", display.Width?.ToString());
+ xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
diff --git a/SabreTools.Library/DatFiles/SabreDat.cs b/SabreTools.Library/DatFiles/SabreDat.cs
index fea881bb..dfa2eabc 100644
--- a/SabreTools.Library/DatFiles/SabreDat.cs
+++ b/SabreTools.Library/DatFiles/SabreDat.cs
@@ -1439,8 +1439,8 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
- xtw.WriteOptionalAttributeString("width", display.Width);
- xtw.WriteOptionalAttributeString("height", display.Height);
+ xtw.WriteOptionalAttributeString("width", display.Width?.ToString());
+ xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
diff --git a/SabreTools.Library/DatItems/Display.cs b/SabreTools.Library/DatItems/Display.cs
index 1494bed1..c86736e6 100644
--- a/SabreTools.Library/DatItems/Display.cs
+++ b/SabreTools.Library/DatItems/Display.cs
@@ -46,19 +46,19 @@ namespace SabreTools.Library.DatItems
/// Display width
///
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
- public string Width { get; set; } // TODO: Int32?
+ public long? Width { get; set; }
///
/// Display height
///
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore)]
- public string Height { get; set; } // TODO: Int32?
+ public long? Height { get; set; }
///
/// Refresh rate
///
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore)]
- public string Refresh { get; set; } // TODO: Int32? Float?
+ public string Refresh { get; set; } // TODO: Float?
///
/// Pixel clock timer
@@ -132,10 +132,16 @@ namespace SabreTools.Library.DatItems
FlipX = mappings[Field.DatItem_FlipX].AsYesNo();
if (mappings.Keys.Contains(Field.DatItem_Width))
- Width = mappings[Field.DatItem_Width];
+ {
+ if (Int64.TryParse(mappings[Field.DatItem_Width], out long width))
+ Width = width;
+ }
if (mappings.Keys.Contains(Field.DatItem_Height))
- Height = mappings[Field.DatItem_Height];
+ {
+ if (Int64.TryParse(mappings[Field.DatItem_Height], out long height))
+ Height = height;
+ }
if (mappings.Keys.Contains(Field.DatItem_Refresh))
Refresh = mappings[Field.DatItem_Refresh];
diff --git a/SabreTools.Library/Filtering/Filter.cs b/SabreTools.Library/Filtering/Filter.cs
index ddfdb656..b05adb77 100644
--- a/SabreTools.Library/Filtering/Filter.cs
+++ b/SabreTools.Library/Filtering/Filter.cs
@@ -199,8 +199,8 @@ namespace SabreTools.Library.Filtering
public FilterItem DatItem_DisplayType { get; private set; } = new FilterItem() { Positive = DisplayType.NULL, Negative = DisplayType.NULL };
public FilterItem DatItem_Rotate { get; private set; } = new FilterItem() { Positive = null, Negative = null, Neutral = null };
public FilterItem DatItem_FlipX { get; private set; } = new FilterItem() { Neutral = null };
- public FilterItem DatItem_Width { get; private set; } = new FilterItem();
- public FilterItem DatItem_Height { get; private set; } = new FilterItem();
+ public FilterItem DatItem_Width { get; private set; } = new FilterItem() { Positive = null, Negative = null, Neutral = null };
+ public FilterItem DatItem_Height { get; private set; } = new FilterItem() { Positive = null, Negative = null, Neutral = null };
public FilterItem DatItem_Refresh { get; private set; } = new FilterItem();
public FilterItem DatItem_PixClock { get; private set; } = new FilterItem();
public FilterItem DatItem_HTotal { get; private set; } = new FilterItem();
@@ -847,11 +847,11 @@ namespace SabreTools.Library.Filtering
break;
case Field.DatItem_Width:
- SetStringFilter(DatItem_Width, value, negate);
+ SetOptionalLongFilter(DatItem_Width, value, negate);
break;
case Field.DatItem_Height:
- SetStringFilter(DatItem_Height, value, negate);
+ SetOptionalLongFilter(DatItem_Height, value, negate);
break;
case Field.DatItem_Refresh: