mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add filter execution at the DAT level
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET452_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
|
||||
namespace SabreTools.Core
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
@@ -173,7 +175,17 @@ namespace SabreTools.DatFiles
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// TODO: Implement filtering
|
||||
// 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
|
||||
|
||||
@@ -5,7 +5,9 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
@@ -2,7 +2,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles;
|
||||
|
||||
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.IO;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using Compress.Support.Compression.LZMA;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
|
||||
@@ -7,7 +7,9 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatFiles;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#endif
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(datdata);
|
||||
Splitter.ApplySplitting(datdata, useTags: false);
|
||||
Filter.ApplyFilters(datdata);
|
||||
//FilterRunner.Run(datdata); // TODO: Create helper method to run over entire DAT
|
||||
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(datdata);
|
||||
Remover.ApplyRemovals(datdata);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles;
|
||||
using SabreTools.DatTools;
|
||||
@@ -173,6 +172,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(datFile);
|
||||
Splitter.ApplySplitting(datFile, useTags: false);
|
||||
Filter.ApplyFilters(datFile);
|
||||
// datFile.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(datFile);
|
||||
Remover.ApplyRemovals(datFile);
|
||||
|
||||
@@ -216,6 +216,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(userInputDat);
|
||||
Splitter.ApplySplitting(userInputDat, useTags: false);
|
||||
Filter.ApplyFilters(userInputDat);
|
||||
// userInputDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(userInputDat);
|
||||
Remover.ApplyRemovals(userInputDat);
|
||||
|
||||
@@ -345,6 +346,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(repDat);
|
||||
Splitter.ApplySplitting(repDat, useTags: false);
|
||||
Filter.ApplyFilters(repDat);
|
||||
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(repDat);
|
||||
Remover.ApplyRemovals(repDat);
|
||||
|
||||
@@ -381,6 +383,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(repDat);
|
||||
Splitter.ApplySplitting(repDat, useTags: false);
|
||||
Filter.ApplyFilters(repDat);
|
||||
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(repDat);
|
||||
Remover.ApplyRemovals(repDat);
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(datdata);
|
||||
Splitter.ApplySplitting(datdata, useTags: true);
|
||||
Filter.ApplyFilters(datdata);
|
||||
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(datdata);
|
||||
Remover.ApplyRemovals(datdata);
|
||||
|
||||
@@ -116,6 +117,7 @@ namespace SabreTools.Features
|
||||
Extras.ApplyExtras(datdata);
|
||||
Splitter.ApplySplitting(datdata, useTags: true);
|
||||
Filter.ApplyFilters(datdata);
|
||||
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||
Cleaner.ApplyCleaning(datdata);
|
||||
Remover.ApplyRemovals(datdata);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user