mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make ItemDictionary responsible for running filters on itself
This commit is contained in:
@@ -158,41 +158,7 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="filterRunner">Preconfigured filter runner to use</param>
|
||||
public void ExecuteFilters(FilterRunner filterRunner)
|
||||
{
|
||||
List<string> keys = [.. Items.Keys];
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
Parallel.ForEach(keys, Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
Parallel.ForEach(keys, key =>
|
||||
#else
|
||||
foreach (var key in keys)
|
||||
#endif
|
||||
{
|
||||
ConcurrentList<DatItem>? items = Items[key];
|
||||
if (items == null)
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
return;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// Filter all items in the current key
|
||||
var newItems = new ConcurrentList<DatItem>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.PassesFilter(filterRunner))
|
||||
newItems.Add(item);
|
||||
}
|
||||
|
||||
// Set the value in the key to the new set
|
||||
Items[key] = newItems;
|
||||
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
});
|
||||
#else
|
||||
}
|
||||
#endif
|
||||
}
|
||||
=> Items.ExecuteFilters(filterRunner);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user