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]
|
[JsonIgnore]
|
||||||
public long ChipCount { get; private set; } = 0;
|
public long ChipCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Configuration items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long ConfigurationCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Device Reference items
|
/// Number of Device Reference items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -488,6 +494,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount++;
|
ChipCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Configuration:
|
||||||
|
ConfigurationCount++;
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
DeviceReferenceCount++;
|
DeviceReferenceCount++;
|
||||||
break;
|
break;
|
||||||
@@ -629,6 +638,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
ChipCount--;
|
ChipCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Configuration:
|
||||||
|
ConfigurationCount--;
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
DeviceReferenceCount--;
|
DeviceReferenceCount--;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -223,6 +223,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
datItem = datItemObj.ToObject<Chip>();
|
datItem = datItemObj.ToObject<Chip>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Configuration:
|
||||||
|
datItem = datItemObj.ToObject<Configuration>();
|
||||||
|
break;
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
datItem = datItemObj.ToObject<DeviceReference>();
|
datItem = datItemObj.ToObject<DeviceReference>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -888,6 +888,51 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
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:
|
case ItemType.DeviceReference:
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
xtw.WriteAttributeString("type", "device_ref");
|
xtw.WriteAttributeString("type", "device_ref");
|
||||||
|
|||||||
@@ -465,6 +465,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return new Chip();
|
return new Chip();
|
||||||
|
|
||||||
|
case ItemType.Configuration:
|
||||||
|
return new Configuration();
|
||||||
|
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
return new 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.DatFiles;
|
||||||
using SabreTools.Library.DatItems;
|
using SabreTools.Library.DatItems;
|
||||||
@@ -1602,6 +1601,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return ItemType.Blank;
|
return ItemType.Blank;
|
||||||
case "chip":
|
case "chip":
|
||||||
return ItemType.Chip;
|
return ItemType.Chip;
|
||||||
|
case "configuration":
|
||||||
|
return ItemType.Configuration;
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
return ItemType.DeviceReference;
|
return ItemType.DeviceReference;
|
||||||
case "disk":
|
case "disk":
|
||||||
@@ -1629,6 +1630,7 @@ namespace SabreTools.Library.Tools
|
|||||||
"biosset" => ItemType.BiosSet,
|
"biosset" => ItemType.BiosSet,
|
||||||
"blank" => ItemType.Blank,
|
"blank" => ItemType.Blank,
|
||||||
"chip" => ItemType.Chip,
|
"chip" => ItemType.Chip,
|
||||||
|
"configuration" => ItemType.Configuration,
|
||||||
"device_ref" => ItemType.DeviceReference,
|
"device_ref" => ItemType.DeviceReference,
|
||||||
"disk" => ItemType.Disk,
|
"disk" => ItemType.Disk,
|
||||||
"media" => ItemType.Media,
|
"media" => ItemType.Media,
|
||||||
@@ -2038,6 +2040,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return "blank";
|
return "blank";
|
||||||
case ItemType.Chip:
|
case ItemType.Chip:
|
||||||
return "chip";
|
return "chip";
|
||||||
|
case ItemType.Configuration:
|
||||||
|
return "configuration";
|
||||||
case ItemType.DeviceReference:
|
case ItemType.DeviceReference:
|
||||||
return "device_ref";
|
return "device_ref";
|
||||||
case ItemType.Disk:
|
case ItemType.Disk:
|
||||||
@@ -2065,6 +2069,7 @@ namespace SabreTools.Library.Tools
|
|||||||
ItemType.BiosSet => "biosset",
|
ItemType.BiosSet => "biosset",
|
||||||
ItemType.Blank => "blank",
|
ItemType.Blank => "blank",
|
||||||
ItemType.Chip => "chip",
|
ItemType.Chip => "chip",
|
||||||
|
ItemType.Configuration => "configuration",
|
||||||
ItemType.DeviceReference => "device_ref",
|
ItemType.DeviceReference => "device_ref",
|
||||||
ItemType.Disk => "disk",
|
ItemType.Disk => "disk",
|
||||||
ItemType.Media => "media",
|
ItemType.Media => "media",
|
||||||
|
|||||||
Reference in New Issue
Block a user