mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix stats/creation for Configuration
This commit is contained in:
@@ -101,6 +101,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long ChipCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Configuration items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long ConfigurationCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Device Reference items
|
||||
/// </summary>
|
||||
@@ -488,6 +494,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Chip:
|
||||
ChipCount++;
|
||||
break;
|
||||
case ItemType.Configuration:
|
||||
ConfigurationCount++;
|
||||
break;
|
||||
case ItemType.DeviceReference:
|
||||
DeviceReferenceCount++;
|
||||
break;
|
||||
@@ -629,6 +638,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Chip:
|
||||
ChipCount--;
|
||||
break;
|
||||
case ItemType.Configuration:
|
||||
ConfigurationCount--;
|
||||
break;
|
||||
case ItemType.DeviceReference:
|
||||
DeviceReferenceCount--;
|
||||
break;
|
||||
|
||||
@@ -223,6 +223,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Chip:
|
||||
datItem = datItemObj.ToObject<Chip>();
|
||||
break;
|
||||
case ItemType.Configuration:
|
||||
datItem = datItemObj.ToObject<Configuration>();
|
||||
break;
|
||||
case ItemType.DeviceReference:
|
||||
datItem = datItemObj.ToObject<DeviceReference>();
|
||||
break;
|
||||
|
||||
@@ -888,6 +888,51 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Configuration:
|
||||
var configuration = datItem as Configuration;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "configuration");
|
||||
xtw.WriteOptionalAttributeString("name", configuration.Name);
|
||||
xtw.WriteOptionalAttributeString("tag", configuration.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", configuration.Mask);
|
||||
|
||||
if (configuration.Conditions != null)
|
||||
{
|
||||
foreach (var condition in configuration.Conditions)
|
||||
{
|
||||
xtw.WriteStartElement("condition");
|
||||
xtw.WriteOptionalAttributeString("tag", condition.Tag);
|
||||
xtw.WriteOptionalAttributeString("mask", condition.Mask);
|
||||
xtw.WriteOptionalAttributeString("relation", condition.Relation);
|
||||
xtw.WriteOptionalAttributeString("value", condition.Value);
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (configuration.Locations != null)
|
||||
{
|
||||
foreach (var location in configuration.Locations)
|
||||
{
|
||||
xtw.WriteStartElement("conflocation");
|
||||
xtw.WriteOptionalAttributeString("name", location.Name);
|
||||
xtw.WriteOptionalAttributeString("number", location.Number);
|
||||
xtw.WriteOptionalAttributeString("inverted", location.Inverted.FromYesNo());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (configuration.Settings != null)
|
||||
{
|
||||
foreach (var setting in configuration.Settings)
|
||||
{
|
||||
xtw.WriteStartElement("confsetting");
|
||||
xtw.WriteOptionalAttributeString("name", setting.Name);
|
||||
xtw.WriteOptionalAttributeString("value", setting.Value);
|
||||
xtw.WriteOptionalAttributeString("default", setting.Default.FromYesNo());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.DeviceReference:
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "device_ref");
|
||||
|
||||
@@ -465,6 +465,9 @@ namespace SabreTools.Library.DatItems
|
||||
case ItemType.Chip:
|
||||
return new Chip();
|
||||
|
||||
case ItemType.Configuration:
|
||||
return new Configuration();
|
||||
|
||||
case ItemType.DeviceReference:
|
||||
return new DeviceReference();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using SabreTools.Library.DatFiles;
|
||||
using SabreTools.Library.DatItems;
|
||||
@@ -1602,6 +1601,8 @@ namespace SabreTools.Library.Tools
|
||||
return ItemType.Blank;
|
||||
case "chip":
|
||||
return ItemType.Chip;
|
||||
case "configuration":
|
||||
return ItemType.Configuration;
|
||||
case "device_ref":
|
||||
return ItemType.DeviceReference;
|
||||
case "disk":
|
||||
@@ -1629,6 +1630,7 @@ namespace SabreTools.Library.Tools
|
||||
"biosset" => ItemType.BiosSet,
|
||||
"blank" => ItemType.Blank,
|
||||
"chip" => ItemType.Chip,
|
||||
"configuration" => ItemType.Configuration,
|
||||
"device_ref" => ItemType.DeviceReference,
|
||||
"disk" => ItemType.Disk,
|
||||
"media" => ItemType.Media,
|
||||
@@ -2038,6 +2040,8 @@ namespace SabreTools.Library.Tools
|
||||
return "blank";
|
||||
case ItemType.Chip:
|
||||
return "chip";
|
||||
case ItemType.Configuration:
|
||||
return "configuration";
|
||||
case ItemType.DeviceReference:
|
||||
return "device_ref";
|
||||
case ItemType.Disk:
|
||||
@@ -2065,6 +2069,7 @@ namespace SabreTools.Library.Tools
|
||||
ItemType.BiosSet => "biosset",
|
||||
ItemType.Blank => "blank",
|
||||
ItemType.Chip => "chip",
|
||||
ItemType.Configuration => "configuration",
|
||||
ItemType.DeviceReference => "device_ref",
|
||||
ItemType.Disk => "disk",
|
||||
ItemType.Media => "media",
|
||||
|
||||
Reference in New Issue
Block a user