mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Chip clock to long?
This commit is contained in:
@@ -207,19 +207,27 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "chip":
|
||||
datItems.Add(new Chip
|
||||
var chip = new Chip
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
ChipType = reader.GetAttribute("type").AsChipType(),
|
||||
Clock = reader.GetAttribute("clock"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// Set the clock
|
||||
if (reader.GetAttribute("clock") != null)
|
||||
{
|
||||
if (Int64.TryParse(reader.GetAttribute("clock"), out long clock))
|
||||
chip.Clock = clock;
|
||||
}
|
||||
|
||||
datItems.Add(chip);
|
||||
|
||||
reader.Read();
|
||||
break;
|
||||
@@ -1430,7 +1438,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||
xtw.WriteOptionalAttributeString("type", chip.ChipType.FromChipType());
|
||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
||||
xtw.WriteOptionalAttributeString("clock", chip.Clock?.ToString());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
|
||||
@@ -400,7 +400,6 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
ChipType = reader.GetAttribute("chiptype").AsChipType(),
|
||||
Clock = reader.GetAttribute("clock"),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
@@ -408,6 +407,14 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = filename,
|
||||
},
|
||||
};
|
||||
|
||||
// Set the clock
|
||||
if (reader.GetAttribute("clock") != null)
|
||||
{
|
||||
if (Int64.TryParse(reader.GetAttribute("clock"), out long clock))
|
||||
(datItem as Chip).Clock = clock;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "configuration":
|
||||
@@ -1254,7 +1261,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||
xtw.WriteOptionalAttributeString("chiptype", chip.ChipType.FromChipType());
|
||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
||||
xtw.WriteOptionalAttributeString("clock", chip.Clock.ToString());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@@ -40,7 +41,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Clock speed
|
||||
/// </summary>
|
||||
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Clock { get; set; }
|
||||
public long? Clock { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -75,7 +76,10 @@ namespace SabreTools.Library.DatItems
|
||||
ChipType = mappings[Field.DatItem_ChipType].AsChipType();
|
||||
|
||||
if (mappings.Keys.Contains(Field.DatItem_Clock))
|
||||
Clock = mappings[Field.DatItem_Clock];
|
||||
{
|
||||
if (Int64.TryParse(mappings[Field.DatItem_Clock], out long clock))
|
||||
Clock = clock;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -194,9 +198,9 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// DatItem_Clock
|
||||
if (filter.DatItem_Clock.MatchesPositiveSet(Clock) == false)
|
||||
if (filter.DatItem_Clock.MatchesPositive(null, Clock) == false)
|
||||
return false;
|
||||
if (filter.DatItem_Clock.MatchesNegativeSet(Clock) == true)
|
||||
if (filter.DatItem_Clock.MatchesNegative(null, Clock) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace SabreTools.Library.Filtering
|
||||
// Chip
|
||||
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<ChipType> DatItem_ChipType { get; private set; } = new FilterItem<ChipType>() { Positive = ChipType.NULL, Negative = ChipType.NULL };
|
||||
public FilterItem<string> DatItem_Clock { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<long?> DatItem_Clock { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
|
||||
|
||||
// Condition
|
||||
public FilterItem<string> DatItem_Mask { get; private set; } = new FilterItem<string>();
|
||||
@@ -730,7 +730,7 @@ namespace SabreTools.Library.Filtering
|
||||
break;
|
||||
|
||||
case Field.DatItem_Clock:
|
||||
SetStringFilter(DatItem_Clock, value, negate);
|
||||
SetOptionalLongFilter(DatItem_Clock, value, negate);
|
||||
break;
|
||||
|
||||
// Condition
|
||||
|
||||
Reference in New Issue
Block a user