Use List where possible

This commit is contained in:
Matt Nadareski
2024-11-20 17:10:03 -05:00
parent cf62be365c
commit 7122aa44a1
65 changed files with 69 additions and 66 deletions

View File

@@ -14,9 +14,9 @@ namespace BinaryObjectScanner.Interfaces
/// Check a file path for protections based on path name
/// </summary>
/// <param name="path">Path to check for protection indicators</param>
/// <param name="files">Enumerable of strings representing files in a directory</param>
/// <param name="files">List of strings representing files in a directory</param>
/// <remarks>This can do some limited content checking as well, but it's suggested to use a content check instead, if possible</remarks>
List<string> CheckDirectoryPath(string path, IEnumerable<string>? files);
List<string> CheckDirectoryPath(string path, List<string>? files);
/// <summary>
/// Check a file path for protections based on path name

View File

@@ -68,7 +68,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -16,7 +16,7 @@ namespace BinaryObjectScanner.Protection
public class AlphaDVD : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -13,7 +13,7 @@ namespace BinaryObjectScanner.Protection
public class Bitpool : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -130,7 +130,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// TODO: Investigate reference to "bbz650.tmp" in "Byteshield.dll" (Redump entry 6236)
// Files with the ".bbz" extension are associated with ByteShield, but the extenstion is known to be used in other places as well.

View File

@@ -182,7 +182,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// TODO: Original had "CDCOPS.DLL" required and all the rest in a combined OR
var matchers = new List<PathMatchSet>

View File

@@ -54,7 +54,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -62,7 +62,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -17,7 +17,7 @@ namespace BinaryObjectScanner.Protection
public class CDProtector : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection
public class CDX : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// TODO: Verify if these are OR or AND
var matchers = new List<PathMatchSet>

View File

@@ -53,7 +53,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -61,7 +61,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -53,7 +53,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -36,7 +36,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// Previous versions of BOS noted to look at ".PFF" files as possible indicators of CopyKiller, but those files seem unrelated.
// TODO: Figure out why this doesn't work.

View File

@@ -93,7 +93,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var protections = new List<string>();
if (files == null)

View File

@@ -73,7 +73,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -8,7 +8,7 @@ namespace BinaryObjectScanner.Protection
public class DVDCrypt : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -9,7 +9,7 @@ namespace BinaryObjectScanner.Protection
public class DVDMoviePROTECT : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var protections = new List<string>();
if (files == null)

View File

@@ -263,7 +263,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -52,7 +52,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -22,7 +22,7 @@ namespace BinaryObjectScanner.Protection
// https://www.gamecopyworld.com/games/pc_pc_calcio_2000.shtml
// https://www.gamecopyworld.com/games/pc_pc_futbol_2000.shtml
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -138,7 +138,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -46,7 +46,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -80,7 +80,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// TODO: Search for the presence of the folder "EasyAntiCheat" specifically, which is present in every checked version so far.
var matchers = new List<PathMatchSet>

View File

@@ -50,7 +50,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -15,7 +15,7 @@ namespace BinaryObjectScanner.Protection
// TODO: Add an MS-DOS executable check for "FREELOCK.EXE".
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -34,7 +34,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -38,7 +38,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -67,7 +67,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -54,7 +54,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Protection
public class IndyVCD : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// TODO: Verify if these are OR or AND
var matchers = new List<PathMatchSet>

View File

@@ -56,7 +56,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -48,7 +48,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -118,7 +118,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -165,7 +165,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var results = new List<string>();

View File

@@ -37,7 +37,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -63,7 +63,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -50,7 +50,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -80,7 +80,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -64,7 +64,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -29,7 +29,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -40,7 +40,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -9,7 +9,7 @@ namespace BinaryObjectScanner.Protection
public class ProtectDVDVideo : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var protections = new List<string>();
if (files == null)

View File

@@ -97,7 +97,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -287,7 +287,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -41,7 +41,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -35,7 +35,7 @@ namespace BinaryObjectScanner.Protection
// TODO: Confirm if these checks are only for ProRing or if they are also for older Ring PROTECH
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -61,7 +61,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -122,7 +122,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -20,7 +20,7 @@ namespace BinaryObjectScanner.Protection
public class SafeLock : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
// Technically all need to exist but some might be renamed
var matchers = new List<PathMatchSet>

View File

@@ -117,7 +117,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -28,7 +28,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -82,7 +82,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -107,7 +107,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -103,7 +103,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -41,7 +41,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -53,7 +53,7 @@ namespace BinaryObjectScanner.Protection
public class TZCopyProtection : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -63,7 +63,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -44,7 +44,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -43,7 +43,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -51,7 +51,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -19,7 +19,7 @@ namespace BinaryObjectScanner.Protection
public class WinLock : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -40,7 +40,7 @@ namespace BinaryObjectScanner.Protection
}
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var protections = new List<string>();
if (files == null)

View File

@@ -10,7 +10,7 @@ namespace BinaryObjectScanner.Protection
public class Zzxzz : IPathCheck
{
/// <inheritdoc/>
public List<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
public List<string> CheckDirectoryPath(string path, List<string>? files)
{
var matchers = new List<PathMatchSet>
{

View File

@@ -42,7 +42,10 @@ namespace BinaryObjectScanner
// Add the key if needed and then append the lists
EnsureKey(key);
AddRangeToKey(key, values);
foreach (string value in values)
{
this[key].Enqueue(value);
}
}
/// <summary>