All display blanking fields to long?

This commit is contained in:
Matt Nadareski
2020-09-04 10:57:30 -07:00
parent 319913a288
commit 762f8dda27
4 changed files with 108 additions and 54 deletions

View File

@@ -363,12 +363,6 @@ namespace SabreTools.Library.DatFiles
DisplayType = reader.GetAttribute("type").AsDisplayType(), DisplayType = reader.GetAttribute("type").AsDisplayType(),
FlipX = reader.GetAttribute("flipx").AsYesNo(), FlipX = reader.GetAttribute("flipx").AsYesNo(),
Refresh = reader.GetAttribute("refresh"), Refresh = reader.GetAttribute("refresh"),
HTotal = reader.GetAttribute("htotal"),
HBEnd = reader.GetAttribute("hbend"),
HBStart = reader.GetAttribute("hbstart"),
VTotal = reader.GetAttribute("vtotal"),
VBEnd = reader.GetAttribute("vbend"),
VBStart = reader.GetAttribute("vbstart"),
Source = new Source Source = new Source
{ {
@@ -405,6 +399,48 @@ namespace SabreTools.Library.DatFiles
display.PixClock = pixclock; display.PixClock = pixclock;
} }
// Set the htotal
if (reader.GetAttribute("htotal") != null)
{
if (Int64.TryParse(reader.GetAttribute("htotal"), out long htotal))
display.HTotal = htotal;
}
// Set the hbend
if (reader.GetAttribute("hbend") != null)
{
if (Int64.TryParse(reader.GetAttribute("hbend"), out long hbend))
display.HBEnd = hbend;
}
// Set the hbstart
if (reader.GetAttribute("hbstart") != null)
{
if (Int64.TryParse(reader.GetAttribute("hbstart"), out long hbstart))
display.HBStart = hbstart;
}
// Set the vtotal
if (reader.GetAttribute("vtotal") != null)
{
if (Int64.TryParse(reader.GetAttribute("vtotal"), out long vtotal))
display.VTotal = vtotal;
}
// Set the vbend
if (reader.GetAttribute("vbend") != null)
{
if (Int64.TryParse(reader.GetAttribute("vbend"), out long vbend))
display.VBEnd = vbend;
}
// Set the vbstart
if (reader.GetAttribute("vbstart") != null)
{
if (Int64.TryParse(reader.GetAttribute("vbstart"), out long vbstart))
display.VBStart = vbstart;
}
datItems.Add(display); datItems.Add(display);
reader.Read(); reader.Read();
@@ -1563,12 +1599,12 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("height", display.Height?.ToString()); xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
xtw.WriteOptionalAttributeString("refresh", display.Refresh); xtw.WriteOptionalAttributeString("refresh", display.Refresh);
xtw.WriteOptionalAttributeString("pixclock", display.PixClock?.ToString()); xtw.WriteOptionalAttributeString("pixclock", display.PixClock?.ToString());
xtw.WriteOptionalAttributeString("htotal", display.HTotal); xtw.WriteOptionalAttributeString("htotal", display.HTotal?.ToString());
xtw.WriteOptionalAttributeString("hbend", display.HBEnd); xtw.WriteOptionalAttributeString("hbend", display.HBEnd?.ToString());
xtw.WriteOptionalAttributeString("hstart", display.HBStart); xtw.WriteOptionalAttributeString("hstart", display.HBStart?.ToString());
xtw.WriteOptionalAttributeString("vtotal", display.VTotal); xtw.WriteOptionalAttributeString("vtotal", display.VTotal?.ToString());
xtw.WriteOptionalAttributeString("vbend", display.VBEnd); xtw.WriteOptionalAttributeString("vbend", display.VBEnd?.ToString());
xtw.WriteOptionalAttributeString("vbstart", display.VBStart); xtw.WriteOptionalAttributeString("vbstart", display.VBStart?.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
break; break;

View File

@@ -1443,12 +1443,12 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("height", display.Height?.ToString()); xtw.WriteOptionalAttributeString("height", display.Height?.ToString());
xtw.WriteOptionalAttributeString("refresh", display.Refresh); xtw.WriteOptionalAttributeString("refresh", display.Refresh);
xtw.WriteOptionalAttributeString("pixclock", display.PixClock?.ToString()); xtw.WriteOptionalAttributeString("pixclock", display.PixClock?.ToString());
xtw.WriteOptionalAttributeString("htotal", display.HTotal); xtw.WriteOptionalAttributeString("htotal", display.HTotal?.ToString());
xtw.WriteOptionalAttributeString("hbend", display.HBEnd); xtw.WriteOptionalAttributeString("hbend", display.HBEnd?.ToString());
xtw.WriteOptionalAttributeString("hstart", display.HBStart); xtw.WriteOptionalAttributeString("hstart", display.HBStart?.ToString());
xtw.WriteOptionalAttributeString("vtotal", display.VTotal); xtw.WriteOptionalAttributeString("vtotal", display.VTotal?.ToString());
xtw.WriteOptionalAttributeString("vbend", display.VBEnd); xtw.WriteOptionalAttributeString("vbend", display.VBEnd?.ToString());
xtw.WriteOptionalAttributeString("vbstart", display.VBStart); xtw.WriteOptionalAttributeString("vbstart", display.VBStart?.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
break; break;

View File

@@ -70,37 +70,37 @@ namespace SabreTools.Library.DatItems
/// Total horizontal lines /// Total horizontal lines
/// </summary> /// </summary>
[JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("htotal", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string HTotal { get; set; } // TODO: Int32? Float? public long? HTotal { get; set; }
/// <summary> /// <summary>
/// Horizontal blank end /// Horizontal blank end
/// </summary> /// </summary>
[JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("hbend", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string HBEnd { get; set; } // TODO: Int32? Float? public long? HBEnd { get; set; }
/// <summary> /// <summary>
/// Horizontal blank start /// Horizontal blank start
/// </summary> /// </summary>
[JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("hbstart", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string HBStart { get; set; } // TODO: Int32? Float? public long? HBStart { get; set; }
/// <summary> /// <summary>
/// Total vertical lines /// Total vertical lines
/// </summary> /// </summary>
[JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("vtotal", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string VTotal { get; set; } // TODO: Int32? Float? public long? VTotal { get; set; }
/// <summary> /// <summary>
/// Vertical blank end /// Vertical blank end
/// </summary> /// </summary>
[JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("vbend", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string VBEnd { get; set; } // TODO: Int32? Float? public long? VBEnd { get; set; }
/// <summary> /// <summary>
/// Vertical blank start /// Vertical blank start
/// </summary> /// </summary>
[JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("vbstart", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string VBStart { get; set; } // TODO: Int32? Float? public long? VBStart { get; set; }
#endregion #endregion
@@ -153,22 +153,40 @@ namespace SabreTools.Library.DatItems
} }
if (mappings.Keys.Contains(Field.DatItem_HTotal)) if (mappings.Keys.Contains(Field.DatItem_HTotal))
HTotal = mappings[Field.DatItem_HTotal]; {
if (Int64.TryParse(mappings[Field.DatItem_HTotal], out long hTotal))
HTotal = hTotal;
}
if (mappings.Keys.Contains(Field.DatItem_HBEnd)) if (mappings.Keys.Contains(Field.DatItem_HBEnd))
HBEnd = mappings[Field.DatItem_HBEnd]; {
if (Int64.TryParse(mappings[Field.DatItem_HBEnd], out long hbEnd))
HBEnd = hbEnd;
}
if (mappings.Keys.Contains(Field.DatItem_HBStart)) if (mappings.Keys.Contains(Field.DatItem_HBStart))
HBStart = mappings[Field.DatItem_HBStart]; {
if (Int64.TryParse(mappings[Field.DatItem_HBStart], out long hbStart))
HBStart = hbStart;
}
if (mappings.Keys.Contains(Field.DatItem_VTotal)) if (mappings.Keys.Contains(Field.DatItem_VTotal))
VTotal = mappings[Field.DatItem_VTotal]; {
if (Int64.TryParse(mappings[Field.DatItem_VTotal], out long vTotal))
VTotal = vTotal;
}
if (mappings.Keys.Contains(Field.DatItem_VBEnd)) if (mappings.Keys.Contains(Field.DatItem_VBEnd))
VBEnd = mappings[Field.DatItem_VBEnd]; {
if (Int64.TryParse(mappings[Field.DatItem_VBEnd], out long vbEnd))
VBEnd = vbEnd;
}
if (mappings.Keys.Contains(Field.DatItem_VBStart)) if (mappings.Keys.Contains(Field.DatItem_VBStart))
VBStart = mappings[Field.DatItem_VBStart]; {
if (Int64.TryParse(mappings[Field.DatItem_VBStart], out long vbStart))
VBStart = vbStart;
}
} }
#endregion #endregion
@@ -307,39 +325,39 @@ namespace SabreTools.Library.DatItems
return false; return false;
// Filter on htotal // Filter on htotal
if (filter.DatItem_HTotal.MatchesPositiveSet(HTotal) == false) if (filter.DatItem_HTotal.MatchesPositive(null, HTotal) == false)
return false; return false;
if (filter.DatItem_HTotal.MatchesNegativeSet(HTotal) == true) if (filter.DatItem_HTotal.MatchesNegative(null, HTotal) == true)
return false; return false;
// Filter on hbend // Filter on hbend
if (filter.DatItem_HBEnd.MatchesPositiveSet(HBEnd) == false) if (filter.DatItem_HBEnd.MatchesPositive(null, HBEnd) == false)
return false; return false;
if (filter.DatItem_HBEnd.MatchesNegativeSet(HBEnd) == true) if (filter.DatItem_HBEnd.MatchesNegative(null, HBEnd) == true)
return false; return false;
// Filter on hbstart // Filter on hbstart
if (filter.DatItem_HBStart.MatchesPositiveSet(HBStart) == false) if (filter.DatItem_HBStart.MatchesPositive(null, HBStart) == false)
return false; return false;
if (filter.DatItem_HBStart.MatchesNegativeSet(HBStart) == true) if (filter.DatItem_HBStart.MatchesNegative(null, HBStart) == true)
return false; return false;
// Filter on vtotal // Filter on vtotal
if (filter.DatItem_VTotal.MatchesPositiveSet(VTotal) == false) if (filter.DatItem_VTotal.MatchesPositive(null, VTotal) == false)
return false; return false;
if (filter.DatItem_VTotal.MatchesNegativeSet(VTotal) == true) if (filter.DatItem_VTotal.MatchesNegative(null, VTotal) == true)
return false; return false;
// Filter on vbend // Filter on vbend
if (filter.DatItem_VBEnd.MatchesPositiveSet(VBEnd) == false) if (filter.DatItem_VBEnd.MatchesPositive(null, VBEnd) == false)
return false; return false;
if (filter.DatItem_VBEnd.MatchesNegativeSet(VBEnd) == true) if (filter.DatItem_VBEnd.MatchesNegative(null, VBEnd) == true)
return false; return false;
// Filter on vbstart // Filter on vbstart
if (filter.DatItem_VBStart.MatchesPositiveSet(VBStart) == false) if (filter.DatItem_VBStart.MatchesPositive(null, VBStart) == false)
return false; return false;
if (filter.DatItem_VBStart.MatchesNegativeSet(VBStart) == true) if (filter.DatItem_VBStart.MatchesNegative(null, VBStart) == true)
return false; return false;
return true; return true;

View File

@@ -203,12 +203,12 @@ namespace SabreTools.Library.Filtering
public FilterItem<long?> DatItem_Height { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null }; 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<long?> DatItem_PixClock { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null }; public FilterItem<long?> DatItem_PixClock { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_HTotal { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_HTotal { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_HBEnd { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_HBEnd { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_HBStart { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_HBStart { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_VTotal { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_VTotal { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_VBEnd { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_VBEnd { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_VBStart { get; private set; } = new FilterItem<string>(); public FilterItem<long?> DatItem_VBStart { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
// Driver // Driver
public FilterItem<SupportStatus> DatItem_SupportStatus { get; private set; } = new FilterItem<SupportStatus>() { Positive = SupportStatus.NULL, Negative = SupportStatus.NULL }; public FilterItem<SupportStatus> DatItem_SupportStatus { get; private set; } = new FilterItem<SupportStatus>() { Positive = SupportStatus.NULL, Negative = SupportStatus.NULL };
@@ -863,27 +863,27 @@ namespace SabreTools.Library.Filtering
break; break;
case Field.DatItem_HTotal: case Field.DatItem_HTotal:
SetStringFilter(DatItem_HTotal, value, negate); SetOptionalLongFilter(DatItem_HTotal, value, negate);
break; break;
case Field.DatItem_HBEnd: case Field.DatItem_HBEnd:
SetStringFilter(DatItem_HBEnd, value, negate); SetOptionalLongFilter(DatItem_HBEnd, value, negate);
break; break;
case Field.DatItem_HBStart: case Field.DatItem_HBStart:
SetStringFilter(DatItem_HBStart, value, negate); SetOptionalLongFilter(DatItem_HBStart, value, negate);
break; break;
case Field.DatItem_VTotal: case Field.DatItem_VTotal:
SetStringFilter(DatItem_VTotal, value, negate); SetOptionalLongFilter(DatItem_VTotal, value, negate);
break; break;
case Field.DatItem_VBEnd: case Field.DatItem_VBEnd:
SetStringFilter(DatItem_VBEnd, value, negate); SetOptionalLongFilter(DatItem_VBEnd, value, negate);
break; break;
case Field.DatItem_VBStart: case Field.DatItem_VBStart:
SetStringFilter(DatItem_VBStart, value, negate); SetOptionalLongFilter(DatItem_VBStart, value, negate);
break; break;
// Driver // Driver