mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
DataArea width to long?
This commit is contained in:
@@ -255,11 +255,23 @@ namespace SabreTools.Library.DatFiles
|
||||
var dataArea = new DataArea
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Size = Sanitizer.CleanSize(reader.GetAttribute("size")),
|
||||
Width = reader.GetAttribute("width"),
|
||||
Endianness = reader.GetAttribute("endianness").AsEndianness(),
|
||||
};
|
||||
|
||||
// Set the size
|
||||
if (reader.GetAttribute("size") != null)
|
||||
{
|
||||
if (Int64.TryParse(reader.GetAttribute("width"), out long size))
|
||||
dataArea.Size = size;
|
||||
}
|
||||
|
||||
// Set the width
|
||||
if (reader.GetAttribute("width") != null)
|
||||
{
|
||||
if (Int64.TryParse(reader.GetAttribute("width"), out long width))
|
||||
dataArea.Width = width;
|
||||
}
|
||||
|
||||
List<DatItem> roms = ReadDataArea(reader.ReadSubtree(), dataArea);
|
||||
|
||||
// If we got valid roms, add them to the list
|
||||
@@ -771,7 +783,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("dataarea");
|
||||
xtw.WriteRequiredAttributeString("name", dataAreaName);
|
||||
xtw.WriteOptionalAttributeString("size", rom.DataArea?.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("width", rom.DataArea?.Width);
|
||||
xtw.WriteOptionalAttributeString("width", rom.DataArea?.Width?.ToString());
|
||||
xtw.WriteOptionalAttributeString("endianness", rom.DataArea?.Endianness.FromEndianness());
|
||||
|
||||
xtw.WriteStartElement("rom");
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Word width for the area
|
||||
/// </summary>
|
||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Width { get; set; } // TODO: (8|16|32|64) "8"
|
||||
public long? Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Byte endianness of the area
|
||||
|
||||
@@ -390,7 +390,8 @@ namespace SabreTools.Library.DatItems
|
||||
if (DataArea == null)
|
||||
DataArea = new DataArea();
|
||||
|
||||
DataArea.Width = mappings[Field.DatItem_AreaWidth];
|
||||
if (Int64.TryParse(mappings[Field.DatItem_AreaWidth], out long areaWidth))
|
||||
DataArea.Width = areaWidth;
|
||||
}
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_AreaEndianness))
|
||||
@@ -908,9 +909,9 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Filter on area byte width
|
||||
if (filter.DatItem_AreaWidth.MatchesPositiveSet(DataArea?.Width) == false)
|
||||
if (filter.DatItem_AreaWidth.MatchesPositive(null, DataArea?.Width) == false)
|
||||
return false;
|
||||
if (filter.DatItem_AreaWidth.MatchesNegativeSet(DataArea?.Width) == true)
|
||||
if (filter.DatItem_AreaWidth.MatchesNegative(null, DataArea?.Width) == true)
|
||||
return false;
|
||||
|
||||
// Filter on area endianness
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace SabreTools.Library.Filtering
|
||||
// Rom (SoftwareList)
|
||||
public FilterItem<string> DatItem_AreaName { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<long?> DatItem_AreaSize { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||
public FilterItem<string> DatItem_AreaWidth { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<long?> DatItem_AreaWidth { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||
public FilterItem<Endianness> DatItem_AreaEndianness { get; private set; } = new FilterItem<Endianness>() { Positive = Endianness.NULL, Negative = Endianness.NULL };
|
||||
public FilterItem<LoadFlag> DatItem_LoadFlag { get; private set; } = new FilterItem<LoadFlag>() { Positive = LoadFlag.NULL, Negative = LoadFlag.NULL };
|
||||
public FilterItem<string> DatItem_Part_Name { get; private set; } = new FilterItem<string>();
|
||||
@@ -652,7 +652,7 @@ namespace SabreTools.Library.Filtering
|
||||
break;
|
||||
|
||||
case Field.DatItem_AreaWidth:
|
||||
SetStringFilter(DatItem_AreaWidth, value, negate);
|
||||
SetOptionalLongFilter(DatItem_AreaWidth, value, negate);
|
||||
break;
|
||||
|
||||
case Field.DatItem_AreaEndianness:
|
||||
|
||||
Reference in New Issue
Block a user