diff --git a/BinaryObjectScanner/Handler.cs b/BinaryObjectScanner/Handler.cs index b0ccc104..d89826fb 100644 --- a/BinaryObjectScanner/Handler.cs +++ b/BinaryObjectScanner/Handler.cs @@ -1,14 +1,10 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; using BinaryObjectScanner.Interfaces; -using BinaryObjectScanner.Utilities; using SabreTools.Serialization.Wrappers; namespace BinaryObjectScanner diff --git a/BinaryObjectScanner/Interfaces/IPathCheck.cs b/BinaryObjectScanner/Interfaces/IPathCheck.cs index 4d081966..e12dee29 100644 --- a/BinaryObjectScanner/Interfaces/IPathCheck.cs +++ b/BinaryObjectScanner/Interfaces/IPathCheck.cs @@ -1,7 +1,4 @@ -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif -using System.Collections.Generic; +using System.Collections.Generic; namespace BinaryObjectScanner.Interfaces { @@ -19,11 +16,7 @@ public interface IPathCheck /// Path to check for protection indicators /// Enumerable of strings representing files in a directory /// This can do some limited content checking as well, but it's suggested to use a content check instead, if possible -#if NET20 || NET35 - Queue CheckDirectoryPath(string path, IEnumerable? files); -#else - ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files); -#endif + IEnumerable CheckDirectoryPath(string path, IEnumerable? files); /// /// Check a file path for protections based on path name diff --git a/BinaryObjectScanner/Protection/AegiSoft.cs b/BinaryObjectScanner/Protection/AegiSoft.cs index bc0731d0..558ba207 100644 --- a/BinaryObjectScanner/Protection/AegiSoft.cs +++ b/BinaryObjectScanner/Protection/AegiSoft.cs @@ -71,11 +71,7 @@ public class AegiSoft : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/AlphaDVD.cs b/BinaryObjectScanner/Protection/AlphaDVD.cs index a120c8a8..c7c52b33 100644 --- a/BinaryObjectScanner/Protection/AlphaDVD.cs +++ b/BinaryObjectScanner/Protection/AlphaDVD.cs @@ -19,11 +19,7 @@ namespace BinaryObjectScanner.Protection public class AlphaDVD : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Bitpool.cs b/BinaryObjectScanner/Protection/Bitpool.cs index c6260d4c..61c3f382 100644 --- a/BinaryObjectScanner/Protection/Bitpool.cs +++ b/BinaryObjectScanner/Protection/Bitpool.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; @@ -16,11 +13,7 @@ namespace BinaryObjectScanner.Protection public class Bitpool : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/ByteShield.cs b/BinaryObjectScanner/Protection/ByteShield.cs index 42f2d4c4..601c5ecc 100644 --- a/BinaryObjectScanner/Protection/ByteShield.cs +++ b/BinaryObjectScanner/Protection/ByteShield.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; @@ -133,11 +130,7 @@ public class ByteShield : IPortableExecutableCheck, IPathCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? 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. diff --git a/BinaryObjectScanner/Protection/CDDVDCops.cs b/BinaryObjectScanner/Protection/CDDVDCops.cs index 4aac0d15..1773824d 100644 --- a/BinaryObjectScanner/Protection/CDDVDCops.cs +++ b/BinaryObjectScanner/Protection/CDDVDCops.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 System.Text; @@ -185,11 +182,7 @@ public class CDDVDCops : IContentCheck, INewExecutableCheck, IPathCheck, IPortab } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { // TODO: Original had "CDCOPS.DLL" required and all the rest in a combined OR var matchers = new List diff --git a/BinaryObjectScanner/Protection/CDGuard.cs b/BinaryObjectScanner/Protection/CDGuard.cs index 6a8b03a0..988c5157 100644 --- a/BinaryObjectScanner/Protection/CDGuard.cs +++ b/BinaryObjectScanner/Protection/CDGuard.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 BinaryObjectScanner.Interfaces; @@ -58,11 +55,7 @@ public class CDGuard : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/CDLock.cs b/BinaryObjectScanner/Protection/CDLock.cs index db121d9c..9756f4f9 100644 --- a/BinaryObjectScanner/Protection/CDLock.cs +++ b/BinaryObjectScanner/Protection/CDLock.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.Content; @@ -65,18 +62,14 @@ public class CDLock : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { // TODO: Determine if there's any consistency in the naming of the additional AFP files. // Found in every confirmed sample of CD-Lock, generally (but not always) appears to include markers relating to the additional AFP files present (Redump entries 24287 and 31615). - new(new PathMatch("CONFIG.AFP", useEndsWith: true), "CD-Lock"), + new(new FilePathMatch("CONFIG.AFP"), "CD-Lock"), // There is also a "$$$$$$$$.$$$" file present on some discs, but it isn't known if this is directly related to CD-Lock (Redump entries 37788 and 43221). }; @@ -92,7 +85,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/CDX.cs b/BinaryObjectScanner/Protection/CDX.cs index eb25caec..3ec1de52 100644 --- a/BinaryObjectScanner/Protection/CDX.cs +++ b/BinaryObjectScanner/Protection/CDX.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; @@ -15,11 +12,7 @@ namespace BinaryObjectScanner.Protection public class CDX : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { // TODO: Verify if these are OR or AND var matchers = new List diff --git a/BinaryObjectScanner/Protection/CenegaProtectDVD.cs b/BinaryObjectScanner/Protection/CenegaProtectDVD.cs index dd5a3e75..e07e3853 100644 --- a/BinaryObjectScanner/Protection/CenegaProtectDVD.cs +++ b/BinaryObjectScanner/Protection/CenegaProtectDVD.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -56,11 +53,7 @@ public class CengaProtectDVD : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Channelware.cs b/BinaryObjectScanner/Protection/Channelware.cs index fe03cd3c..d7f1e62e 100644 --- a/BinaryObjectScanner/Protection/Channelware.cs +++ b/BinaryObjectScanner/Protection/Channelware.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.IO; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -64,11 +61,7 @@ public class Channelware : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/ChosenBytesCodeLock.cs b/BinaryObjectScanner/Protection/ChosenBytesCodeLock.cs index 257874c8..eb5d21e2 100644 --- a/BinaryObjectScanner/Protection/ChosenBytesCodeLock.cs +++ b/BinaryObjectScanner/Protection/ChosenBytesCodeLock.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 BinaryObjectScanner.Interfaces; @@ -57,11 +54,7 @@ public class ChosenBytesCodeLock : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/CopyKiller.cs b/BinaryObjectScanner/Protection/CopyKiller.cs index 02e8fea8..2c43b1ab 100644 --- a/BinaryObjectScanner/Protection/CopyKiller.cs +++ b/BinaryObjectScanner/Protection/CopyKiller.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -39,11 +36,7 @@ public class CopyKiller : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? 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. diff --git a/BinaryObjectScanner/Protection/CopyX.cs b/BinaryObjectScanner/Protection/CopyX.cs index ea510ece..158bd15a 100644 --- a/BinaryObjectScanner/Protection/CopyX.cs +++ b/BinaryObjectScanner/Protection/CopyX.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -96,17 +93,9 @@ public class CopyX : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { -#if NET20 || NET35 - var protections = new Queue(); -#else - var protections = new ConcurrentQueue(); -#endif + var protections = new List(); if (files == null) return protections; @@ -167,7 +156,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/DVDCrypt.cs b/BinaryObjectScanner/Protection/DVDCrypt.cs index 620232e4..0940e87e 100644 --- a/BinaryObjectScanner/Protection/DVDCrypt.cs +++ b/BinaryObjectScanner/Protection/DVDCrypt.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; @@ -11,11 +8,7 @@ namespace BinaryObjectScanner.Protection public class DVDCrypt : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/DVDMoviePROTECT.cs b/BinaryObjectScanner/Protection/DVDMoviePROTECT.cs index 75c0c891..270b4e91 100644 --- a/BinaryObjectScanner/Protection/DVDMoviePROTECT.cs +++ b/BinaryObjectScanner/Protection/DVDMoviePROTECT.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.IO; using System.Linq; using BinaryObjectScanner.Interfaces; @@ -12,17 +9,9 @@ namespace BinaryObjectScanner.Protection public class DVDMoviePROTECT : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { -#if NET20 || NET35 - var protections = new Queue(); -#else - var protections = new ConcurrentQueue(); -#endif + var protections = new List(); if (files == null) return protections; @@ -38,7 +27,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/DigiGuard.cs b/BinaryObjectScanner/Protection/DigiGuard.cs index 54131d9b..4ccc7b3a 100644 --- a/BinaryObjectScanner/Protection/DigiGuard.cs +++ b/BinaryObjectScanner/Protection/DigiGuard.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; @@ -55,11 +52,7 @@ public class DigiGuard : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/DinamicMultimedia.cs b/BinaryObjectScanner/Protection/DinamicMultimedia.cs index d58b60e9..fc73bd24 100644 --- a/BinaryObjectScanner/Protection/DinamicMultimedia.cs +++ b/BinaryObjectScanner/Protection/DinamicMultimedia.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.IO; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -25,24 +22,20 @@ public class DinamicMultimedia : IPathCheck // https://www.gamecopyworld.com/games/pc_pc_calcio_2000.shtml // https://www.gamecopyworld.com/games/pc_pc_futbol_2000.shtml -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { // Many more checks are likely possible based on the sources, but only ones that have been personally verified are getting added. // Uncopyable files found in at least http://redump.org/disc/70531/, and likely in multiple others. - new(new PathMatch(Path.Combine("XCONTROL", "COMPPLAY._01").Replace("\\", "/"), useEndsWith: true), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), - new(new PathMatch(Path.Combine("XCONTROL", "LANDER.DA0").Replace("\\", "/"), useEndsWith: true), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), - new(new PathMatch(Path.Combine("XCONTROL", "XSMGOP.DAP").Replace("\\", "/"), useEndsWith: true), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), - new(new PathMatch(Path.Combine("XCONTROL", "XSMGOP.VBX").Replace("\\", "/"), useEndsWith: true), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), + new(new FilePathMatch(Path.Combine("XCONTROL", "COMPPLAY._01")), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), + new(new FilePathMatch(Path.Combine("XCONTROL", "LANDER.DA0")), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), + new(new FilePathMatch(Path.Combine("XCONTROL", "XSMGOP.DAP")), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), + new(new FilePathMatch(Path.Combine("XCONTROL", "XSMGOP.VBX")), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), // Copyable file found in http://redump.org/disc/70531/ that seems to be exclusively associated with the protection and other files that are part of the protection. - new(new PathMatch(Path.Combine("XCONTROL", "COMPSCO._01").Replace("\\", "/"), useEndsWith: true), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), + new(new PathMatch(Path.Combine("XCONTROL", "COMPSCO._01")), "Dinamic Multimedia Protection/LockBlocks [Check disc for 2 physical rings]"), }; return MatchUtil.GetAllMatches(files, matchers, any: true); @@ -56,15 +49,15 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { @@ -191,7 +184,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable - private string GetVersion(PortableExecutable pex) + private static string GetVersion(PortableExecutable pex) { // Check the internal versions var version = pex.GetInternalVersion(); @@ -216,7 +209,7 @@ private string GetVersion(PortableExecutable pex) return string.Empty; } - private string GetInternalVersion(string firstMatchedString) + private static string GetInternalVersion(string firstMatchedString) { try { diff --git a/BinaryObjectScanner/Protection/EAAntiCheat.cs b/BinaryObjectScanner/Protection/EAAntiCheat.cs index a35a8dc1..e297259a 100644 --- a/BinaryObjectScanner/Protection/EAAntiCheat.cs +++ b/BinaryObjectScanner/Protection/EAAntiCheat.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; @@ -49,11 +46,7 @@ public class EAAntiCheat : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/EasyAntiCheat.cs b/BinaryObjectScanner/Protection/EasyAntiCheat.cs index 6d98dd43..82a8a9e7 100644 --- a/BinaryObjectScanner/Protection/EasyAntiCheat.cs +++ b/BinaryObjectScanner/Protection/EasyAntiCheat.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; @@ -83,11 +80,7 @@ public class EasyAntiCheat : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { // TODO: Search for the presence of the folder "EasyAntiCheat" specifically, which is present in every checked version so far. var matchers = new List diff --git a/BinaryObjectScanner/Protection/Engine32.cs b/BinaryObjectScanner/Protection/Engine32.cs index 927b3d26..cfadab8a 100644 --- a/BinaryObjectScanner/Protection/Engine32.cs +++ b/BinaryObjectScanner/Protection/Engine32.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 BinaryObjectScanner.Interfaces; @@ -54,11 +51,7 @@ public class Engine32 : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/FreeLock.cs b/BinaryObjectScanner/Protection/FreeLock.cs index b112b913..988d5c9d 100644 --- a/BinaryObjectScanner/Protection/FreeLock.cs +++ b/BinaryObjectScanner/Protection/FreeLock.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; @@ -18,11 +15,7 @@ public class Freelock : IPathCheck // TODO: Add an MS-DOS executable check for "FREELOCK.EXE". /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/GFWL.cs b/BinaryObjectScanner/Protection/GFWL.cs index 604fa0d1..3b2b722f 100644 --- a/BinaryObjectScanner/Protection/GFWL.cs +++ b/BinaryObjectScanner/Protection/GFWL.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 BinaryObjectScanner.Interfaces; @@ -39,11 +36,7 @@ public class GFWL : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Gefest.cs b/BinaryObjectScanner/Protection/Gefest.cs index ef11d61a..4480384a 100644 --- a/BinaryObjectScanner/Protection/Gefest.cs +++ b/BinaryObjectScanner/Protection/Gefest.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; @@ -42,11 +39,7 @@ public class Gefest : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/HexaLock.cs b/BinaryObjectScanner/Protection/HexaLock.cs index 343ea40b..80f9fbb0 100644 --- a/BinaryObjectScanner/Protection/HexaLock.cs +++ b/BinaryObjectScanner/Protection/HexaLock.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 BinaryObjectScanner.Interfaces; @@ -71,11 +68,7 @@ public class HexalockAutoLock : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/ImpulseReactor.cs b/BinaryObjectScanner/Protection/ImpulseReactor.cs index 82fbdd1a..d5ba9261 100644 --- a/BinaryObjectScanner/Protection/ImpulseReactor.cs +++ b/BinaryObjectScanner/Protection/ImpulseReactor.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.IO; using System.Linq; using BinaryObjectScanner.Interfaces; @@ -57,11 +54,7 @@ public class ImpulseReactor : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/IndyVCD.cs b/BinaryObjectScanner/Protection/IndyVCD.cs index 70f80688..8c0f53fd 100644 --- a/BinaryObjectScanner/Protection/IndyVCD.cs +++ b/BinaryObjectScanner/Protection/IndyVCD.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; @@ -15,11 +12,7 @@ namespace BinaryObjectScanner.Protection public class IndyVCD : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { // TODO: Verify if these are OR or AND var matchers = new List diff --git a/BinaryObjectScanner/Protection/KalypsoLauncher.cs b/BinaryObjectScanner/Protection/KalypsoLauncher.cs index e8d2cdc8..1816335e 100644 --- a/BinaryObjectScanner/Protection/KalypsoLauncher.cs +++ b/BinaryObjectScanner/Protection/KalypsoLauncher.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; @@ -60,11 +57,7 @@ public class KalypsoLauncher : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/LabelGate.cs b/BinaryObjectScanner/Protection/LabelGate.cs index f7b43ffc..9afbcdfa 100644 --- a/BinaryObjectScanner/Protection/LabelGate.cs +++ b/BinaryObjectScanner/Protection/LabelGate.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -52,11 +49,7 @@ public class LabelGate : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/LaserLok.cs b/BinaryObjectScanner/Protection/LaserLok.cs index d2f482b4..fdcdf3f1 100644 --- a/BinaryObjectScanner/Protection/LaserLok.cs +++ b/BinaryObjectScanner/Protection/LaserLok.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -114,11 +111,7 @@ public class LaserLok : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Macrovision.CDilla.cs b/BinaryObjectScanner/Protection/Macrovision.CDilla.cs index 2545e938..72096ada 100644 --- a/BinaryObjectScanner/Protection/Macrovision.CDilla.cs +++ b/BinaryObjectScanner/Protection/Macrovision.CDilla.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; @@ -151,11 +148,7 @@ public partial class Macrovision } /// -#if NET20 || NET35 - internal Queue CDillaCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue CDillaCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable CDillaCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Macrovision.CactusDataShield.cs b/BinaryObjectScanner/Protection/Macrovision.CactusDataShield.cs index 85b2f91f..57486447 100644 --- a/BinaryObjectScanner/Protection/Macrovision.CactusDataShield.cs +++ b/BinaryObjectScanner/Protection/Macrovision.CactusDataShield.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -67,11 +64,7 @@ public partial class Macrovision } /// -#if NET20 || NET35 - internal Queue CactusDataShieldCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue CactusDataShieldCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable CactusDataShieldCheckDirectoryPath(string path, IEnumerable? files) { // TODO: Verify if these are OR or AND var matchers = new List diff --git a/BinaryObjectScanner/Protection/Macrovision.RipGuard.cs b/BinaryObjectScanner/Protection/Macrovision.RipGuard.cs index 055330cb..9239f2f8 100644 --- a/BinaryObjectScanner/Protection/Macrovision.RipGuard.cs +++ b/BinaryObjectScanner/Protection/Macrovision.RipGuard.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using SabreTools.Hashing; @@ -62,11 +59,7 @@ public partial class Macrovision } /// -#if NET20 || NET35 - internal Queue RipGuardCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue RipGuardCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable RipGuardCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs b/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs index 5cb578dc..a55e02cc 100644 --- a/BinaryObjectScanner/Protection/Macrovision.SafeCast.cs +++ b/BinaryObjectScanner/Protection/Macrovision.SafeCast.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 System.Text; @@ -151,11 +148,7 @@ public partial class Macrovision } /// -#if NET20 || NET35 - internal Queue SafeCastCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue SafeCastCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable SafeCastCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Macrovision.SafeDisc.cs b/BinaryObjectScanner/Protection/Macrovision.SafeDisc.cs index e249233e..2187a9d7 100644 --- a/BinaryObjectScanner/Protection/Macrovision.SafeDisc.cs +++ b/BinaryObjectScanner/Protection/Macrovision.SafeDisc.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -130,11 +127,7 @@ public partial class Macrovision } /// -#if NET20 || NET35 - internal Queue SafeDiscCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue SafeDiscCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable SafeDiscCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Macrovision.cs b/BinaryObjectScanner/Protection/Macrovision.cs index 0809e929..c2586855 100644 --- a/BinaryObjectScanner/Protection/Macrovision.cs +++ b/BinaryObjectScanner/Protection/Macrovision.cs @@ -1,12 +1,8 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; using BinaryObjectScanner.Interfaces; -using BinaryObjectScanner.Utilities; using SabreTools.IO.Extensions; using SabreTools.Matching; using SabreTools.Matching.Content; @@ -169,80 +165,44 @@ public partial class Macrovision : IPathCheck, INewExecutableCheck, IPortableExe } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { -#if NET20 || NET35 - var results = new Queue(); -#else - var results = new ConcurrentQueue(); -#endif + var results = new List(); // Run Macrovision directory checks var macrovision = MacrovisionCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (macrovision != null && macrovision.Count > 0) -#else - if (macrovision != null && !macrovision.IsEmpty) -#endif + if (macrovision != null) results.AddRange(macrovision); // Run Cactus Data Shield directory checks var cactusDataShield = CactusDataShieldCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (cactusDataShield != null && cactusDataShield.Count > 0) -#else - if (cactusDataShield != null && !cactusDataShield.IsEmpty) -#endif + if (cactusDataShield != null) results.AddRange(cactusDataShield); // Run C-Dilla directory checks var cDilla = CDillaCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (cDilla != null && cDilla.Count > 0) -#else - if (cDilla != null && !cDilla.IsEmpty) -#endif + if (cDilla != null) results.AddRange(cDilla); // Run RipGuard directory checks var ripGuard = RipGuardCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (ripGuard != null && ripGuard.Count > 0) -#else - if (ripGuard != null && !ripGuard.IsEmpty) -#endif + if (ripGuard != null) results.AddRange(ripGuard); // Run SafeCast directory checks var safeCast = SafeCastCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (safeCast != null && safeCast.Count > 0) -#else - if (safeCast != null && !safeCast.IsEmpty) -#endif + if (safeCast != null) results.AddRange(safeCast); // Run SafeDisc directory checks var safeDisc = SafeDiscCheckDirectoryPath(path, files); -#if NET20 || NET35 - if (safeDisc != null && safeDisc.Count > 0) -#else - if (safeDisc != null && !safeDisc.IsEmpty) -#endif + if (safeDisc != null) results.AddRange(safeDisc); if (results != null && results.Count > 0) return results; -#if NET20 || NET35 - return new Queue(); -#else - return new ConcurrentQueue(); -#endif + return []; } /// @@ -289,11 +249,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - internal Queue MacrovisionCheckDirectoryPath(string path, IEnumerable? files) -#else - internal ConcurrentQueue MacrovisionCheckDirectoryPath(string path, IEnumerable? files) -#endif + internal IEnumerable MacrovisionCheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { @@ -436,7 +392,7 @@ internal ConcurrentQueue MacrovisionCheckDirectoryPath(string path, IEnu } // TODO: Combine with filesize version checks if possible. - private string GetSecDrvExecutableVersion(PortableExecutable pex) + private static string GetSecDrvExecutableVersion(PortableExecutable pex) { // Different versions of this driver correspond to different SafeDisc versions. // TODO: Check if earlier versions of this driver contain the version string in a less obvious place. @@ -478,7 +434,7 @@ private string GetSecDrvExecutableVersion(PortableExecutable pex) return "Unknown Version (Report this to us on GitHub)"; } - private string? CheckSectionForProtection(string file, bool includeDebug, List? sectionStrings, byte[]? sectionRaw, bool newVersion) + private static string? CheckSectionForProtection(string file, bool includeDebug, List? sectionStrings, byte[]? sectionRaw, bool newVersion) { // Get the section strings, if they exist if (sectionStrings != null) diff --git a/BinaryObjectScanner/Protection/MediaCloQ.cs b/BinaryObjectScanner/Protection/MediaCloQ.cs index 8d9a84df..5f689c0e 100644 --- a/BinaryObjectScanner/Protection/MediaCloQ.cs +++ b/BinaryObjectScanner/Protection/MediaCloQ.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -40,11 +37,7 @@ public class MediaCloQ : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/MediaMax.cs b/BinaryObjectScanner/Protection/MediaMax.cs index 8d6ce608..353c7e28 100644 --- a/BinaryObjectScanner/Protection/MediaMax.cs +++ b/BinaryObjectScanner/Protection/MediaMax.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 BinaryObjectScanner.Interfaces; @@ -66,11 +63,7 @@ public class MediaMax : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/NEACProtect.cs b/BinaryObjectScanner/Protection/NEACProtect.cs index c7ba6aa4..ed0c0f83 100644 --- a/BinaryObjectScanner/Protection/NEACProtect.cs +++ b/BinaryObjectScanner/Protection/NEACProtect.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; @@ -53,11 +50,7 @@ public class NEACProtect : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/NProtect.cs b/BinaryObjectScanner/Protection/NProtect.cs index ebed351e..827225f8 100644 --- a/BinaryObjectScanner/Protection/NProtect.cs +++ b/BinaryObjectScanner/Protection/NProtect.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; @@ -83,11 +80,7 @@ public class NProtect : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/OpenMG.cs b/BinaryObjectScanner/Protection/OpenMG.cs index 7b37ac91..f50dcfc4 100644 --- a/BinaryObjectScanner/Protection/OpenMG.cs +++ b/BinaryObjectScanner/Protection/OpenMG.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using BinaryObjectScanner.Interfaces; @@ -67,11 +64,7 @@ public class OpenMG : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Origin.cs b/BinaryObjectScanner/Protection/Origin.cs index 3d89766e..bfdc6376 100644 --- a/BinaryObjectScanner/Protection/Origin.cs +++ b/BinaryObjectScanner/Protection/Origin.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -32,11 +29,7 @@ public class Origin : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/PlayJ.cs b/BinaryObjectScanner/Protection/PlayJ.cs index 03c9bb67..6ffd351a 100644 --- a/BinaryObjectScanner/Protection/PlayJ.cs +++ b/BinaryObjectScanner/Protection/PlayJ.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; @@ -43,11 +40,7 @@ public class PlayJ : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/ProtectDVDVideo.cs b/BinaryObjectScanner/Protection/ProtectDVDVideo.cs index 2c454f4c..fc8191d7 100644 --- a/BinaryObjectScanner/Protection/ProtectDVDVideo.cs +++ b/BinaryObjectScanner/Protection/ProtectDVDVideo.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.IO; using System.Linq; using BinaryObjectScanner.Interfaces; @@ -12,17 +9,9 @@ namespace BinaryObjectScanner.Protection public class ProtectDVDVideo : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { -#if NET20 || NET35 - var protections = new Queue(); -#else - var protections = new ConcurrentQueue(); -#endif + var protections = new List(); if (files == null) return protections; @@ -34,7 +23,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/RealArcade.cs b/BinaryObjectScanner/Protection/RealArcade.cs index 9a855ee6..276d23cb 100644 --- a/BinaryObjectScanner/Protection/RealArcade.cs +++ b/BinaryObjectScanner/Protection/RealArcade.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; @@ -45,11 +42,7 @@ public class RealArcade : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/RingPROTECH.cs b/BinaryObjectScanner/Protection/RingPROTECH.cs index b0e771d1..14968c75 100644 --- a/BinaryObjectScanner/Protection/RingPROTECH.cs +++ b/BinaryObjectScanner/Protection/RingPROTECH.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.Content; @@ -38,11 +35,7 @@ public class RingPROTECH : IContentCheck, IPathCheck // TODO: Confirm if these checks are only for ProRing or if they are also for older Ring PROTECH /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Roxxe.cs b/BinaryObjectScanner/Protection/Roxxe.cs index cb2b22de..f056c1ea 100644 --- a/BinaryObjectScanner/Protection/Roxxe.cs +++ b/BinaryObjectScanner/Protection/Roxxe.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; @@ -64,11 +61,7 @@ public class Roxxe : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/SVKP.cs b/BinaryObjectScanner/Protection/SVKP.cs index c3e92d17..931d4617 100644 --- a/BinaryObjectScanner/Protection/SVKP.cs +++ b/BinaryObjectScanner/Protection/SVKP.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; @@ -93,11 +90,7 @@ public class SVKProtector : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/SafeLock.cs b/BinaryObjectScanner/Protection/SafeLock.cs index 09205c3e..3c63fa9b 100644 --- a/BinaryObjectScanner/Protection/SafeLock.cs +++ b/BinaryObjectScanner/Protection/SafeLock.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; @@ -23,11 +20,7 @@ namespace BinaryObjectScanner.Protection public class SafeLock : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { // Technically all need to exist but some might be renamed var matchers = new List diff --git a/BinaryObjectScanner/Protection/SecuROM.cs b/BinaryObjectScanner/Protection/SecuROM.cs index 3073c88d..ba5f77bf 100644 --- a/BinaryObjectScanner/Protection/SecuROM.cs +++ b/BinaryObjectScanner/Protection/SecuROM.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 System.Text; @@ -121,11 +118,7 @@ public class SecuROM : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/SmartE.cs b/BinaryObjectScanner/Protection/SmartE.cs index f70830c2..547e4b2e 100644 --- a/BinaryObjectScanner/Protection/SmartE.cs +++ b/BinaryObjectScanner/Protection/SmartE.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; @@ -32,11 +29,7 @@ public class SmartE : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/SoftLock.cs b/BinaryObjectScanner/Protection/SoftLock.cs index 07827f39..358cab70 100644 --- a/BinaryObjectScanner/Protection/SoftLock.cs +++ b/BinaryObjectScanner/Protection/SoftLock.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; @@ -85,11 +82,7 @@ public class SoftLock : IPortableExecutableCheck, IPathCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/SolidShield.cs b/BinaryObjectScanner/Protection/SolidShield.cs index 2076b359..02212cdb 100644 --- a/BinaryObjectScanner/Protection/SolidShield.cs +++ b/BinaryObjectScanner/Protection/SolidShield.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 BinaryObjectScanner.Interfaces; @@ -113,11 +110,7 @@ public class SolidShield : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/StarForce.cs b/BinaryObjectScanner/Protection/StarForce.cs index 04848ecc..2cac9512 100644 --- a/BinaryObjectScanner/Protection/StarForce.cs +++ b/BinaryObjectScanner/Protection/StarForce.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 BinaryObjectScanner.Interfaces; @@ -107,11 +104,7 @@ public class StarForce : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Steam.cs b/BinaryObjectScanner/Protection/Steam.cs index c8383c1e..f96393e2 100644 --- a/BinaryObjectScanner/Protection/Steam.cs +++ b/BinaryObjectScanner/Protection/Steam.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; @@ -44,11 +41,7 @@ public class Steam : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/TZCopyProtection.cs b/BinaryObjectScanner/Protection/TZCopyProtection.cs index 9b18bf2f..c1a3ce8c 100644 --- a/BinaryObjectScanner/Protection/TZCopyProtection.cs +++ b/BinaryObjectScanner/Protection/TZCopyProtection.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; @@ -56,11 +53,7 @@ namespace BinaryObjectScanner.Protection public class TZCopyProtection : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/Tages.cs b/BinaryObjectScanner/Protection/Tages.cs index a0fd8004..bc2dbbae 100644 --- a/BinaryObjectScanner/Protection/Tages.cs +++ b/BinaryObjectScanner/Protection/Tages.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using BinaryObjectScanner.Interfaces; @@ -66,11 +63,7 @@ public class TAGES : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { @@ -101,16 +94,16 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable { // f82339d797be6da92f5d9dadeae9025385159057 - new(Path.Combine("9x", "Tamlx.alf")), + new FilePathMatch(Path.Combine("9x", "Tamlx.alf")), // 933c004d3043863f019f5ffaf63402a30e65026c - new(Path.Combine("9x", "Tamlx.apt")), + new FilePathMatch(Path.Combine("9x", "Tamlx.apt")), // d45745fa6b0d23fe0ee12e330ab85d5bf4e0e776 - new(Path.Combine("NT", "enodpl.sys")), + new FilePathMatch(Path.Combine("NT", "enodpl.sys")), // f111eba05ca6e9061c557547420847d7fdee657d - new(Path.Combine("NT", "litdpl.sys")), + new FilePathMatch(Path.Combine("NT", "litdpl.sys")), }, "TAGES"), // Currently only known to exist in "XIII" and "Beyond Good & Evil" (Redump entries 8774-8776, 45940-45941, 18690-18693, and presumably 21320, 21321, 21323, and 36124). @@ -218,7 +211,7 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/WMDS.cs b/BinaryObjectScanner/Protection/WMDS.cs index 1531d2e2..34f71543 100644 --- a/BinaryObjectScanner/Protection/WMDS.cs +++ b/BinaryObjectScanner/Protection/WMDS.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 BinaryObjectScanner.Interfaces; @@ -46,21 +43,17 @@ public class WMDS : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { // Found on "All That I Am" by Santana (Barcode 8 2876-59773-2 6) and "Contraband" by Velvet Revolver (Barcode 8 28766 05242 8), "Touch" by Amerie, likely among others. - new(new List - { + new( + [ // These files always appear to be present together. new FilePathMatch("WMDS.dll"), new FilePathMatch("WMDS.ini"), - }, "Windows Media Data Session DRM"), + ], "Windows Media Data Session DRM"), }; return MatchUtil.GetAllMatches(files, matchers, any: false); diff --git a/BinaryObjectScanner/Protection/WTMCDProtect.cs b/BinaryObjectScanner/Protection/WTMCDProtect.cs index d08e9b00..c08781c5 100644 --- a/BinaryObjectScanner/Protection/WTMCDProtect.cs +++ b/BinaryObjectScanner/Protection/WTMCDProtect.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; @@ -55,19 +52,15 @@ public class WTMCDProtect : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { - new(new List - { + new( + [ new FilePathMatch("wtmfiles.dat"), new FilePathMatch("Viewer.exe"), - }, "WTM Protection Viewer"), + ], "WTM Protection Viewer"), }; return MatchUtil.GetAllMatches(files, matchers, any: false); diff --git a/BinaryObjectScanner/Protection/WinLock.cs b/BinaryObjectScanner/Protection/WinLock.cs index d9abe0a4..d00bab81 100644 --- a/BinaryObjectScanner/Protection/WinLock.cs +++ b/BinaryObjectScanner/Protection/WinLock.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; @@ -22,11 +19,7 @@ namespace BinaryObjectScanner.Protection public class WinLock : IPathCheck { /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List { diff --git a/BinaryObjectScanner/Protection/XCP.cs b/BinaryObjectScanner/Protection/XCP.cs index 2ffc636f..6107f063 100644 --- a/BinaryObjectScanner/Protection/XCP.cs +++ b/BinaryObjectScanner/Protection/XCP.cs @@ -1,7 +1,4 @@ using System; -#if NET40_OR_GREATER || NETCOREAPP -using System.Collections.Concurrent; -#endif using System.Collections.Generic; using System.IO; using System.Linq; @@ -43,17 +40,9 @@ public class XCP : IPathCheck, IPortableExecutableCheck } /// -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { -#if NET20 || NET35 - var protections = new Queue(); -#else - var protections = new ConcurrentQueue(); -#endif + var protections = new List(); if (files == null) return protections; @@ -66,11 +55,11 @@ public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable -#if NET20 || NET35 - public Queue CheckDirectoryPath(string path, IEnumerable? files) -#else - public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) -#endif + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) { var matchers = new List {