mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
DatItems don't know about replacing fields
This commit is contained in:
@@ -116,37 +116,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Adjuster to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Adjuster)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Adjuster newItem = item as Adjuster;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
|
|
||||||
// DatItem_Condition_* doesn't make sense here
|
|
||||||
// since not every condition under the other item
|
|
||||||
// can replace every condition under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -70,30 +69,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Analog to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Analog)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Analog newItem = item as Analog;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Analog_Mask))
|
|
||||||
Mask = newItem.Mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,30 +80,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Archive to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Archive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Archive newItem = item as Archive;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -102,36 +101,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 BiosSet to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.BiosSet)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
BiosSet newItem = item as BiosSet;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Description))
|
|
||||||
Description = newItem.Description;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -116,39 +115,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Chip to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Chip)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Chip newItem = item as Chip;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Tag))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.ChipType))
|
|
||||||
ChipType = newItem.ChipType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Clock))
|
|
||||||
Clock = newItem.Clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -102,47 +101,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Condition to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Condition)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Condition newItem = item as Condition;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Tag))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
else if (datItemFields.Contains(DatItemField.Condition_Tag))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Mask))
|
|
||||||
Mask = newItem.Mask;
|
|
||||||
else if (datItemFields.Contains(DatItemField.Condition_Mask))
|
|
||||||
Mask = newItem.Mask;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Relation))
|
|
||||||
Relation = newItem.Relation;
|
|
||||||
else if (datItemFields.Contains(DatItemField.Condition_Relation))
|
|
||||||
Relation = newItem.Relation;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
else if (datItemFields.Contains(DatItemField.Condition_Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,48 +163,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Configuration to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Configuration)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Configuration newItem = item as Configuration;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
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 setting under the other item
|
|
||||||
// can replace every setting under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -198,63 +197,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Control to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Control)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Control newItem = item as Control;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Type))
|
|
||||||
ControlType = newItem.ControlType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Player))
|
|
||||||
Player = newItem.Player;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Buttons))
|
|
||||||
Buttons = newItem.Buttons;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_RequiredButtons))
|
|
||||||
RequiredButtons = newItem.RequiredButtons;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Minimum))
|
|
||||||
Minimum = newItem.Minimum;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Maximum))
|
|
||||||
Maximum = newItem.Maximum;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Sensitivity))
|
|
||||||
Sensitivity = newItem.Sensitivity;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_KeyDelta))
|
|
||||||
KeyDelta = newItem.KeyDelta;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Reverse))
|
|
||||||
Reverse = newItem.Reverse;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Ways))
|
|
||||||
Ways = newItem.Ways;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Ways2))
|
|
||||||
Ways2 = newItem.Ways2;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Control_Ways3))
|
|
||||||
Ways3 = newItem.Ways3;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -630,25 +630,6 @@ namespace SabreTools.DatItems
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Replace fields from another item
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">DatItem to pull new information from</param>
|
|
||||||
/// <param name="datItemFields">DatItem fields to remove</param>
|
|
||||||
/// <param name="machineFields">Machine fields to remove</param>
|
|
||||||
/// TODO: Fix case where datItemFields is null
|
|
||||||
public virtual void ReplaceFields(
|
|
||||||
DatItem item,
|
|
||||||
List<DatItemField> datItemFields,
|
|
||||||
List<MachineField> machineFields)
|
|
||||||
{
|
|
||||||
if (Machine == null)
|
|
||||||
Machine = new Machine();
|
|
||||||
|
|
||||||
// TODO: Figure out why this wasn't here
|
|
||||||
// Machine.ReplaceFields(item.Machine, machineFields)
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion // Instance Methods
|
#endregion // Instance Methods
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -118,39 +117,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 DataArea to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.DataArea)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
DataArea newItem = item as DataArea;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.AreaName))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.AreaSize))
|
|
||||||
Size = newItem.Size;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.AreaWidth))
|
|
||||||
Width = newItem.Width;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.AreaEndianness))
|
|
||||||
Endianness = newItem.Endianness;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,50 +159,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Device to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Device)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Device newItem = item as Device;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.DeviceType))
|
|
||||||
DeviceType = newItem.DeviceType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Tag))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.FixedImage))
|
|
||||||
FixedImage = newItem.FixedImage;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Mandatory))
|
|
||||||
Mandatory = newItem.Mandatory;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Interface))
|
|
||||||
Interface = newItem.Interface;
|
|
||||||
|
|
||||||
// DatItem_Instance_* doesn't make sense here
|
|
||||||
// since not every instance under the other item
|
|
||||||
// can replace every instance under this item
|
|
||||||
|
|
||||||
// DatItem_Extension_* doesn't make sense here
|
|
||||||
// since not every extension under the other item
|
|
||||||
// can replace every extension under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -81,30 +80,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 DeviceReference to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.DeviceReference)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
DeviceReference newItem = item as DeviceReference;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,60 +195,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
@@ -402,72 +401,6 @@ namespace SabreTools.DatItems
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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 Disk to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Disk)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Disk newItem = item as Disk;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
|
|
||||||
#region Common
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.MD5))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(MD5) && !string.IsNullOrEmpty(newItem.MD5))
|
|
||||||
MD5 = newItem.MD5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA1))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA1) && !string.IsNullOrEmpty(newItem.SHA1))
|
|
||||||
SHA1 = newItem.SHA1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Merge))
|
|
||||||
MergeTag = newItem.MergeTag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Region))
|
|
||||||
Region = newItem.Region;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Index))
|
|
||||||
Index = newItem.Index;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Writable))
|
|
||||||
Writable = newItem.Writable;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Status))
|
|
||||||
ItemStatus = newItem.ItemStatus;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Optional))
|
|
||||||
Optional = newItem.Optional;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SoftwareList
|
|
||||||
|
|
||||||
if (DiskAreaSpecified && newItem.DiskAreaSpecified)
|
|
||||||
DiskArea.ReplaceFields(newItem.DiskArea, datItemFields, machineFields);
|
|
||||||
|
|
||||||
if (PartSpecified && newItem.PartSpecified)
|
|
||||||
Part.ReplaceFields(newItem.Part, datItemFields, machineFields);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -82,30 +81,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 DiskArea to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.DiskArea)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
DiskArea newItem = item as DiskArea;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.AreaName))
|
|
||||||
Name = newItem.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -228,69 +227,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Display to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Display)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Display newItem = item as Display;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Tag))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.DisplayType))
|
|
||||||
DisplayType = newItem.DisplayType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Rotate))
|
|
||||||
Rotate = newItem.Rotate;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.FlipX))
|
|
||||||
FlipX = newItem.FlipX;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Width))
|
|
||||||
Width = newItem.Width;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Height))
|
|
||||||
Height = newItem.Height;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Refresh))
|
|
||||||
Refresh = newItem.Refresh;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.PixClock))
|
|
||||||
PixClock = newItem.PixClock;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.HTotal))
|
|
||||||
HTotal = newItem.HTotal;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.HBEnd))
|
|
||||||
HBEnd = newItem.HBEnd;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.HBStart))
|
|
||||||
HBStart = newItem.HBStart;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.VTotal))
|
|
||||||
VTotal = newItem.VTotal;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.VBEnd))
|
|
||||||
VBEnd = newItem.VBEnd;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.VBStart))
|
|
||||||
VBStart = newItem.VBStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -114,39 +113,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Driver to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Driver)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Driver newItem = item as Driver;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.SupportStatus))
|
|
||||||
Status = newItem.Status;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.EmulationStatus))
|
|
||||||
Emulation = newItem.Emulation;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.CocktailStatus))
|
|
||||||
Cocktail = newItem.Cocktail;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SaveStateStatus))
|
|
||||||
SaveState = newItem.SaveState;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -81,30 +80,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Extension to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Extension)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Extension newItem = item as Extension;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Extension_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -99,36 +98,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Feature to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Feature)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Feature newItem = item as Feature;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.FeatureType))
|
|
||||||
Type = newItem.Type;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.FeatureStatus))
|
|
||||||
Status = newItem.Status;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.FeatureOverall))
|
|
||||||
Overall = newItem.Overall;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -89,33 +88,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Info to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Info)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Info newItem = item as Info;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,43 +133,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Input to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Input)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Input newItem = item as Input;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Service))
|
|
||||||
Service = newItem.Service;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Tilt))
|
|
||||||
Tilt = newItem.Tilt;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Players))
|
|
||||||
Players = newItem.Players;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Coins))
|
|
||||||
Coins = newItem.Coins;
|
|
||||||
|
|
||||||
// DatItem_Control_* doesn't make sense here
|
|
||||||
// since not every control under the other item
|
|
||||||
// can replace every control under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -89,33 +88,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Instance to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Instance)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Instance newItem = item as Instance;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Instance_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Instance_BriefName))
|
|
||||||
BriefName = newItem.BriefName;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -105,36 +104,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Location to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Location)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Location newItem = item as Location;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Location_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Location_Number))
|
|
||||||
Number = newItem.Number;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Location_Inverted))
|
|
||||||
Inverted = newItem.Inverted;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Text;
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
@@ -333,51 +332,6 @@ namespace SabreTools.DatItems
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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 Media to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Media)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Media newItem = item as Media;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.MD5))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(MD5) && !string.IsNullOrEmpty(newItem.MD5))
|
|
||||||
MD5 = newItem.MD5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA1))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA1) && !string.IsNullOrEmpty(newItem.SHA1))
|
|
||||||
SHA1 = newItem.SHA1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA256))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA256) && !string.IsNullOrEmpty(newItem.SHA256))
|
|
||||||
SHA256 = newItem.SHA256;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SpamSum))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SpamSum) && !string.IsNullOrEmpty(newItem.SpamSum))
|
|
||||||
SpamSum = newItem.SpamSum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,37 +106,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Part to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Part)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Part newItem = item as Part;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Part_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Part_Interface))
|
|
||||||
Interface = newItem.Interface;
|
|
||||||
|
|
||||||
// DatItem_Part_Feature_* doesn't make sense here
|
|
||||||
// since not every part feature under the other item
|
|
||||||
// can replace every part feature under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -89,33 +88,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 PartFeature to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.PartFeature)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
PartFeature newItem = item as PartFeature;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Part_Feature_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Part_Feature_Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,34 +94,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Port to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Port)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Port newItem = item as Port;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Tag = newItem.Tag;
|
|
||||||
|
|
||||||
// DatItem_Analog_* doesn't make sense here
|
|
||||||
// since not every analog under the other item
|
|
||||||
// can replace every analog under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -100,36 +99,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 RamOption to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.RamOption)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
RamOption newItem = item as RamOption;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Content))
|
|
||||||
Content = newItem.Content;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -124,42 +123,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Release to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Release)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Release newItem = item as Release;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Region))
|
|
||||||
Region = newItem.Region;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Language))
|
|
||||||
Language = newItem.Language;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Date))
|
|
||||||
Date = newItem.Date;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
@@ -729,154 +728,6 @@ namespace SabreTools.DatItems
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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 Rom to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Rom)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Rom newItem = item as Rom;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
|
|
||||||
#region Common
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Bios))
|
|
||||||
Bios = newItem.Bios;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Size))
|
|
||||||
Size = newItem.Size;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.CRC))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(CRC) && !string.IsNullOrEmpty(newItem.CRC))
|
|
||||||
CRC = newItem.CRC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.MD5))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(MD5) && !string.IsNullOrEmpty(newItem.MD5))
|
|
||||||
MD5 = newItem.MD5;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if NET_FRAMEWORK
|
|
||||||
if (datItemFields.Contains(DatItemField.RIPEMD160))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(RIPEMD160) && !string.IsNullOrEmpty(newItem.RIPEMD160))
|
|
||||||
RIPEMD160 = newItem.RIPEMD160;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA1))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA1) && !string.IsNullOrEmpty(newItem.SHA1))
|
|
||||||
SHA1 = newItem.SHA1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA256))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA256) && !string.IsNullOrEmpty(newItem.SHA256))
|
|
||||||
SHA256 = newItem.SHA256;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA384))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA384) && !string.IsNullOrEmpty(newItem.SHA384))
|
|
||||||
SHA384 = newItem.SHA384;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SHA512))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SHA512) && !string.IsNullOrEmpty(newItem.SHA512))
|
|
||||||
SHA512 = newItem.SHA512;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SpamSum))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SpamSum) && !string.IsNullOrEmpty(newItem.SpamSum))
|
|
||||||
SpamSum = newItem.SpamSum;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Merge))
|
|
||||||
MergeTag = newItem.MergeTag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Region))
|
|
||||||
Region = newItem.Region;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Offset))
|
|
||||||
Offset = newItem.Offset;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Date))
|
|
||||||
Date = newItem.Date;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Status))
|
|
||||||
ItemStatus = newItem.ItemStatus;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Optional))
|
|
||||||
Optional = newItem.Optional;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Inverted))
|
|
||||||
Inverted = newItem.Inverted;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region AttractMode
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.AltName))
|
|
||||||
AltName = newItem.AltName;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.AltTitle))
|
|
||||||
AltTitle = newItem.AltTitle;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region OpenMSX
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Original))
|
|
||||||
Original = newItem.Original;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.OpenMSXSubType))
|
|
||||||
OpenMSXSubType = newItem.OpenMSXSubType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.OpenMSXType))
|
|
||||||
OpenMSXType = newItem.OpenMSXType;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Remark))
|
|
||||||
Remark = newItem.Remark;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Boot))
|
|
||||||
Boot = newItem.Boot;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SoftwareList
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.LoadFlag))
|
|
||||||
LoadFlag = newItem.LoadFlag;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
|
|
||||||
if (DataAreaSpecified && newItem.DataAreaSpecified)
|
|
||||||
DataArea.ReplaceFields(newItem.DataArea, datItemFields, machineFields);
|
|
||||||
|
|
||||||
if (PartSpecified && newItem.PartSpecified)
|
|
||||||
Part.ReplaceFields(newItem.Part, datItemFields, machineFields);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -81,30 +80,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Sample to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Sample)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Sample newItem = item as Sample;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,40 +126,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Setting to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Setting)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Setting newItem = item as Setting;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Setting_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Setting_Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Setting_Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
|
|
||||||
// DatItem_Condition_* doesn't make sense here
|
|
||||||
// since not every condition under the other item
|
|
||||||
// can replace every condition under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -89,33 +88,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 SharedFeature to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.SharedFeature)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
SharedFeature newItem = item as SharedFeature;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Value))
|
|
||||||
Value = newItem.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,34 +105,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Slot to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Slot)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Slot newItem = item as Slot;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
// DatItem_SlotOption_* doesn't make sense here
|
|
||||||
// since not every slot option under the other item
|
|
||||||
// can replace every slot option under this item
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -102,36 +101,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 SlotOption to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.SlotOption)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
SlotOption newItem = item as SlotOption;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.SlotOption_Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SlotOption_DeviceName))
|
|
||||||
DeviceName = newItem.DeviceName;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SlotOption_Default))
|
|
||||||
Default = newItem.Default;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
@@ -106,36 +103,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 SoftwareList to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.SoftwareList)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
SoftwareList newItem = item as SoftwareList;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Name))
|
|
||||||
Name = newItem.Name;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.SoftwareListStatus))
|
|
||||||
Status = newItem.Status;
|
|
||||||
|
|
||||||
if (datItemFields.Contains(DatItemField.Filter))
|
|
||||||
Filter = newItem.Filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -73,30 +72,5 @@ namespace SabreTools.DatItems
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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 Sound to replace from, ignore specific fields
|
|
||||||
if (item.ItemType != ItemType.Sound)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Cast for easier access
|
|
||||||
Sound newItem = item as Sound;
|
|
||||||
|
|
||||||
// Replace the fields
|
|
||||||
if (datItemFields.Contains(DatItemField.Channels))
|
|
||||||
Channels = newItem.Channels;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace SabreTools.DatTools
|
|||||||
|
|
||||||
// Replace fields from the first duplicate, if we have one
|
// Replace fields from the first duplicate, if we have one
|
||||||
if (dupes.Count > 0)
|
if (dupes.Count > 0)
|
||||||
newDatItem.ReplaceFields(dupes.First(), datItemFields, null);
|
DatItemTool.ReplaceFields(newDatItem, dupes.First(), datItemFields);
|
||||||
|
|
||||||
newDatItems.Add(newDatItem);
|
newDatItems.Add(newDatItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the item name back
|
// Set the item name back
|
||||||
DatItemTool.SetFields(datItem, new Dictionary<DatItemField, string> { [DatItemField.Name] = itemName });
|
datItem.SetName(itemName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user