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;
|
break;
|
||||||
|
|
||||||
case "chip":
|
case "chip":
|
||||||
datItems.Add(new Chip
|
var chip = new Chip
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Tag = reader.GetAttribute("tag"),
|
Tag = reader.GetAttribute("tag"),
|
||||||
ChipType = reader.GetAttribute("type").AsChipType(),
|
ChipType = reader.GetAttribute("type").AsChipType(),
|
||||||
Clock = reader.GetAttribute("clock"),
|
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source
|
||||||
{
|
{
|
||||||
Index = indexId,
|
Index = indexId,
|
||||||
Name = filename,
|
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();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
@@ -1430,7 +1438,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||||
xtw.WriteOptionalAttributeString("type", chip.ChipType.FromChipType());
|
xtw.WriteOptionalAttributeString("type", chip.ChipType.FromChipType());
|
||||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
xtw.WriteOptionalAttributeString("clock", chip.Clock?.ToString());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Tag = reader.GetAttribute("tag"),
|
Tag = reader.GetAttribute("tag"),
|
||||||
ChipType = reader.GetAttribute("chiptype").AsChipType(),
|
ChipType = reader.GetAttribute("chiptype").AsChipType(),
|
||||||
Clock = reader.GetAttribute("clock"),
|
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source
|
||||||
{
|
{
|
||||||
@@ -408,6 +407,14 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Name = filename,
|
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;
|
break;
|
||||||
|
|
||||||
case "configuration":
|
case "configuration":
|
||||||
@@ -1254,7 +1261,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteRequiredAttributeString("name", chip.Name);
|
xtw.WriteRequiredAttributeString("name", chip.Name);
|
||||||
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
xtw.WriteOptionalAttributeString("tag", chip.Tag);
|
||||||
xtw.WriteOptionalAttributeString("chiptype", chip.ChipType.FromChipType());
|
xtw.WriteOptionalAttributeString("chiptype", chip.ChipType.FromChipType());
|
||||||
xtw.WriteOptionalAttributeString("clock", chip.Clock);
|
xtw.WriteOptionalAttributeString("clock", chip.Clock.ToString());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// Clock speed
|
/// Clock speed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("clock", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public string Clock { get; set; }
|
public long? Clock { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -75,7 +76,10 @@ namespace SabreTools.Library.DatItems
|
|||||||
ChipType = mappings[Field.DatItem_ChipType].AsChipType();
|
ChipType = mappings[Field.DatItem_ChipType].AsChipType();
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.DatItem_Clock))
|
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
|
#endregion
|
||||||
@@ -194,9 +198,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// DatItem_Clock
|
// DatItem_Clock
|
||||||
if (filter.DatItem_Clock.MatchesPositiveSet(Clock) == false)
|
if (filter.DatItem_Clock.MatchesPositive(null, Clock) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.DatItem_Clock.MatchesNegativeSet(Clock) == true)
|
if (filter.DatItem_Clock.MatchesNegative(null, Clock) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace SabreTools.Library.Filtering
|
|||||||
// Chip
|
// Chip
|
||||||
public FilterItem<string> DatItem_Tag { get; private set; } = new FilterItem<string>();
|
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<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
|
// Condition
|
||||||
public FilterItem<string> DatItem_Mask { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> DatItem_Mask { get; private set; } = new FilterItem<string>();
|
||||||
@@ -730,7 +730,7 @@ namespace SabreTools.Library.Filtering
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.DatItem_Clock:
|
case Field.DatItem_Clock:
|
||||||
SetStringFilter(DatItem_Clock, value, negate);
|
SetOptionalLongFilter(DatItem_Clock, value, negate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Condition
|
// Condition
|
||||||
|
|||||||
Reference in New Issue
Block a user