diff --git a/SabreTools.Core/Globals.cs b/SabreTools.Core/Globals.cs index e8348736..f519e0fb 100644 --- a/SabreTools.Core/Globals.cs +++ b/SabreTools.Core/Globals.cs @@ -1,5 +1,7 @@ using System; +#if NET452_OR_GREATER || NETCOREAPP using System.Threading.Tasks; +#endif namespace SabreTools.Core { diff --git a/SabreTools.DatFiles/DatFile.cs b/SabreTools.DatFiles/DatFile.cs index f230b8af..9e2799ea 100644 --- a/SabreTools.DatFiles/DatFile.cs +++ b/SabreTools.DatFiles/DatFile.cs @@ -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(); + 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 diff --git a/SabreTools.DatFiles/ItemDictionary.cs b/SabreTools.DatFiles/ItemDictionary.cs index 2fb2a8f3..77efed88 100644 --- a/SabreTools.DatFiles/ItemDictionary.cs +++ b/SabreTools.DatFiles/ItemDictionary.cs @@ -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; diff --git a/SabreTools.DatTools/DatFileTool.cs b/SabreTools.DatTools/DatFileTool.cs index 8fac61dd..d5b53263 100644 --- a/SabreTools.DatTools/DatFileTool.cs +++ b/SabreTools.DatTools/DatFileTool.cs @@ -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; diff --git a/SabreTools.DatTools/DatFromDir.cs b/SabreTools.DatTools/DatFromDir.cs index d6f3bd12..0de6541e 100644 --- a/SabreTools.DatTools/DatFromDir.cs +++ b/SabreTools.DatTools/DatFromDir.cs @@ -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; diff --git a/SabreTools.DatTools/Rebuilder.cs b/SabreTools.DatTools/Rebuilder.cs index 7c03fb5d..b6961489 100644 --- a/SabreTools.DatTools/Rebuilder.cs +++ b/SabreTools.DatTools/Rebuilder.cs @@ -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; diff --git a/SabreTools.DatTools/Splitter.cs b/SabreTools.DatTools/Splitter.cs index b2c68b29..8a7c3ec7 100644 --- a/SabreTools.DatTools/Splitter.cs +++ b/SabreTools.DatTools/Splitter.cs @@ -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; diff --git a/SabreTools.DatTools/Statistics.cs b/SabreTools.DatTools/Statistics.cs index b20c9858..dcb236c5 100644 --- a/SabreTools.DatTools/Statistics.cs +++ b/SabreTools.DatTools/Statistics.cs @@ -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; diff --git a/SabreTools.DatTools/Writer.cs b/SabreTools.DatTools/Writer.cs index 321c2b00..20c8c9e8 100644 --- a/SabreTools.DatTools/Writer.cs +++ b/SabreTools.DatTools/Writer.cs @@ -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; diff --git a/SabreTools.FileTypes/BaseFile.cs b/SabreTools.FileTypes/BaseFile.cs index 6b98f3c9..73189281 100644 --- a/SabreTools.FileTypes/BaseFile.cs +++ b/SabreTools.FileTypes/BaseFile.cs @@ -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; diff --git a/SabreTools.Filtering/Cleaner.cs b/SabreTools.Filtering/Cleaner.cs index 6256a4bf..223a10c1 100644 --- a/SabreTools.Filtering/Cleaner.cs +++ b/SabreTools.Filtering/Cleaner.cs @@ -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; diff --git a/SabreTools.Filtering/Remover.cs b/SabreTools.Filtering/Remover.cs index 10fd852d..271cfdab 100644 --- a/SabreTools.Filtering/Remover.cs +++ b/SabreTools.Filtering/Remover.cs @@ -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; diff --git a/SabreTools/Features/DatFromDir.cs b/SabreTools/Features/DatFromDir.cs index d1ea12c7..86337ce1 100644 --- a/SabreTools/Features/DatFromDir.cs +++ b/SabreTools/Features/DatFromDir.cs @@ -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); diff --git a/SabreTools/Features/Update.cs b/SabreTools/Features/Update.cs index 39e9a499..73053815 100644 --- a/SabreTools/Features/Update.cs +++ b/SabreTools/Features/Update.cs @@ -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); diff --git a/SabreTools/Features/Verify.cs b/SabreTools/Features/Verify.cs index bdaf2ba6..8879343a 100644 --- a/SabreTools/Features/Verify.cs +++ b/SabreTools/Features/Verify.cs @@ -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);