DatItems don't know about replacing fields

This commit is contained in:
Matt Nadareski
2020-12-14 10:58:43 -08:00
parent bfdf219a78
commit 1690308894
40 changed files with 985 additions and 1486 deletions

View File

@@ -195,60 +195,5 @@ namespace SabreTools.DatItems
}
#endregion
#region Sorting and Merging
/// <inheritdoc/>
public override void ReplaceFields(
DatItem item,
List<DatItemField> datItemFields,
List<MachineField> machineFields)
{
// Replace common fields first
base.ReplaceFields(item, datItemFields, machineFields);
// If we don't have a DipSwitch to replace from, ignore specific fields
if (item.ItemType != ItemType.DipSwitch)
return;
// Cast for easier access
DipSwitch newItem = item as DipSwitch;
// Replace the fields
#region Common
if (datItemFields.Contains(DatItemField.Name))
Name = newItem.Name;
if (datItemFields.Contains(DatItemField.Tag))
Tag = newItem.Tag;
if (datItemFields.Contains(DatItemField.Mask))
Mask = newItem.Mask;
// DatItem_Condition_* doesn't make sense here
// since not every condition under the other item
// can replace every condition under this item
// DatItem_Location_* doesn't make sense here
// since not every location under the other item
// can replace every location under this item
// DatItem_Setting_* doesn't make sense here
// since not every value under the other item
// can replace every value under this item
#endregion
#region SoftwareList
if (PartSpecified && newItem.PartSpecified)
Part.ReplaceFields(newItem.Part, datItemFields, machineFields);
#endregion
}
#endregion
}
}