mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Convert subitems for Configuration and DipSwitch
This commit is contained in:
@@ -673,8 +673,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
if (filterRunner is not null && !filterRunner.Run(dipSwitch))
|
||||
continue;
|
||||
|
||||
var dipSwitchItem = new DipSwitch(dipSwitch, machine, source);
|
||||
dipSwitchItem.Write<Part?>(DipSwitch.PartKey, partItem);
|
||||
var dipSwitchItem = new DipSwitch(dipSwitch, machine, source) { Part = partItem };
|
||||
|
||||
AddItem(dipSwitchItem, statsOnly);
|
||||
// AddItemDB(dipSwitchItem, machineIndex, sourceIndex, statsOnly);
|
||||
@@ -691,7 +690,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
continue;
|
||||
|
||||
var partFeatureItem = new PartFeature(partFeature);
|
||||
partFeatureItem.Write<Part?>(DipSwitch.PartKey, partItem);
|
||||
partFeatureItem.Write<Part?>(PartFeature.PartKey, partItem);
|
||||
partFeatureItem.Source = source;
|
||||
partFeatureItem.CopyMachineInformation(machine);
|
||||
|
||||
|
||||
@@ -154,13 +154,8 @@ namespace SabreTools.Metadata.DatFiles
|
||||
AppendToMachineKey(machine, Data.Models.Metadata.Machine.DipSwitchKey, dipSwitchItem);
|
||||
|
||||
// Add Part mapping
|
||||
bool dipSwitchContainsPart = dipSwitchItem.ContainsKey(DatItems.Formats.DipSwitch.PartKey);
|
||||
if (dipSwitchContainsPart)
|
||||
{
|
||||
var partItem = dipSwitchItem.Read<DatItems.Formats.Part>(DatItems.Formats.DipSwitch.PartKey);
|
||||
if (partItem is not null)
|
||||
partMappings[partItem.GetInternalClone()] = dipSwitchItem;
|
||||
}
|
||||
if (dipSwitch.Part is not null)
|
||||
partMappings[dipSwitch.Part.GetInternalClone()] = dipSwitchItem;
|
||||
|
||||
break;
|
||||
case DatItems.Formats.Disk disk:
|
||||
@@ -580,13 +575,8 @@ namespace SabreTools.Metadata.DatFiles
|
||||
AppendToMachineKey(machine, Data.Models.Metadata.Machine.DipSwitchKey, dipSwitchItem);
|
||||
|
||||
// Add Part mapping
|
||||
bool dipSwitchContainsPart = dipSwitchItem.ContainsKey(DatItems.Formats.DipSwitch.PartKey);
|
||||
if (dipSwitchContainsPart)
|
||||
{
|
||||
var partItem = dipSwitchItem.Read<DatItems.Formats.Part>(DatItems.Formats.DipSwitch.PartKey);
|
||||
if (partItem is not null)
|
||||
partMappings[partItem.GetInternalClone()] = dipSwitchItem;
|
||||
}
|
||||
if (dipSwitch.Part is not null)
|
||||
partMappings[dipSwitch.Part.GetInternalClone()] = dipSwitchItem;
|
||||
|
||||
break;
|
||||
case DatItems.Formats.Disk disk:
|
||||
|
||||
@@ -114,9 +114,9 @@ namespace SabreTools.Metadata.DatFiles.Formats
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(dipSwitch.Read<Part?>(DipSwitch.PartKey)!.Name))
|
||||
if (string.IsNullOrEmpty(dipSwitch.Part!.Name))
|
||||
missingFields.Add(nameof(Data.Models.Metadata.Part.Name));
|
||||
if (string.IsNullOrEmpty(dipSwitch.Read<Part?>(DipSwitch.PartKey)!.Interface))
|
||||
if (string.IsNullOrEmpty(dipSwitch.Part!.Interface))
|
||||
missingFields.Add(nameof(Data.Models.Metadata.Part.Interface));
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ namespace SabreTools.Metadata.DatFiles.Formats
|
||||
missingFields.Add(nameof(Data.Models.Metadata.DipSwitch.Tag));
|
||||
if (string.IsNullOrEmpty(dipSwitch.Mask))
|
||||
missingFields.Add(nameof(Data.Models.Metadata.DipSwitch.Mask));
|
||||
if (dipSwitch.ValuesSpecified)
|
||||
if (dipSwitch.DipValueSpecified)
|
||||
{
|
||||
var dipValues = dipSwitch.Read<DipValue[]?>(Data.Models.Metadata.DipSwitch.DipValueKey);
|
||||
var dipValues = dipSwitch.DipValue;
|
||||
if (Array.Find(dipValues!, dv => string.IsNullOrEmpty(dv.Name)) is not null)
|
||||
missingFields.Add(nameof(Data.Models.Metadata.DipValue.Name));
|
||||
if (Array.Find(dipValues!, dv => string.IsNullOrEmpty(dv.Value)) is not null)
|
||||
|
||||
Reference in New Issue
Block a user