mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move field replacement
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Permissions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
@@ -135,5 +134,34 @@ namespace SabreTools.Library.DatItems
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="updateFields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> updateFields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, updateFields);
|
||||
|
||||
// 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 (updateFields.Contains(Field.BiosDescription))
|
||||
Description = newItem.Description;
|
||||
|
||||
if (updateFields.Contains(Field.Default))
|
||||
Default = newItem.Default;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user