Consolidate removal code

This commit is contained in:
Matt Nadareski
2024-03-05 16:37:52 -05:00
parent fa99e6aefb
commit d43a275f8c
52 changed files with 424 additions and 1266 deletions

View File

@@ -392,19 +392,28 @@ namespace SabreTools.DatItems
/// <summary>
/// Remove a field from the DatItem
/// </summary>
/// <param name="datItemField">Item field to remove</param>
/// <param name="fieldName">Field to remove</param>
/// <returns>True if the removal was successful, false otherwise</returns>
public abstract bool RemoveField(DatItemField datItemField);
public bool RemoveField(string? fieldName) => FieldManipulator.RemoveField(_internal, fieldName);
/// <summary>
/// Set a field in the DatItem from a mapping string
/// </summary>
/// <param name="machineField">Item field to set</param>
/// <param name="fieldName">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);
/// <summary>
/// Set a field in the DatItem from a mapping string
/// </summary>
/// <param name="fieldName">Field to set</param>
/// <param name="value">String representing the value to set</param>
/// <returns>True if the removal was successful, false otherwise</returns>
/// <remarks>This only performs minimal validation before setting</remarks>
public bool SetField(string? fieldName, string value) => FieldManipulator.SetField(_internal, fieldName, value);
#endregion
#region Sorting and Merging