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;
|
using System;
|
||||||
|
#if NET452_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace SabreTools.Core
|
namespace SabreTools.Core
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
@@ -173,7 +175,17 @@ namespace SabreTools.DatFiles
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#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
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ using System.Collections.Concurrent;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.IO;
|
using SabreTools.IO;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using Compress.Support.Compression.LZMA;
|
using Compress.Support.Compression.LZMA;
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(datdata);
|
Extras.ApplyExtras(datdata);
|
||||||
Splitter.ApplySplitting(datdata, useTags: false);
|
Splitter.ApplySplitting(datdata, useTags: false);
|
||||||
Filter.ApplyFilters(datdata);
|
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);
|
Cleaner.ApplyCleaning(datdata);
|
||||||
Remover.ApplyRemovals(datdata);
|
Remover.ApplyRemovals(datdata);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatTools;
|
using SabreTools.DatTools;
|
||||||
@@ -173,6 +172,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(datFile);
|
Extras.ApplyExtras(datFile);
|
||||||
Splitter.ApplySplitting(datFile, useTags: false);
|
Splitter.ApplySplitting(datFile, useTags: false);
|
||||||
Filter.ApplyFilters(datFile);
|
Filter.ApplyFilters(datFile);
|
||||||
|
// datFile.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(datFile);
|
Cleaner.ApplyCleaning(datFile);
|
||||||
Remover.ApplyRemovals(datFile);
|
Remover.ApplyRemovals(datFile);
|
||||||
|
|
||||||
@@ -216,6 +216,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(userInputDat);
|
Extras.ApplyExtras(userInputDat);
|
||||||
Splitter.ApplySplitting(userInputDat, useTags: false);
|
Splitter.ApplySplitting(userInputDat, useTags: false);
|
||||||
Filter.ApplyFilters(userInputDat);
|
Filter.ApplyFilters(userInputDat);
|
||||||
|
// userInputDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(userInputDat);
|
Cleaner.ApplyCleaning(userInputDat);
|
||||||
Remover.ApplyRemovals(userInputDat);
|
Remover.ApplyRemovals(userInputDat);
|
||||||
|
|
||||||
@@ -345,6 +346,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(repDat);
|
Extras.ApplyExtras(repDat);
|
||||||
Splitter.ApplySplitting(repDat, useTags: false);
|
Splitter.ApplySplitting(repDat, useTags: false);
|
||||||
Filter.ApplyFilters(repDat);
|
Filter.ApplyFilters(repDat);
|
||||||
|
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(repDat);
|
Cleaner.ApplyCleaning(repDat);
|
||||||
Remover.ApplyRemovals(repDat);
|
Remover.ApplyRemovals(repDat);
|
||||||
|
|
||||||
@@ -381,6 +383,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(repDat);
|
Extras.ApplyExtras(repDat);
|
||||||
Splitter.ApplySplitting(repDat, useTags: false);
|
Splitter.ApplySplitting(repDat, useTags: false);
|
||||||
Filter.ApplyFilters(repDat);
|
Filter.ApplyFilters(repDat);
|
||||||
|
// repDat.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(repDat);
|
Cleaner.ApplyCleaning(repDat);
|
||||||
Remover.ApplyRemovals(repDat);
|
Remover.ApplyRemovals(repDat);
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(datdata);
|
Extras.ApplyExtras(datdata);
|
||||||
Splitter.ApplySplitting(datdata, useTags: true);
|
Splitter.ApplySplitting(datdata, useTags: true);
|
||||||
Filter.ApplyFilters(datdata);
|
Filter.ApplyFilters(datdata);
|
||||||
|
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(datdata);
|
Cleaner.ApplyCleaning(datdata);
|
||||||
Remover.ApplyRemovals(datdata);
|
Remover.ApplyRemovals(datdata);
|
||||||
|
|
||||||
@@ -116,6 +117,7 @@ namespace SabreTools.Features
|
|||||||
Extras.ApplyExtras(datdata);
|
Extras.ApplyExtras(datdata);
|
||||||
Splitter.ApplySplitting(datdata, useTags: true);
|
Splitter.ApplySplitting(datdata, useTags: true);
|
||||||
Filter.ApplyFilters(datdata);
|
Filter.ApplyFilters(datdata);
|
||||||
|
// datdata.ExecuteFilters(FilterRunner); // TODO: Replace Filter.ApplyFilters with this
|
||||||
Cleaner.ApplyCleaning(datdata);
|
Cleaner.ApplyCleaning(datdata);
|
||||||
Remover.ApplyRemovals(datdata);
|
Remover.ApplyRemovals(datdata);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user