mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make remover a little more consistent
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SabreTools.Core;
|
||||
@@ -56,8 +57,6 @@ namespace SabreTools.Filtering
|
||||
/// <param name="fields">List of field names</param>
|
||||
public void PopulateExclusionsFromList(List<string> fields)
|
||||
{
|
||||
InternalStopwatch watch = new InternalStopwatch("Populating removals from list");
|
||||
|
||||
// Instantiate the removers, if necessary
|
||||
DatHeaderRemover ??= new DatHeaderRemover();
|
||||
DatItemRemover ??= new DatItemRemover();
|
||||
@@ -66,6 +65,8 @@ namespace SabreTools.Filtering
|
||||
if (fields == null || fields.Count == 0)
|
||||
return;
|
||||
|
||||
InternalStopwatch watch = new InternalStopwatch("Populating removals from list");
|
||||
|
||||
foreach (string field in fields)
|
||||
{
|
||||
// If we don't even have a possible field name
|
||||
@@ -104,11 +105,11 @@ namespace SabreTools.Filtering
|
||||
InternalStopwatch watch = new InternalStopwatch("Applying removals to DAT");
|
||||
|
||||
// Remove DatHeader fields
|
||||
if (DatHeaderRemover != null)
|
||||
if (DatHeaderRemover != null && DatHeaderRemover.DatHeaderFields.Any())
|
||||
DatHeaderRemover.RemoveFields(datFile.Header);
|
||||
|
||||
// Remove DatItem and Machine fields
|
||||
if (DatItemRemover != null)
|
||||
if (DatItemRemover != null && (DatItemRemover.MachineFields.Any() || DatItemRemover.DatItemFields.Any()))
|
||||
{
|
||||
Parallel.ForEach(datFile.Items.Keys, Globals.ParallelOptions, key =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user