diff --git a/BinaryObjectScanner/Protection/AegiSoft.cs b/BinaryObjectScanner/Protection/AegiSoft.cs index 558ba207..f74fb07c 100644 --- a/BinaryObjectScanner/Protection/AegiSoft.cs +++ b/BinaryObjectScanner/Protection/AegiSoft.cs @@ -1,7 +1,4 @@ -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; diff --git a/BinaryObjectScanner/Protection/AlphaDVD.cs b/BinaryObjectScanner/Protection/AlphaDVD.cs index c7c52b33..7653feb3 100644 --- a/BinaryObjectScanner/Protection/AlphaDVD.cs +++ b/BinaryObjectScanner/Protection/AlphaDVD.cs @@ -1,7 +1,4 @@ -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif -using System.Collections.Generic; +using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; using SabreTools.Matching.Paths; diff --git a/BinaryObjectScanner/Protection/Macrovision.FLEXnet.cs b/BinaryObjectScanner/Protection/Macrovision.FLEXnet.cs index d05b8dfa..7aeccfcd 100644 --- a/BinaryObjectScanner/Protection/Macrovision.FLEXnet.cs +++ b/BinaryObjectScanner/Protection/Macrovision.FLEXnet.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.Linq; using SabreTools.Matching; @@ -72,11 +69,7 @@ namespace BinaryObjectScanner.Protection } /// -#if NET20 || NET35 - internal Queue FLEXNetCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue FLEXNetDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable FLEXNetCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/ProtectionDictionary.cs b/BinaryObjectScanner/ProtectionDictionary.cs index d0ec9c89..f11e3141 100644 --- a/BinaryObjectScanner/ProtectionDictionary.cs +++ b/BinaryObjectScanner/ProtectionDictionary.cs @@ -5,7 +5,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; -using BinaryObjectScanner.Utilities; namespace BinaryObjectScanner { @@ -41,7 +40,7 @@ namespace BinaryObjectScanner // Add the key if needed and then append the lists EnsureKey(key); - this[key].AddRange(values); + AddRangeToKey(key, values); } /// @@ -56,7 +55,7 @@ namespace BinaryObjectScanner // Add the key if needed and then append the lists EnsureKey(key); - this[key].AddRange(values); + AddRangeToKey(key, values); } /// @@ -73,7 +72,7 @@ namespace BinaryObjectScanner foreach (string key in addition.Keys) { EnsureKey(key); - this[key].AddRange(addition[key]); + AddRangeToKey(key, addition[key]); } } @@ -164,6 +163,22 @@ namespace BinaryObjectScanner } } + /// + /// Add a range of values from one queue to another + /// + /// Queue to add data to + /// Queue to get data from + private void AddRangeToKey(string key, IEnumerable values) + { + if (values == null || !values.Any()) + return; + + foreach (string value in values) + { + this[key].Enqueue(value); + } + } + /// /// Ensure the collection for the given key exists /// diff --git a/BinaryObjectScanner/Utilities/Extensions.cs b/BinaryObjectScanner/Utilities/Extensions.cs deleted file mode 100644 index a40795f6..00000000 --- a/BinaryObjectScanner/Utilities/Extensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif -using System.Collections.Generic; -using System.Linq; - -namespace BinaryObjectScanner.Utilities -{ - public static class Extensions - { - #region ConcurrentQueue - - /// - /// Add a range of values from one queue to another - /// - /// Queue to add data to - /// Array to get data from -#if NET20 || NET35 - public static void AddRange(this Queue original, string[] values) -#else - public static void AddRange(this ConcurrentQueue original, string[] values) -#endif - { - if (values == null || values.Length == 0) - return; - - for (int i = 0; i < values.Length; i++) - { - original.Enqueue(values[i]); - } - } - - /// - /// Add a range of values from one queue to another - /// - /// Queue to add data to - /// Queue to get data from -#if NET20 || NET35 - public static void AddRange(this Queue original, IEnumerable values) -#else - public static void AddRange(this ConcurrentQueue original, IEnumerable values) -#endif - { - if (values == null || !values.Any()) - return; - - foreach (string value in values) - { - original.Enqueue(value); - } - } - - #endregion - } -} \ No newline at end of file