mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Display width and height to long?
This commit is contained in:
@@ -362,8 +362,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Tag = reader.GetAttribute("tag"),
|
Tag = reader.GetAttribute("tag"),
|
||||||
DisplayType = reader.GetAttribute("type").AsDisplayType(),
|
DisplayType = reader.GetAttribute("type").AsDisplayType(),
|
||||||
FlipX = reader.GetAttribute("flipx").AsYesNo(),
|
FlipX = reader.GetAttribute("flipx").AsYesNo(),
|
||||||
Width = reader.GetAttribute("width"),
|
|
||||||
Height = reader.GetAttribute("height"),
|
|
||||||
Refresh = reader.GetAttribute("refresh"),
|
Refresh = reader.GetAttribute("refresh"),
|
||||||
PixClock = reader.GetAttribute("pixclock"),
|
PixClock = reader.GetAttribute("pixclock"),
|
||||||
HTotal = reader.GetAttribute("htotal"),
|
HTotal = reader.GetAttribute("htotal"),
|
||||||
@@ -387,6 +385,20 @@ namespace SabreTools.Library.DatFiles
|
|||||||
display.Rotate = rotate;
|
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);
|
datItems.Add(display);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
@@ -1541,8 +1553,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
|
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
|
||||||
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
|
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
|
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
|
||||||
xtw.WriteOptionalAttributeString("width", display.Width);
|
xtw.WriteOptionalAttributeString("width", display.Width?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("height", display.Height);
|
xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
|
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
|
||||||
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
|
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
|
||||||
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
|
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
|
||||||
|
|||||||
@@ -1439,8 +1439,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
|
xtw.WriteOptionalAttributeString("type", display.DisplayType.FromDisplayType());
|
||||||
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
|
xtw.WriteOptionalAttributeString("rotate", display.Rotate?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
|
xtw.WriteOptionalAttributeString("flipx", display.FlipX.FromYesNo());
|
||||||
xtw.WriteOptionalAttributeString("width", display.Width);
|
xtw.WriteOptionalAttributeString("width", display.Width?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("height", display.Height);
|
xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
|
||||||
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
|
xtw.WriteOptionalAttributeString("refresh", display.Refresh);
|
||||||
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
|
xtw.WriteOptionalAttributeString("pixclock", display.PixClock);
|
||||||
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
|
xtw.WriteOptionalAttributeString("htotal", display.HTotal);
|
||||||
|
|||||||
@@ -46,19 +46,19 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// Display width
|
/// Display width
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Width { get; set; } // TODO: Int32?
|
public long? Width { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Display height
|
/// Display height
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("height", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Height { get; set; } // TODO: Int32?
|
public long? Height { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refresh rate
|
/// Refresh rate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("refresh", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Refresh { get; set; } // TODO: Int32? Float?
|
public string Refresh { get; set; } // TODO: Float?
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pixel clock timer
|
/// Pixel clock timer
|
||||||
@@ -132,10 +132,16 @@ namespace SabreTools.Library.DatItems
|
|||||||
FlipX = mappings[Field.DatItem_FlipX].AsYesNo();
|
FlipX = mappings[Field.DatItem_FlipX].AsYesNo();
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.DatItem_Width))
|
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))
|
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))
|
if (mappings.Keys.Contains(Field.DatItem_Refresh))
|
||||||
Refresh = mappings[Field.DatItem_Refresh];
|
Refresh = mappings[Field.DatItem_Refresh];
|
||||||
|
|||||||
@@ -199,8 +199,8 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<DisplayType> DatItem_DisplayType { get; private set; } = new FilterItem<DisplayType>() { Positive = DisplayType.NULL, Negative = DisplayType.NULL };
|
public FilterItem<DisplayType> DatItem_DisplayType { get; private set; } = new FilterItem<DisplayType>() { Positive = DisplayType.NULL, Negative = DisplayType.NULL };
|
||||||
public FilterItem<long?> DatItem_Rotate { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
public FilterItem<long?> DatItem_Rotate { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||||
public FilterItem<bool?> DatItem_FlipX { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_FlipX { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<string> DatItem_Width { get; private set; } = new FilterItem<string>();
|
public FilterItem<long?> DatItem_Width { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||||
public FilterItem<string> DatItem_Height { get; private set; } = new FilterItem<string>();
|
public FilterItem<long?> DatItem_Height { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||||
public FilterItem<string> DatItem_Refresh { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Refresh { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_PixClock { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_PixClock { get; private set; } = new FilterItem<string>();
|
||||||
public FilterItem<string> DatItem_HTotal { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_HTotal { get; private set; } = new FilterItem<string>();
|
||||||
@@ -847,11 +847,11 @@ namespace SabreTools.Library.Filtering
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Width:
|
case Field.DatItem_Width:
|
||||||
SetStringFilter(DatItem_Width, value, negate);
|
SetOptionalLongFilter(DatItem_Width, value, negate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Height:
|
case Field.DatItem_Height:
|
||||||
SetStringFilter(DatItem_Height, value, negate);
|
SetOptionalLongFilter(DatItem_Height, value, negate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Refresh:
|
case Field.DatItem_Refresh:
|
||||||
|
|||||||
Reference in New Issue
Block a user