Files
SabreTools/SabreTools.Filtering/DatHeaderRemover.cs
Matt Nadareski a82b7ccab8 Remover code to own class
This was the last of the major bits of code that was technically distinct from Cleaning. This means that each of the bits of functionality that used to all be in Cleaner are split out into their approrpriate classes.
2021-02-01 12:11:32 -08:00

72 lines
1.8 KiB
C#

using System.Collections.Generic;
using SabreTools.Core;
using SabreTools.Core.Tools;
using SabreTools.DatFiles;
using SabreTools.Logging;
namespace SabreTools.Filtering
{
/// <summary>
/// Represents the removal operations that need to be performed on a DatHeader
/// </summary>
public class DatHeaderRemover
{
#region Fields
/// <summary>
/// List of DatHeader fields to exclude from writing
/// </summary>
public List<DatHeaderField> DatHeaderFields { get; private set; } = new List<DatHeaderField>();
#endregion
#region Population
/// <summary>
/// Set remover from a value
/// </summary>
/// <param name="field">Key for the remover to be set</param>
public bool SetRemover(string field)
{
// If the key is null or empty, return false
if (string.IsNullOrWhiteSpace(field))
return false;
// If we have a DatHeader field
DatHeaderField datHeaderField = field.AsDatHeaderField();
if (datHeaderField != DatHeaderField.NULL)
{
DatHeaderFields.Add(datHeaderField);
return true;
}
return false;
}
#endregion
#region Running
/// <summary>
/// Remove fields with given values
/// </summary>
/// <param name="datItem">DatHeader to remove fields from</param>
public void RemoveFields(DatHeader datHeader)
{
if (datHeader == null)
return;
#region Common
if (DatHeaderFields == null)
return;
#endregion
// TODO: Figure out how to properly implement DatHeader field removal
}
#endregion
}
}