mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-08 18:06:34 +00:00
Remove remaining unncessary Concurrent usings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> FLEXNetCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> FLEXNetDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
internal IEnumerable<string> FLEXNetCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a range of values from one queue to another
|
||||
/// </summary>
|
||||
/// <param name="original">Queue to add data to</param>
|
||||
/// <param name="values">Queue to get data from</param>
|
||||
private void AddRangeToKey(string key, IEnumerable<string> values)
|
||||
{
|
||||
if (values == null || !values.Any())
|
||||
return;
|
||||
|
||||
foreach (string value in values)
|
||||
{
|
||||
this[key].Enqueue(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure the collection for the given key exists
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Add a range of values from one queue to another
|
||||
/// </summary>
|
||||
/// <param name="original">Queue to add data to</param>
|
||||
/// <param name="values">Array to get data from</param>
|
||||
#if NET20 || NET35
|
||||
public static void AddRange(this Queue<string> original, string[] values)
|
||||
#else
|
||||
public static void AddRange(this ConcurrentQueue<string> original, string[] values)
|
||||
#endif
|
||||
{
|
||||
if (values == null || values.Length == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
original.Enqueue(values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a range of values from one queue to another
|
||||
/// </summary>
|
||||
/// <param name="original">Queue to add data to</param>
|
||||
/// <param name="values">Queue to get data from</param>
|
||||
#if NET20 || NET35
|
||||
public static void AddRange(this Queue<string> original, IEnumerable<string> values)
|
||||
#else
|
||||
public static void AddRange(this ConcurrentQueue<string> original, IEnumerable<string> values)
|
||||
#endif
|
||||
{
|
||||
if (values == null || !values.Any())
|
||||
return;
|
||||
|
||||
foreach (string value in values)
|
||||
{
|
||||
original.Enqueue(value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user