mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Use DictionaryBase for setters
This commit is contained in:
@@ -221,44 +221,28 @@ namespace SabreTools.DatFiles
|
||||
#endregion
|
||||
|
||||
#region Item-Specific
|
||||
|
||||
// Handle unnested sets first
|
||||
foreach (var kvp in DatItemMappings)
|
||||
{
|
||||
datItem.SetField(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
// Handle nested sets
|
||||
switch (datItem)
|
||||
{
|
||||
case Adjuster adjuster: SetFields(adjuster); break;
|
||||
case Analog analog: SetFields(analog); break;
|
||||
case Archive archive: SetFields(archive); break;
|
||||
case BiosSet biosSet: SetFields(biosSet); break;
|
||||
case Chip chip: SetFields(chip); break;
|
||||
case Condition condition: SetFields(condition); break;
|
||||
case Configuration condition: SetFields(condition); break;
|
||||
case ConfLocation confLocation: SetFields(confLocation); break;
|
||||
case ConfSetting confSetting: SetFields(confSetting); break;
|
||||
case Control control: SetFields(control); break;
|
||||
case DataArea dataArea: SetFields(dataArea); break;
|
||||
case Device device: SetFields(device); break;
|
||||
case DipLocation dipLocation: SetFields(dipLocation); break;
|
||||
case DipSwitch dipSwitch: SetFields(dipSwitch); break;
|
||||
case DipValue dipValue: SetFields(dipValue); break;
|
||||
case Disk disk: SetFields(disk); break;
|
||||
case DiskArea diskArea: SetFields(diskArea); break;
|
||||
case Display display: SetFields(display); break;
|
||||
case Driver driver: SetFields(driver); break;
|
||||
case Extension extension: SetFields(extension); break;
|
||||
case Feature feature: SetFields(feature); break;
|
||||
case Input input: SetFields(input); break;
|
||||
case Instance instance: SetFields(instance); break;
|
||||
case Media media: SetFields(media); break;
|
||||
case Part part: SetFields(part); break;
|
||||
case PartFeature partFeature: SetFields(partFeature); break;
|
||||
case Port port: SetFields(port); break;
|
||||
case RamOption ramOption: SetFields(ramOption); break;
|
||||
case Release release: SetFields(release); break;
|
||||
case Rom rom: SetFields(rom); break;
|
||||
case SharedFeature sharedFeat: SetFields(sharedFeat); break;
|
||||
case Slot slot: SetFields(slot); break;
|
||||
case SlotOption slotOption: SetFields(slotOption); break;
|
||||
case SoftwareList softwareList: SetFields(softwareList); break;
|
||||
case Sound sound: SetFields(sound); break;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -268,124 +252,15 @@ namespace SabreTools.DatFiles
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="machine">Machine to set fields on</param>
|
||||
public void SetFields(Machine machine)
|
||||
public void SetFields(Machine? machine)
|
||||
{
|
||||
if (machine == null || MachineMappings == null)
|
||||
return;
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Board))
|
||||
machine.Board = MachineMappings[MachineField.Board];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Buttons))
|
||||
machine.Buttons = MachineMappings[MachineField.Buttons];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Category))
|
||||
machine.Category = MachineMappings[MachineField.Category];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.CloneOf))
|
||||
machine.CloneOf = MachineMappings[MachineField.CloneOf];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.CloneOfID))
|
||||
machine.NoIntroCloneOfId = MachineMappings[MachineField.CloneOfID];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Comment))
|
||||
machine.Comment = MachineMappings[MachineField.Comment];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Control))
|
||||
machine.Control = MachineMappings[MachineField.Control];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Country))
|
||||
machine.Country = MachineMappings[MachineField.Country];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.CRC))
|
||||
machine.Crc = MachineMappings[MachineField.CRC].AsYesNo();
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Description))
|
||||
machine.Description = MachineMappings[MachineField.Description];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Developer))
|
||||
machine.Developer = MachineMappings[MachineField.Developer];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.DisplayCount))
|
||||
machine.DisplayCount = MachineMappings[MachineField.DisplayCount];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.DisplayType))
|
||||
machine.DisplayType = MachineMappings[MachineField.DisplayType];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Enabled))
|
||||
machine.Enabled = MachineMappings[MachineField.Enabled];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.GenMSXID))
|
||||
machine.GenMSXID = MachineMappings[MachineField.GenMSXID];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Genre))
|
||||
machine.Genre = MachineMappings[MachineField.Genre];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.History))
|
||||
machine.History = MachineMappings[MachineField.History];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.ID))
|
||||
machine.NoIntroId = MachineMappings[MachineField.ID];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Manufacturer))
|
||||
machine.Manufacturer = MachineMappings[MachineField.Manufacturer];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Name))
|
||||
machine.Name = MachineMappings[MachineField.Name];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Players))
|
||||
machine.Players = MachineMappings[MachineField.Players];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Publisher))
|
||||
machine.Publisher = MachineMappings[MachineField.Publisher];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Ratings))
|
||||
machine.Ratings = MachineMappings[MachineField.Ratings];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.RebuildTo))
|
||||
machine.RebuildTo = MachineMappings[MachineField.RebuildTo];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.RelatedTo))
|
||||
machine.RelatedTo = MachineMappings[MachineField.RelatedTo];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.RomOf))
|
||||
machine.RomOf = MachineMappings[MachineField.RomOf];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Rotation))
|
||||
machine.Rotation = MachineMappings[MachineField.Rotation];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Runnable))
|
||||
machine.Runnable = MachineMappings[MachineField.Runnable].AsRunnable();
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.SampleOf))
|
||||
machine.SampleOf = MachineMappings[MachineField.SampleOf];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Score))
|
||||
machine.Score = MachineMappings[MachineField.Score];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.SourceFile))
|
||||
machine.SourceFile = MachineMappings[MachineField.SourceFile];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Status))
|
||||
machine.Status = MachineMappings[MachineField.Status];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Subgenre))
|
||||
machine.Subgenre = MachineMappings[MachineField.Subgenre];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Supported))
|
||||
machine.Supported = MachineMappings[MachineField.Supported].AsSupported();
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.System))
|
||||
machine.System = MachineMappings[MachineField.System];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.TitleID))
|
||||
machine.TitleID = MachineMappings[MachineField.TitleID];
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Type))
|
||||
machine.MachineType = MachineMappings[MachineField.Type].AsMachineType();
|
||||
|
||||
if (MachineMappings.ContainsKey(MachineField.Year))
|
||||
machine.Year = MachineMappings[MachineField.Year];
|
||||
foreach (var kvp in MachineMappings)
|
||||
{
|
||||
machine.SetField(kvp.Key, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -394,146 +269,27 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="adjuster">Adjuster to remove replace fields in</param>
|
||||
private void SetFields(Adjuster adjuster)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Default))
|
||||
adjuster.Default = DatItemMappings[DatItemField.Default].AsYesNo();
|
||||
|
||||
// Field.DatItem_Conditions does not apply here
|
||||
if (adjuster.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in adjuster.Conditions!)
|
||||
{
|
||||
SetFields(subCondition, true);
|
||||
SetFields(subCondition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="analog">Analog to remove replace fields in</param>
|
||||
private void SetFields(Analog analog)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Analog_Mask))
|
||||
analog.Mask = DatItemMappings[DatItemField.Analog_Mask];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="archive">Archive to remove replace fields in</param>
|
||||
private void SetFields(Archive archive)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Categories))
|
||||
archive.Categories = DatItemMappings[DatItemField.Categories];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Clone))
|
||||
archive.CloneValue = DatItemMappings[DatItemField.Clone];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Complete))
|
||||
archive.Complete = DatItemMappings[DatItemField.Complete];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.DevStatus))
|
||||
archive.DevStatus = DatItemMappings[DatItemField.DevStatus];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Languages))
|
||||
archive.Languages = DatItemMappings[DatItemField.Languages];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Number))
|
||||
archive.Number = DatItemMappings[DatItemField.Number];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Physical))
|
||||
archive.Physical = DatItemMappings[DatItemField.Physical];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Region))
|
||||
archive.Region = DatItemMappings[DatItemField.Region];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.RegParent))
|
||||
archive.RegParent = DatItemMappings[DatItemField.RegParent];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="biosSet">BiosSet to remove replace fields in</param>
|
||||
private void SetFields(BiosSet biosSet)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Default))
|
||||
biosSet.Default = DatItemMappings[DatItemField.Default].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Description))
|
||||
biosSet.Description = DatItemMappings[DatItemField.Description];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="chip">Chip to remove replace fields in</param>
|
||||
private void SetFields(Chip chip)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.ChipType))
|
||||
chip.ChipType = DatItemMappings[DatItemField.ChipType].AsChipType();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Clock))
|
||||
chip.Clock = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Clock]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
chip.Tag = DatItemMappings[DatItemField.Tag];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="condition">Condition to remove replace fields in</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
private void SetFields(Condition condition, bool sub = false)
|
||||
{
|
||||
if (sub)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Condition_Mask))
|
||||
condition.Mask = DatItemMappings[DatItemField.Condition_Mask];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Condition_Relation))
|
||||
condition.Relation = DatItemMappings[DatItemField.Condition_Relation].AsRelation();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Condition_Tag))
|
||||
condition.Tag = DatItemMappings[DatItemField.Condition_Tag];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Condition_Value))
|
||||
condition.Value = DatItemMappings[DatItemField.Condition_Value];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Mask))
|
||||
condition.Mask = DatItemMappings[DatItemField.Mask];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Relation))
|
||||
condition.Relation = DatItemMappings[DatItemField.Relation].AsRelation();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
condition.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Value))
|
||||
condition.Value = DatItemMappings[DatItemField.Value];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="configuration">Configuration to remove replace fields in</param>
|
||||
private void SetFields(Configuration configuration)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Mask))
|
||||
configuration.Mask = DatItemMappings[DatItemField.Mask];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
configuration.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (configuration.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in configuration.Conditions!)
|
||||
{
|
||||
SetFields(subCondition, true);
|
||||
SetFields(subCondition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,134 +305,32 @@ namespace SabreTools.DatFiles
|
||||
{
|
||||
foreach (ConfSetting subSetting in configuration.Settings!)
|
||||
{
|
||||
SetFields(subSetting);
|
||||
SetFields(subSetting as DatItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="confLocation">ConfLocation to remove replace fields in</param>
|
||||
private void SetFields(ConfLocation confLocation)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Inverted))
|
||||
confLocation.Inverted = DatItemMappings[DatItemField.Location_Inverted].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Name))
|
||||
confLocation.Name = DatItemMappings[DatItemField.Location_Name];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Number))
|
||||
confLocation.Number = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Location_Number]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="confSetting">ConfSetting to remove replace fields in</param>
|
||||
private void SetFields(ConfSetting confSetting)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Default))
|
||||
confSetting.Default = DatItemMappings[DatItemField.Setting_Default].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Name))
|
||||
confSetting.Name = DatItemMappings[DatItemField.Setting_Name];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Value))
|
||||
confSetting.Value = DatItemMappings[DatItemField.Setting_Value];
|
||||
|
||||
if (confSetting.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in confSetting.Conditions!)
|
||||
{
|
||||
SetFields(subCondition, true);
|
||||
SetFields(subCondition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="control">Control to remove replace fields in</param>
|
||||
private void SetFields(Control control)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Buttons))
|
||||
control.Buttons = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_Buttons]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Type))
|
||||
control.ControlType = DatItemMappings[DatItemField.Control_Type].AsControlType();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_KeyDelta))
|
||||
control.KeyDelta = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_KeyDelta]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Maximum))
|
||||
control.Maximum = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_Maximum]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Minimum))
|
||||
control.Minimum = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_Minimum]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Player))
|
||||
control.Player = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_Player]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_RequiredButtons))
|
||||
control.RequiredButtons = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_RequiredButtons]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Reverse))
|
||||
control.Reverse = DatItemMappings[DatItemField.Control_Reverse].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Sensitivity))
|
||||
control.Sensitivity = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Control_Sensitivity]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Ways))
|
||||
control.Ways = DatItemMappings[DatItemField.Control_Ways];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Ways2))
|
||||
control.Ways2 = DatItemMappings[DatItemField.Control_Ways2];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Control_Ways3))
|
||||
control.Ways3 = DatItemMappings[DatItemField.Control_Ways3];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="dataArea">DataArea to remove replace fields in</param>
|
||||
private void SetFields(DataArea dataArea)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AreaEndianness))
|
||||
dataArea.Endianness = DatItemMappings[DatItemField.AreaEndianness].AsEndianness();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AreaName))
|
||||
dataArea.Name = DatItemMappings[DatItemField.AreaName];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AreaSize))
|
||||
dataArea.Size = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.AreaSize]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AreaWidth))
|
||||
dataArea.Width = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.AreaWidth]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="device">Device to remove replace fields in</param>
|
||||
private void SetFields(Device device)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.DeviceType))
|
||||
device.DeviceType = DatItemMappings[DatItemField.DeviceType].AsDeviceType();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.FixedImage))
|
||||
device.FixedImage = DatItemMappings[DatItemField.FixedImage];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Interface))
|
||||
device.Interface = DatItemMappings[DatItemField.Interface];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Mandatory))
|
||||
device.Mandatory = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Mandatory]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
device.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (device.ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension subExtension in device.Extensions!)
|
||||
@@ -694,39 +348,17 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="dipLocation">DipLocation to remove replace fields in</param>
|
||||
private void SetFields(DipLocation dipLocation)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Inverted))
|
||||
dipLocation.Inverted = DatItemMappings[DatItemField.Location_Inverted].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Name))
|
||||
dipLocation.Name = DatItemMappings[DatItemField.Location_Name];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Location_Number))
|
||||
dipLocation.Number = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Location_Number]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="dipSwitch">DipSwitch to remove replace fields in</param>
|
||||
private void SetFields(DipSwitch dipSwitch)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Mask))
|
||||
dipSwitch.Mask = DatItemMappings[DatItemField.Mask];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
dipSwitch.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (dipSwitch.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in dipSwitch.Conditions!)
|
||||
{
|
||||
SetFields(subCondition, true);
|
||||
SetFields(subCondition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,12 +374,12 @@ namespace SabreTools.DatFiles
|
||||
{
|
||||
foreach (DipValue subValue in dipSwitch.Values!)
|
||||
{
|
||||
SetFields(subValue);
|
||||
SetFields(subValue as DatItem);
|
||||
}
|
||||
}
|
||||
|
||||
dipSwitch.Part ??= new Part();
|
||||
SetFields(dipSwitch.Part);
|
||||
SetFields(dipSwitch.Part as DatItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -756,20 +388,11 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="dipValue">DipValue to remove replace fields in</param>
|
||||
private void SetFields(DipValue dipValue)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Default))
|
||||
dipValue.Default = DatItemMappings[DatItemField.Setting_Default].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Name))
|
||||
dipValue.Name = DatItemMappings[DatItemField.Setting_Name];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Setting_Value))
|
||||
dipValue.Value = DatItemMappings[DatItemField.Setting_Value];
|
||||
|
||||
if (dipValue.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in dipValue.Conditions!)
|
||||
{
|
||||
SetFields(subCondition, true);
|
||||
SetFields(subCondition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -780,161 +403,11 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="disk">Disk to remove replace fields in</param>
|
||||
private void SetFields(Disk disk)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Index))
|
||||
disk.Index = DatItemMappings[DatItemField.Index];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.MD5))
|
||||
disk.MD5 = DatItemMappings[DatItemField.MD5];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Merge))
|
||||
disk.MergeTag = DatItemMappings[DatItemField.Merge];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Optional))
|
||||
disk.Optional = DatItemMappings[DatItemField.Optional].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Region))
|
||||
disk.Region = DatItemMappings[DatItemField.Region];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA1))
|
||||
disk.SHA1 = DatItemMappings[DatItemField.SHA1];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Status))
|
||||
disk.ItemStatus = DatItemMappings[DatItemField.Status].AsItemStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Writable))
|
||||
disk.Writable = DatItemMappings[DatItemField.Writable].AsYesNo();
|
||||
|
||||
disk.DiskArea ??= new DiskArea();
|
||||
SetFields(disk.DiskArea);
|
||||
|
||||
disk.Part ??= new Part();
|
||||
SetFields(disk.Part);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="diskArea">DiskArea to remove replace fields in</param>
|
||||
private void SetFields(DiskArea diskArea)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AreaName))
|
||||
diskArea.Name = DatItemMappings[DatItemField.AreaName];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="display">Display to remove replace fields in</param>
|
||||
private void SetFields(Display display)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.DisplayType))
|
||||
display.DisplayType = DatItemMappings[DatItemField.DisplayType].AsDisplayType();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.FlipX))
|
||||
display.FlipX = DatItemMappings[DatItemField.FlipX].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Height))
|
||||
display.Height = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Height]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.HBEnd))
|
||||
display.HBEnd = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.HBEnd]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.HBStart))
|
||||
display.HBStart = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.HBStart]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.HTotal))
|
||||
display.HTotal = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.HTotal]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.PixClock))
|
||||
display.PixClock = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.PixClock]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Refresh))
|
||||
display.Refresh = NumberHelper.ConvertToDouble(DatItemMappings[DatItemField.Refresh]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Rotate))
|
||||
display.Rotate = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Rotate]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
display.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.VBEnd))
|
||||
display.VBEnd = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.VBEnd]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.VBStart))
|
||||
display.VBStart = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.VBStart]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.VTotal))
|
||||
display.VTotal = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.VTotal]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Width))
|
||||
display.Width = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Width]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="driver">Driver to remove replace fields in</param>
|
||||
private void SetFields(Driver driver)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.CocktailStatus))
|
||||
driver.Cocktail = DatItemMappings[DatItemField.CocktailStatus].AsSupportStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Incomplete))
|
||||
driver.Incomplete = DatItemMappings[DatItemField.Incomplete].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.EmulationStatus))
|
||||
driver.Emulation = DatItemMappings[DatItemField.EmulationStatus].AsSupportStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.NoSoundHardware))
|
||||
driver.NoSoundHardware = DatItemMappings[DatItemField.NoSoundHardware].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.RequiresArtwork))
|
||||
driver.RequiresArtwork = DatItemMappings[DatItemField.RequiresArtwork].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SaveStateStatus))
|
||||
driver.SaveState = DatItemMappings[DatItemField.SaveStateStatus].AsSupported();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SupportStatus))
|
||||
driver.Status = DatItemMappings[DatItemField.SupportStatus].AsSupportStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Unofficial))
|
||||
driver.Unofficial = DatItemMappings[DatItemField.Unofficial].AsYesNo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="extension">Extension to remove replace fields in</param>
|
||||
private void SetFields(Extension extension)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Extension_Name))
|
||||
extension.Name = DatItemMappings[DatItemField.Extension_Name];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="feature">Feature to remove replace fields in</param>
|
||||
private void SetFields(Feature feature)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.FeatureOverall))
|
||||
feature.Overall = DatItemMappings[DatItemField.FeatureOverall].AsFeatureStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.FeatureStatus))
|
||||
feature.Status = DatItemMappings[DatItemField.FeatureStatus].AsFeatureStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.FeatureType))
|
||||
feature.Type = DatItemMappings[DatItemField.FeatureType].AsFeatureType();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="info">Info to remove replace fields in</param>
|
||||
private void SetFields(Info info)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Value))
|
||||
info.Value = DatItemMappings[DatItemField.Value];
|
||||
SetFields(disk.Part as DatItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -943,18 +416,6 @@ namespace SabreTools.DatFiles
|
||||
/// <param name="input">Input to remove replace fields in</param>
|
||||
private void SetFields(Input input)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Coins))
|
||||
input.Coins = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Coins]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Players))
|
||||
input.Players = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Players]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Service))
|
||||
input.Service = DatItemMappings[DatItemField.Service].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tilt))
|
||||
input.Tilt = DatItemMappings[DatItemField.Tilt].AsYesNo();
|
||||
|
||||
if (input.ControlsSpecified)
|
||||
{
|
||||
foreach (Control subControl in input.Controls!)
|
||||
@@ -964,50 +425,12 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="instance">Instance to remove replace fields in</param>
|
||||
private void SetFields(Instance instance)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Instance_BriefName))
|
||||
instance.BriefName = DatItemMappings[DatItemField.Instance_BriefName];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Instance_Name))
|
||||
instance.BriefName = DatItemMappings[DatItemField.Instance_Name];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="media">Media to remove replace fields in</param>
|
||||
private void SetFields(Media media)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.MD5))
|
||||
media.MD5 = DatItemMappings[DatItemField.MD5];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA1))
|
||||
media.SHA1 = DatItemMappings[DatItemField.SHA1];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA256))
|
||||
media.SHA256 = DatItemMappings[DatItemField.SHA256];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SpamSum))
|
||||
media.SpamSum = DatItemMappings[DatItemField.SpamSum];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>s
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="part">Part to remove replace fields in</param>
|
||||
private void SetFields(Part part)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Part_Interface))
|
||||
part.Interface = DatItemMappings[DatItemField.Part_Interface];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Part_Name))
|
||||
part.Name = DatItemMappings[DatItemField.Part_Name];
|
||||
|
||||
if (part.FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature subPartFeature in part.Features!)
|
||||
@@ -1017,28 +440,12 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="partFeature">PartFeature to remove replace fields in</param>
|
||||
private void SetFields(PartFeature partFeature)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Part_Feature_Name))
|
||||
partFeature.Name = DatItemMappings[DatItemField.Part_Feature_Name];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Part_Feature_Value))
|
||||
partFeature.Value = DatItemMappings[DatItemField.Part_Feature_Value];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="port">Port to remove replace fields in</param>
|
||||
private void SetFields(Port port)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
port.Tag = DatItemMappings[DatItemField.Tag];
|
||||
|
||||
if (port.AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog subAnalog in port.Analogs!)
|
||||
@@ -1048,152 +455,17 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="ramOption">RamOption to remove replace fields in</param>
|
||||
private void SetFields(RamOption ramOption)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Content))
|
||||
ramOption.Content = DatItemMappings[DatItemField.Content];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Default))
|
||||
ramOption.Default = DatItemMappings[DatItemField.Default].AsYesNo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="release">Release to remove replace fields in</param>
|
||||
private void SetFields(Release release)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Date))
|
||||
release.Date = DatItemMappings[DatItemField.Date];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Default))
|
||||
release.Default = DatItemMappings[DatItemField.Default].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Language))
|
||||
release.Language = DatItemMappings[DatItemField.Language];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Region))
|
||||
release.Region = DatItemMappings[DatItemField.Region];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="rom">Rom to remove replace fields in</param>
|
||||
private void SetFields(Rom rom)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AltName))
|
||||
rom.AltName = DatItemMappings[DatItemField.AltName];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.AltTitle))
|
||||
rom.AltTitle = DatItemMappings[DatItemField.AltTitle];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.ArchiveDotOrgFormat))
|
||||
rom.ArchiveDotOrgFormat = DatItemMappings[DatItemField.ArchiveDotOrgFormat];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.ArchiveDotOrgSource))
|
||||
rom.ArchiveDotOrgSource = DatItemMappings[DatItemField.ArchiveDotOrgSource];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Bios))
|
||||
rom.Bios = DatItemMappings[DatItemField.Bios];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Boot))
|
||||
rom.Boot = DatItemMappings[DatItemField.Boot];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.CRC))
|
||||
rom.CRC = DatItemMappings[DatItemField.CRC];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Date))
|
||||
rom.Date = DatItemMappings[DatItemField.Date];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Inverted))
|
||||
rom.Inverted = DatItemMappings[DatItemField.Inverted].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.LoadFlag))
|
||||
rom.LoadFlag = DatItemMappings[DatItemField.LoadFlag].AsLoadFlag();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.MD5))
|
||||
rom.MD5 = DatItemMappings[DatItemField.MD5];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Merge))
|
||||
rom.MergeTag = DatItemMappings[DatItemField.Merge];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.MIA))
|
||||
rom.MIA = DatItemMappings[DatItemField.MIA].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Offset))
|
||||
rom.Offset = DatItemMappings[DatItemField.Offset];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.OpenMSXSubType))
|
||||
rom.OpenMSXSubType = DatItemMappings[DatItemField.OpenMSXSubType].AsOpenMSXSubType();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.OpenMSXType))
|
||||
rom.OpenMSXType = DatItemMappings[DatItemField.OpenMSXType];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Optional))
|
||||
rom.Optional = DatItemMappings[DatItemField.Optional].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Original))
|
||||
rom.Original = new Original() { Content = DatItemMappings[DatItemField.Original] };
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.OriginalFilename))
|
||||
rom.OriginalFilename = DatItemMappings[DatItemField.OriginalFilename];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Region))
|
||||
rom.Region = DatItemMappings[DatItemField.Region];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Remark))
|
||||
rom.Remark = DatItemMappings[DatItemField.Remark];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Rotation))
|
||||
rom.Rotation = DatItemMappings[DatItemField.Rotation];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA1))
|
||||
rom.SHA1 = DatItemMappings[DatItemField.SHA1];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA256))
|
||||
rom.SHA256 = DatItemMappings[DatItemField.SHA256];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA384))
|
||||
rom.SHA384 = DatItemMappings[DatItemField.SHA384];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SHA512))
|
||||
rom.SHA512 = DatItemMappings[DatItemField.SHA512];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Size))
|
||||
rom.Size = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Size]);
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SpamSum))
|
||||
rom.SpamSum = DatItemMappings[DatItemField.SpamSum];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Status))
|
||||
rom.ItemStatus = DatItemMappings[DatItemField.Status].AsItemStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Summation))
|
||||
rom.Summation = DatItemMappings[DatItemField.Summation];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Value))
|
||||
rom.Value = DatItemMappings[DatItemField.Value];
|
||||
|
||||
rom.DataArea ??= new DataArea();
|
||||
SetFields(rom.DataArea);
|
||||
|
||||
rom.Part ??= new Part();
|
||||
SetFields(rom.Part);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="sharedFeature">SharedFeature to remove replace fields in</param>
|
||||
private void SetFields(SharedFeature sharedFeature)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Value))
|
||||
sharedFeature.Value = DatItemMappings[DatItemField.Value];
|
||||
SetFields(rom.Part as DatItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1210,47 +482,5 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="slotOption">SlotOption to remove replace fields in</param>
|
||||
private void SetFields(SlotOption slotOption)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SlotOption_Default))
|
||||
slotOption.Default = DatItemMappings[DatItemField.SlotOption_Default].AsYesNo();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SlotOption_DeviceName))
|
||||
slotOption.DeviceName = DatItemMappings[DatItemField.SlotOption_DeviceName];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SlotOption_Name))
|
||||
slotOption.Name = DatItemMappings[DatItemField.SlotOption_Name];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="softwareList">SoftwareList to remove replace fields in</param>
|
||||
private void SetFields(SoftwareList softwareList)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Filter))
|
||||
softwareList.Filter = DatItemMappings[DatItemField.Filter];
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.SoftwareListStatus))
|
||||
softwareList.Status = DatItemMappings[DatItemField.SoftwareListStatus].AsSoftwareListStatus();
|
||||
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Tag))
|
||||
softwareList.Tag = DatItemMappings[DatItemField.Tag];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="sound">Sound to remove replace fields in</param>
|
||||
private void SetFields(Sound sound)
|
||||
{
|
||||
if (DatItemMappings!.ContainsKey(DatItemField.Channels))
|
||||
sound.Channels = NumberHelper.ConvertToInt64(DatItemMappings[DatItemField.Channels]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,6 +371,8 @@ namespace SabreTools.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: These should not take a field enum
|
||||
// TODO: These should be item-specific for better filtering
|
||||
#region Manipulation
|
||||
|
||||
/// <summary>
|
||||
@@ -380,6 +382,15 @@ namespace SabreTools.DatItems
|
||||
/// <returns>True if the removal was successful, false otherwise</returns>
|
||||
public abstract bool RemoveField(DatItemField datItemField);
|
||||
|
||||
/// <summary>
|
||||
/// Set a field in the DatItem from a mapping string
|
||||
/// </summary>
|
||||
/// <param name="machineField">Item field to set</param>
|
||||
/// <param name="value">String representing the value to set</param>
|
||||
/// <returns>True if the setting was successful, false otherwise</returns>
|
||||
/// <remarks>This only performs minimal validation before setting</remarks>
|
||||
public abstract bool SetField(DatItemField datItemField, string value);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
@@ -115,6 +115,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.Adjuster.DefaultKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Analog_Mask => Models.Metadata.Analog.MaskKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,21 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.BiosSet.DefaultKey,
|
||||
DatItemField.Description => Models.Metadata.BiosSet.DescriptionKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,9 @@ namespace SabreTools.DatItems.Formats
|
||||
/// <inheritdoc/>
|
||||
public override bool RemoveField(DatItemField datItemField) => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value) => true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,22 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.ChipType => Models.Metadata.Chip.ChipTypeKey,
|
||||
DatItemField.Clock => Models.Metadata.Chip.ClockKey,
|
||||
DatItemField.Tag => Models.Metadata.Chip.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,27 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Mask => Models.Metadata.Condition.MaskKey,
|
||||
DatItemField.Condition_Mask => Models.Metadata.Condition.MaskKey,
|
||||
DatItemField.Relation => Models.Metadata.Condition.RelationKey,
|
||||
DatItemField.Condition_Relation => Models.Metadata.Condition.RelationKey,
|
||||
DatItemField.Tag => Models.Metadata.Condition.TagKey,
|
||||
DatItemField.Condition_Tag => Models.Metadata.Condition.TagKey,
|
||||
DatItemField.Value => Models.Metadata.Condition.ValueKey,
|
||||
DatItemField.Condition_Value => Models.Metadata.Condition.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Inverted => Models.Metadata.ConfLocation.InvertedKey,
|
||||
DatItemField.Location_Inverted => Models.Metadata.ConfLocation.InvertedKey,
|
||||
DatItemField.Number => Models.Metadata.ConfLocation.NumberKey,
|
||||
DatItemField.Location_Number => Models.Metadata.ConfLocation.NumberKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.ConfSetting.DefaultKey,
|
||||
DatItemField.Setting_Default => Models.Metadata.ConfSetting.DefaultKey,
|
||||
DatItemField.Value => Models.Metadata.ConfSetting.ValueKey,
|
||||
DatItemField.Setting_Value => Models.Metadata.ConfSetting.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +149,21 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Mask => Models.Metadata.Configuration.MaskKey,
|
||||
DatItemField.Tag => Models.Metadata.Configuration.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace SabreTools.DatItems.Formats
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Manipulation
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -227,6 +227,31 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Control_Buttons => Models.Metadata.Control.ButtonsKey,
|
||||
DatItemField.Control_KeyDelta => Models.Metadata.Control.KeyDeltaKey,
|
||||
DatItemField.Control_Maximum => Models.Metadata.Control.MaximumKey,
|
||||
DatItemField.Control_Minimum => Models.Metadata.Control.MinimumKey,
|
||||
DatItemField.Control_Player => Models.Metadata.Control.PlayerKey,
|
||||
DatItemField.Control_RequiredButtons => Models.Metadata.Control.ReqButtonsKey,
|
||||
DatItemField.Control_Reverse => Models.Metadata.Control.ReverseKey,
|
||||
DatItemField.Control_Sensitivity => Models.Metadata.Control.SensitivityKey,
|
||||
DatItemField.Control_Type => Models.Metadata.Control.ControlTypeKey,
|
||||
DatItemField.Control_Ways => Models.Metadata.Control.WaysKey,
|
||||
DatItemField.Control_Ways2 => Models.Metadata.Control.Ways2Key,
|
||||
DatItemField.Control_Ways3 => Models.Metadata.Control.Ways3Key,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,22 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.AreaEndianness => Models.Metadata.DataArea.EndiannessKey,
|
||||
DatItemField.AreaSize => Models.Metadata.DataArea.SizeKey,
|
||||
DatItemField.AreaWidth => Models.Metadata.DataArea.WidthKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,24 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.DeviceType => Models.Metadata.Device.DeviceTypeKey,
|
||||
DatItemField.FixedImage => Models.Metadata.Device.FixedImageKey,
|
||||
DatItemField.Interface => Models.Metadata.Device.InterfaceKey,
|
||||
DatItemField.Mandatory => Models.Metadata.Device.MandatoryKey,
|
||||
DatItemField.Tag => Models.Metadata.Device.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Inverted => Models.Metadata.DipLocation.InvertedKey,
|
||||
DatItemField.Location_Inverted => Models.Metadata.DipLocation.InvertedKey,
|
||||
DatItemField.Number => Models.Metadata.DipLocation.NumberKey,
|
||||
DatItemField.Location_Number => Models.Metadata.DipLocation.NumberKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,21 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Mask => Models.Metadata.DipSwitch.MaskKey,
|
||||
DatItemField.Tag => Models.Metadata.DipSwitch.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.DipValue.DefaultKey,
|
||||
DatItemField.Setting_Default => Models.Metadata.DipValue.DefaultKey,
|
||||
DatItemField.Value => Models.Metadata.DipValue.ValueKey,
|
||||
DatItemField.Setting_Value => Models.Metadata.DipValue.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,27 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Index => Models.Metadata.Disk.IndexKey,
|
||||
DatItemField.MD5 => Models.Metadata.Disk.MD5Key,
|
||||
DatItemField.Merge => Models.Metadata.Disk.MergeKey,
|
||||
DatItemField.Optional => Models.Metadata.Disk.OptionalKey,
|
||||
DatItemField.Region => Models.Metadata.Disk.RegionKey,
|
||||
DatItemField.SHA1 => Models.Metadata.Disk.SHA1Key,
|
||||
DatItemField.Status => Models.Metadata.Disk.StatusKey,
|
||||
DatItemField.Writable => Models.Metadata.Disk.WritableKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
@@ -87,6 +87,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +261,33 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.DisplayType => Models.Metadata.Display.DisplayTypeKey,
|
||||
DatItemField.FlipX => Models.Metadata.Display.FlipXKey,
|
||||
DatItemField.HBEnd => Models.Metadata.Display.HBEndKey,
|
||||
DatItemField.HBStart => Models.Metadata.Display.HBStartKey,
|
||||
DatItemField.Height => Models.Metadata.Display.HeightKey,
|
||||
DatItemField.HTotal => Models.Metadata.Display.HTotalKey,
|
||||
DatItemField.PixClock => Models.Metadata.Display.PixClockKey,
|
||||
DatItemField.Refresh => Models.Metadata.Display.RefreshKey,
|
||||
DatItemField.Rotate => Models.Metadata.Display.RotateKey,
|
||||
DatItemField.Tag => Models.Metadata.Display.TagKey,
|
||||
DatItemField.VBEnd => Models.Metadata.Display.VBEndKey,
|
||||
DatItemField.VBStart => Models.Metadata.Display.VBStartKey,
|
||||
DatItemField.VTotal => Models.Metadata.Display.VTotalKey,
|
||||
DatItemField.Width => Models.Metadata.Display.WidthKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,27 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.CocktailStatus => Models.Metadata.Driver.CocktailKey,
|
||||
DatItemField.EmulationStatus => Models.Metadata.Driver.EmulationKey,
|
||||
DatItemField.Incomplete => Models.Metadata.Driver.IncompleteKey,
|
||||
DatItemField.NoSoundHardware => Models.Metadata.Driver.NoSoundHardwareKey,
|
||||
DatItemField.RequiresArtwork => Models.Metadata.Driver.RequiresArtworkKey,
|
||||
DatItemField.SaveStateStatus => Models.Metadata.Driver.SaveStateKey,
|
||||
DatItemField.SupportStatus => Models.Metadata.Driver.StatusKey,
|
||||
DatItemField.Unofficial => Models.Metadata.Driver.UnofficialKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,22 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.FeatureOverall => Models.Metadata.Feature.OverallKey,
|
||||
DatItemField.FeatureStatus => Models.Metadata.Feature.StatusKey,
|
||||
DatItemField.FeatureType => Models.Metadata.Feature.FeatureTypeKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +342,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
// TODO: Figure out what fields go here
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
@@ -97,6 +97,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Value => Models.Metadata.Info.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Coins => Models.Metadata.Input.CoinsKey,
|
||||
DatItemField.Players => Models.Metadata.Input.PlayersKey,
|
||||
DatItemField.Service => Models.Metadata.Input.ServiceKey,
|
||||
DatItemField.Tilt => Models.Metadata.Input.TiltKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Instance_BriefName => Models.Metadata.Instance.BriefNameKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +203,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.MD5 => Models.Metadata.Media.MD5Key,
|
||||
DatItemField.SHA1 => Models.Metadata.Media.SHA1Key,
|
||||
DatItemField.SHA256 => Models.Metadata.Media.SHA256Key,
|
||||
DatItemField.SpamSum => Models.Metadata.Media.SpamSumKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
@@ -104,6 +104,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Part_Interface => Models.Metadata.Part.InterfaceKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,21 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Value => Models.Metadata.Feature.ValueKey,
|
||||
DatItemField.Part_Feature_Value => Models.Metadata.Feature.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Tag => Models.Metadata.Port.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,21 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Content => Models.Metadata.RamOption.ContentKey,
|
||||
DatItemField.Default => Models.Metadata.RamOption.DefaultKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,23 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Date => Models.Metadata.Release.DateKey,
|
||||
DatItemField.Default => Models.Metadata.Release.DefaultKey,
|
||||
DatItemField.Language => Models.Metadata.Release.LanguageKey,
|
||||
DatItemField.Region => Models.Metadata.Release.RegionKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
// TODO: Figure out what fields go here
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,6 +653,60 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.AltName => Models.Metadata.Rom.AltRomnameKey,
|
||||
DatItemField.AltTitle => Models.Metadata.Rom.AltTitleKey,
|
||||
DatItemField.ArchiveDotOrgFormat => Models.Metadata.Rom.FormatKey,
|
||||
DatItemField.ArchiveDotOrgSource => Models.Metadata.Rom.SourceKey,
|
||||
DatItemField.Bios => Models.Metadata.Rom.BiosKey,
|
||||
//DatItemField.Boot => Models.Metadata.Rom.BootKey,
|
||||
DatItemField.CRC => Models.Metadata.Rom.CRCKey,
|
||||
DatItemField.Date => Models.Metadata.Rom.DateKey,
|
||||
DatItemField.Inverted => Models.Metadata.Rom.InvertedKey,
|
||||
DatItemField.LoadFlag => Models.Metadata.Rom.LoadFlagKey,
|
||||
DatItemField.MD5 => Models.Metadata.Rom.MD5Key,
|
||||
DatItemField.Merge => Models.Metadata.Rom.MergeKey,
|
||||
DatItemField.MIA => Models.Metadata.Rom.MIAKey,
|
||||
DatItemField.Offset => Models.Metadata.Rom.OffsetKey,
|
||||
DatItemField.OpenMSXSubType => Models.Metadata.Rom.OpenMSXMediaType, // TODO: Fix with Key suffix
|
||||
DatItemField.OpenMSXType => Models.Metadata.Rom.OpenMSXType, // TODO: Fix with Key suffix
|
||||
DatItemField.Optional => Models.Metadata.Rom.OptionalKey,
|
||||
//DatItemField.Original => Models.Metadata.Rom.OriginalKey,
|
||||
DatItemField.OriginalFilename => Models.Metadata.Rom.OriginalKey,
|
||||
DatItemField.Region => Models.Metadata.Rom.RegionKey,
|
||||
DatItemField.Remark => Models.Metadata.Rom.RemarkKey,
|
||||
DatItemField.Rotation => Models.Metadata.Rom.RotationKey,
|
||||
DatItemField.SHA1 => Models.Metadata.Rom.SHA1Key,
|
||||
DatItemField.SHA256 => Models.Metadata.Rom.SHA256Key,
|
||||
DatItemField.SHA384 => Models.Metadata.Rom.SHA384Key,
|
||||
DatItemField.SHA512 => Models.Metadata.Rom.SHA512Key,
|
||||
DatItemField.Size => Models.Metadata.Rom.SizeKey,
|
||||
DatItemField.SpamSum => Models.Metadata.Rom.SpamSumKey,
|
||||
DatItemField.Status => Models.Metadata.Rom.StatusKey,
|
||||
DatItemField.Summation => Models.Metadata.Rom.SummationKey,
|
||||
DatItemField.Value => Models.Metadata.Rom.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// A null value means special handling is needed
|
||||
if (fieldName == null)
|
||||
{
|
||||
switch (datItemField)
|
||||
{
|
||||
case DatItemField.Boot: Boot = value; return true;
|
||||
case DatItemField.Original: Original = new Original { Content = value }; return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
@@ -86,6 +86,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +192,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
// TODO: Figure out what fields go here
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Value => Models.Metadata.SharedFeat.ValueKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,19 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,22 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.SlotOption.DefaultKey,
|
||||
DatItemField.SlotOption_Default => Models.Metadata.SlotOption.DefaultKey,
|
||||
DatItemField.SlotOption_DeviceName => Models.Metadata.SlotOption.DevNameKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,22 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Filter => Models.Metadata.SoftwareList.FilterKey,
|
||||
DatItemField.SoftwareListStatus => Models.Metadata.SoftwareList.StatusKey,
|
||||
DatItemField.Tag => Models.Metadata.SoftwareList.TagKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,20 @@ namespace SabreTools.DatItems.Formats
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
DatItemField.Default => Models.Metadata.Sound.ChannelsKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Filter;
|
||||
|
||||
// TODO: Add item mappings for all fields
|
||||
namespace SabreTools.DatItems.Formats
|
||||
@@ -224,5 +225,37 @@ namespace SabreTools.DatItems.Formats
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manipulation
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool RemoveField(DatItemField datItemField)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
// TODO: Figure out what fields go here
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Remove the field and return
|
||||
return FieldManipulator.RemoveField(_internal, fieldName);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool SetField(DatItemField datItemField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = datItemField switch
|
||||
{
|
||||
// TODO: Figure out what fields go here
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// Set the field and return
|
||||
return FieldManipulator.SetField(_internal, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,6 +615,81 @@ namespace SabreTools.DatItems
|
||||
return FieldManipulator.RemoveField(_machine, fieldName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a field in the Machine from a mapping string
|
||||
/// </summary>
|
||||
/// <param name="machineField">Machine field to set</param>
|
||||
/// <param name="value">String representing the value to set</param>
|
||||
/// <returns>True if the setting was successful, false otherwise</returns>
|
||||
/// <remarks>This only performs minimal validation before setting</remarks>
|
||||
public bool SetField(MachineField machineField, string value)
|
||||
{
|
||||
// Get the correct internal field name
|
||||
string? fieldName = machineField switch
|
||||
{
|
||||
MachineField.Board => Models.Metadata.Machine.BoardKey,
|
||||
MachineField.Buttons => Models.Metadata.Machine.ButtonsKey,
|
||||
MachineField.Category => Models.Metadata.Machine.CategoryKey,
|
||||
MachineField.CloneOf => Models.Metadata.Machine.CloneOfKey,
|
||||
MachineField.CloneOfID => Models.Metadata.Machine.CloneOfIdKey,
|
||||
MachineField.Comment => Models.Metadata.Machine.CommentKey,
|
||||
MachineField.Control => Models.Metadata.Machine.ControlKey,
|
||||
MachineField.Country => Models.Metadata.Machine.CountryKey,
|
||||
//MachineField.CRC => Models.Metadata.Machine.CRCKey,
|
||||
MachineField.Description => Models.Metadata.Machine.DescriptionKey,
|
||||
//MachineField.Developer => Models.Metadata.Machine.DeveloperKey,
|
||||
MachineField.DisplayCount => Models.Metadata.Machine.DisplayCountKey,
|
||||
MachineField.DisplayType => Models.Metadata.Machine.DisplayTypeKey,
|
||||
//MachineField.Enabled => Models.Metadata.Machine.EnabledKey,
|
||||
MachineField.GenMSXID => Models.Metadata.Machine.GenMSXIDKey,
|
||||
//MachineField.Genre => Models.Metadata.Machine.GenreKey,
|
||||
MachineField.History => Models.Metadata.Machine.HistoryKey,
|
||||
MachineField.ID => Models.Metadata.Machine.IdKey,
|
||||
MachineField.Manufacturer => Models.Metadata.Machine.ManufacturerKey,
|
||||
MachineField.Name => Models.Metadata.Machine.NameKey,
|
||||
MachineField.Players => Models.Metadata.Machine.PlayersKey,
|
||||
MachineField.Publisher => Models.Metadata.Machine.PublisherKey,
|
||||
//MachineField.Ratings => Models.Metadata.Machine.RatingsKey,
|
||||
MachineField.RebuildTo => Models.Metadata.Machine.RebuildToKey,
|
||||
//MachineField.RelatedTo => Models.Metadata.Machine.RelatedToKey,
|
||||
MachineField.RomOf => Models.Metadata.Machine.RomOfKey,
|
||||
MachineField.Rotation => Models.Metadata.Machine.RotationKey,
|
||||
MachineField.Runnable => Models.Metadata.Machine.RunnableKey,
|
||||
MachineField.SampleOf => Models.Metadata.Machine.SampleOfKey,
|
||||
//MachineField.Score => Models.Metadata.Machine.ScoreKey,
|
||||
MachineField.SourceFile => Models.Metadata.Machine.SourceFileKey,
|
||||
MachineField.Status => Models.Metadata.Machine.StatusKey,
|
||||
//MachineField.Subgenre => Models.Metadata.Machine.SubgenreKey,
|
||||
MachineField.Supported => Models.Metadata.Machine.SupportedKey,
|
||||
MachineField.System => Models.Metadata.Machine.SystemKey,
|
||||
//MachineField.TitleID => Models.Metadata.Machine.TitleIDKey,
|
||||
//MachineField.Type => Models.Metadata.Machine.TypeKey,
|
||||
MachineField.Year => Models.Metadata.Machine.YearKey,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
// A null value means special handling is needed
|
||||
if (fieldName == null)
|
||||
{
|
||||
switch (machineField)
|
||||
{
|
||||
case MachineField.CRC: Crc = value.AsYesNo(); return true;
|
||||
case MachineField.Developer: Developer = value; return true;
|
||||
case MachineField.Enabled: Enabled = value; return true;
|
||||
case MachineField.Genre: Genre = value; return true;
|
||||
case MachineField.Ratings: Ratings = value; return true;
|
||||
case MachineField.RelatedTo: RelatedTo = value; return true;
|
||||
case MachineField.Score: Score = value; return true;
|
||||
case MachineField.Subgenre: Subgenre = value; return true;
|
||||
case MachineField.TitleID: TitleID = value; return true;
|
||||
case MachineField.Type: MachineType = value.AsMachineType(); return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the field and return
|
||||
return FieldManipulator.SetField(_machine, fieldName, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace SabreTools.Filtering
|
||||
case DipValue dipValue: RemoveFields(dipValue); break;
|
||||
case Disk disk: RemoveFields(disk); break;
|
||||
case Input input: RemoveFields(input); break;
|
||||
case Part part: RemoveFields(part); break;
|
||||
case Port port: RemoveFields(port); break;
|
||||
case Rom rom: RemoveFields(rom); break;
|
||||
case Slot slot: RemoveFields(slot); break;
|
||||
@@ -114,8 +115,11 @@ namespace SabreTools.Filtering
|
||||
/// Remove fields with given values
|
||||
/// </summary>
|
||||
/// <param name="machine">Machine to remove fields from</param>
|
||||
private void RemoveFields(Machine machine)
|
||||
private void RemoveFields(Machine? machine)
|
||||
{
|
||||
if (machine == null)
|
||||
return;
|
||||
|
||||
foreach (var machineField in MachineFields)
|
||||
{
|
||||
machine.RemoveField(machineField);
|
||||
@@ -323,7 +327,7 @@ namespace SabreTools.Filtering
|
||||
RemoveFields(rom.DataArea!);
|
||||
|
||||
if (rom.PartSpecified)
|
||||
RemoveFields(rom.Part!);
|
||||
RemoveFields(rom.Part! as DatItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user