diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs
index cac47442..cb28981f 100644
--- a/BurnOutSharp/FileType/Executable.cs
+++ b/BurnOutSharp/FileType/Executable.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using BurnOutSharp.Matching;
using BurnOutSharp.Tools;
namespace BurnOutSharp.FileType
@@ -88,18 +89,32 @@ namespace BurnOutSharp.FileType
if (stream.CanSeek)
stream.Seek(0, SeekOrigin.Begin);
+ // TODO: Find a way to combine the outputs of GetContentMatchSet to make this more efficient
+ // If they can be combined, we can have it do a Unique check per file
+
// Iterate through all content checks
Parallel.ForEach(contentCheckClasses, contentCheckClass =>
{
- // TODO: Find a way to combine the outputs of GetContentMatchSet
- // TODO: Have CheckContents take priority over GetContentMatchSet results
- string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug);
+ // Track if any protection is found
+ bool foundProtection = false;
- // If we have a valid content check based on settings
- if (!contentCheckClass.GetType().Namespace.ToLowerInvariant().Contains("packertype") || scanner.ScanPackers)
+ // Check using custom content checks first
+ string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug);
+ foundProtection |= !string.IsNullOrWhiteSpace(protection);
+ if (ShouldAddProtection(contentCheckClass, scanner, protection))
+ Utilities.AppendToDictionary(protections, file, protection);
+
+ // If we didn't find anything in a custom check, use the content match sets
+ if (!foundProtection)
{
- if (!string.IsNullOrWhiteSpace(protection))
- Utilities.AppendToDictionary(protections, file, protection);
+ var contentMatchSets = contentCheckClass.GetContentMatchSets();
+ if (contentMatchSets != null && contentMatchSets.Any())
+ {
+ protection = MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, scanner.IncludeDebug);
+ foundProtection |= !string.IsNullOrWhiteSpace(protection);
+ if (ShouldAddProtection(contentCheckClass, scanner, protection))
+ Utilities.AppendToDictionary(protections, file, protection);
+ }
}
// If we have an IScannable implementation
@@ -126,5 +141,23 @@ namespace BurnOutSharp.FileType
.Where(t => t.IsClass && t.GetInterface(nameof(IContentCheck)) != null)
.Select(t => Activator.CreateInstance(t) as IContentCheck);
}
+
+ ///
+ /// Check to see if a protection should be added or not
+ ///
+ /// Class that was last used to check
+ /// Scanner object for state tracking
+ /// The protection result to be checked
+ private bool ShouldAddProtection(IContentCheck contentCheckClass, Scanner scanner, string protection)
+ {
+ // If we have a valid content check based on settings
+ if (!contentCheckClass.GetType().Namespace.ToLowerInvariant().Contains("packertype") || scanner.ScanPackers)
+ {
+ if (!string.IsNullOrWhiteSpace(protection))
+ return true;
+ }
+
+ return false;
+ }
}
}
diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs
index 304888b3..eaf381a7 100644
--- a/BurnOutSharp/PackerType/AdvancedInstaller.cs
+++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs
@@ -24,10 +24,6 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs
index f4bc005c..1796d298 100644
--- a/BurnOutSharp/PackerType/Armadillo.cs
+++ b/BurnOutSharp/PackerType/Armadillo.cs
@@ -19,10 +19,6 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs
index d63632bc..f70384d2 100644
--- a/BurnOutSharp/PackerType/CExe.cs
+++ b/BurnOutSharp/PackerType/CExe.cs
@@ -32,11 +32,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentDictionary> Scan(Scanner scanner, string file)
diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs
index 21a6fc13..26a93fde 100644
--- a/BurnOutSharp/PackerType/EXEStealth.cs
+++ b/BurnOutSharp/PackerType/EXEStealth.cs
@@ -23,10 +23,6 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs
index 82a973d0..62de812f 100644
--- a/BurnOutSharp/PackerType/InnoSetup.cs
+++ b/BurnOutSharp/PackerType/InnoSetup.cs
@@ -35,11 +35,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentDictionary> Scan(Scanner scanner, string file)
diff --git a/BurnOutSharp/PackerType/InstallerVISE.cs b/BurnOutSharp/PackerType/InstallerVISE.cs
index fabf906e..e59d3c03 100644
--- a/BurnOutSharp/PackerType/InstallerVISE.cs
+++ b/BurnOutSharp/PackerType/InstallerVISE.cs
@@ -22,13 +22,9 @@ namespace BurnOutSharp.PackerType
};
}
+ //TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds.
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- //TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds.
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
// TODO: Add Installer VISE extraction
// https://github.com/Bioruebe/UniExtract2
diff --git a/BurnOutSharp/PackerType/IntelInstallationFramework.cs b/BurnOutSharp/PackerType/IntelInstallationFramework.cs
index 3045c8ce..9ff1d0c8 100644
--- a/BurnOutSharp/PackerType/IntelInstallationFramework.cs
+++ b/BurnOutSharp/PackerType/IntelInstallationFramework.cs
@@ -61,8 +61,7 @@ namespace BurnOutSharp.PackerType
return $"Intel Installation Framework {Utilities.GetFileVersion(file)}";
}
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
+ return null;
}
}
}
diff --git a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs
index a6b301c4..332908ed 100644
--- a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs
+++ b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs
@@ -72,8 +72,7 @@ namespace BurnOutSharp.PackerType
return "Microsoft CAB SFX";
}
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
+ return null;
}
///
diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs
index 738189a6..3522e0fd 100644
--- a/BurnOutSharp/PackerType/NSIS.cs
+++ b/BurnOutSharp/PackerType/NSIS.cs
@@ -31,11 +31,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs
index e64163a7..9bff21b0 100644
--- a/BurnOutSharp/PackerType/PECompact.cs
+++ b/BurnOutSharp/PackerType/PECompact.cs
@@ -29,11 +29,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
// TODO: Improve version detection, Protection ID is able to detect ranges of versions. For example, 1.66-1.84 or 2.20-3.02.
public static string GetVersion(string file, byte[] fileContent, List positions)
diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs
index ea8e76cd..f4325d7b 100644
--- a/BurnOutSharp/PackerType/SetupFactory.cs
+++ b/BurnOutSharp/PackerType/SetupFactory.cs
@@ -49,11 +49,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentDictionary> Scan(Scanner scanner, string file)
diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs
index 97e1efdd..e8c1bce3 100644
--- a/BurnOutSharp/PackerType/UPX.cs
+++ b/BurnOutSharp/PackerType/UPX.cs
@@ -47,11 +47,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs
index 0501189b..f78c7763 100644
--- a/BurnOutSharp/PackerType/WinRARSFX.cs
+++ b/BurnOutSharp/PackerType/WinRARSFX.cs
@@ -30,11 +30,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public ConcurrentDictionary> Scan(Scanner scanner, string file)
{
diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs
index fd968f92..51007b0c 100644
--- a/BurnOutSharp/PackerType/WinZipSFX.cs
+++ b/BurnOutSharp/PackerType/WinZipSFX.cs
@@ -33,11 +33,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
// TODO: Find a way to generically detect 2.X versions and improve exact version detection for SFX PE versions bundled with WinZip 11+
diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs
index 1ef7c1dc..06cc657c 100644
--- a/BurnOutSharp/PackerType/WiseInstaller.cs
+++ b/BurnOutSharp/PackerType/WiseInstaller.cs
@@ -24,11 +24,7 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentDictionary> Scan(Scanner scanner, string file)
diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs
index 06da0b68..3e784909 100644
--- a/BurnOutSharp/PackerType/dotFuscator.cs
+++ b/BurnOutSharp/PackerType/dotFuscator.cs
@@ -21,10 +21,6 @@ namespace BurnOutSharp.PackerType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs
index 9ac2d9d8..20e66378 100644
--- a/BurnOutSharp/ProtectionType/ActiveMARK.cs
+++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs
@@ -24,10 +24,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs
index d867f909..228fe49a 100644
--- a/BurnOutSharp/ProtectionType/AlphaROM.cs
+++ b/BurnOutSharp/ProtectionType/AlphaROM.cs
@@ -16,10 +16,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/Bitpool.cs b/BurnOutSharp/ProtectionType/Bitpool.cs
index a0d1e0e4..81494725 100644
--- a/BurnOutSharp/ProtectionType/Bitpool.cs
+++ b/BurnOutSharp/ProtectionType/Bitpool.cs
@@ -28,11 +28,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs
index 58d64f36..125da3ca 100644
--- a/BurnOutSharp/ProtectionType/CDCheck.cs
+++ b/BurnOutSharp/ProtectionType/CDCheck.cs
@@ -23,11 +23,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
// These content checks are too broad to be useful
private static string CheckContentsBroad(string file, byte[] fileContent, bool includeDebug = false)
diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs
index c2acff18..a578447d 100644
--- a/BurnOutSharp/ProtectionType/CDCops.cs
+++ b/BurnOutSharp/ProtectionType/CDCops.cs
@@ -26,11 +26,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/CDKey.cs b/BurnOutSharp/ProtectionType/CDKey.cs
index 2c03772d..f24d997f 100644
--- a/BurnOutSharp/ProtectionType/CDKey.cs
+++ b/BurnOutSharp/ProtectionType/CDKey.cs
@@ -24,10 +24,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs
index af01c942..30f00918 100644
--- a/BurnOutSharp/ProtectionType/CDLock.cs
+++ b/BurnOutSharp/ProtectionType/CDLock.cs
@@ -23,11 +23,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
index 17e9d4ae..93ff7eb2 100644
--- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
+++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
@@ -16,10 +16,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs
index f89c65d1..6dee461b 100644
--- a/BurnOutSharp/ProtectionType/CactusDataShield.cs
+++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs
@@ -27,11 +27,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
index f3244156..8373adda 100644
--- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
+++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
@@ -16,10 +16,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs
index 0fc5f0d6..32836e1e 100644
--- a/BurnOutSharp/ProtectionType/CodeLock.cs
+++ b/BurnOutSharp/ProtectionType/CodeLock.cs
@@ -27,10 +27,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs
index b78d9bbb..8d36091f 100644
--- a/BurnOutSharp/ProtectionType/CopyKiller.cs
+++ b/BurnOutSharp/ProtectionType/CopyKiller.cs
@@ -21,11 +21,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs
index 73a3dee3..6fee2ca0 100644
--- a/BurnOutSharp/ProtectionType/DVDCops.cs
+++ b/BurnOutSharp/ProtectionType/DVDCops.cs
@@ -22,11 +22,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs
index 81c9ac9a..af4c5d20 100644
--- a/BurnOutSharp/ProtectionType/ElectronicArts.cs
+++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs
@@ -99,10 +99,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs
index 3d8e8ab7..788a99db 100644
--- a/BurnOutSharp/ProtectionType/GFWL.cs
+++ b/BurnOutSharp/ProtectionType/GFWL.cs
@@ -47,11 +47,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs
index 5d2ccc21..12718d09 100644
--- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs
+++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs
@@ -45,11 +45,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs
index 21cefd89..da4ebf68 100644
--- a/BurnOutSharp/ProtectionType/Intenium.cs
+++ b/BurnOutSharp/ProtectionType/Intenium.cs
@@ -32,10 +32,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs
index 0523c9f6..7aa54a51 100644
--- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs
+++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs
@@ -36,11 +36,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs
index 1dc3e657..b4de768d 100644
--- a/BurnOutSharp/ProtectionType/KeyLock.cs
+++ b/BurnOutSharp/ProtectionType/KeyLock.cs
@@ -20,10 +20,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs
index 0b0c3096..42fd0d2e 100644
--- a/BurnOutSharp/ProtectionType/LaserLock.cs
+++ b/BurnOutSharp/ProtectionType/LaserLock.cs
@@ -64,8 +64,7 @@ namespace BurnOutSharp.ProtectionType
if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase))
return $"LaserLock {GetVersion16Bit(fileContent)}" + (includeDebug ? $" (Index 71)" : string.Empty);
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
+ return null;
}
///
diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs
index 559c4db5..c9a270fc 100644
--- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs
+++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs
@@ -24,11 +24,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs
index 8644e967..5180da53 100644
--- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs
+++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs
@@ -24,10 +24,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs
index e408d0d3..3220b6c6 100644
--- a/BurnOutSharp/ProtectionType/Origin.cs
+++ b/BurnOutSharp/ProtectionType/Origin.cs
@@ -17,11 +17,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
index 7d3bdb57..76408318 100644
--- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
+++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
@@ -44,10 +44,6 @@ namespace BurnOutSharp.ProtectionType
// TODO: Figure out PSX binary header so this can be checked explicitly
// TODO: Detect Red Hand protection
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs
index 9ebf0e80..1172a148 100644
--- a/BurnOutSharp/ProtectionType/ProtectDisc.cs
+++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs
@@ -25,11 +25,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion6till8(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs
index 00734d1e..298825ae 100644
--- a/BurnOutSharp/ProtectionType/RingPROTECH.cs
+++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs
@@ -20,10 +20,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs
index c6c51a88..77e638e8 100644
--- a/BurnOutSharp/ProtectionType/SVKProtector.cs
+++ b/BurnOutSharp/ProtectionType/SVKProtector.cs
@@ -16,10 +16,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs
index 7a8e7539..1daf8c06 100644
--- a/BurnOutSharp/ProtectionType/SafeDisc.cs
+++ b/BurnOutSharp/ProtectionType/SafeDisc.cs
@@ -84,11 +84,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs
index 6e91c1ab..489aaeaa 100644
--- a/BurnOutSharp/ProtectionType/SafeLock.cs
+++ b/BurnOutSharp/ProtectionType/SafeLock.cs
@@ -17,11 +17,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs
index f14fd863..e9ac6f01 100644
--- a/BurnOutSharp/ProtectionType/SecuROM.cs
+++ b/BurnOutSharp/ProtectionType/SecuROM.cs
@@ -56,11 +56,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs
index 3ce85471..3d9136f4 100644
--- a/BurnOutSharp/ProtectionType/SmartE.cs
+++ b/BurnOutSharp/ProtectionType/SmartE.cs
@@ -18,11 +18,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs
index 31d840de..d7d369cb 100644
--- a/BurnOutSharp/ProtectionType/SolidShield.cs
+++ b/BurnOutSharp/ProtectionType/SolidShield.cs
@@ -93,11 +93,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs
index e38fd4da..ee26e2f9 100644
--- a/BurnOutSharp/ProtectionType/StarForce.cs
+++ b/BurnOutSharp/ProtectionType/StarForce.cs
@@ -117,11 +117,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs
index 132b4ea1..27535d6b 100644
--- a/BurnOutSharp/ProtectionType/Sysiphus.cs
+++ b/BurnOutSharp/ProtectionType/Sysiphus.cs
@@ -27,11 +27,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
public static string GetVersion(string file, byte[] fileContent, List positions)
{
diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs
index c9e986b1..6b7a802b 100644
--- a/BurnOutSharp/ProtectionType/Tages.cs
+++ b/BurnOutSharp/ProtectionType/Tages.cs
@@ -39,11 +39,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs
index da4a27fd..3c6f933a 100644
--- a/BurnOutSharp/ProtectionType/ThreePLock.cs
+++ b/BurnOutSharp/ProtectionType/ThreePLock.cs
@@ -30,10 +30,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
index ccde7b5e..8d443f1d 100644
--- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
+++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
@@ -24,10 +24,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
index 0aa192e3..2bbd5b08 100644
--- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
+++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs
@@ -33,11 +33,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
index 9f47507c..8e741ef2 100644
--- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs
+++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
@@ -37,11 +37,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs
index ee590950..cf471980 100644
--- a/BurnOutSharp/ProtectionType/XCP.cs
+++ b/BurnOutSharp/ProtectionType/XCP.cs
@@ -45,11 +45,7 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
///
public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files)
diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs
index d027e83b..fe6fe0bb 100644
--- a/BurnOutSharp/ProtectionType/XtremeProtector.cs
+++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs
@@ -16,10 +16,6 @@ namespace BurnOutSharp.ProtectionType
}
///
- public string CheckContents(string file, byte[] fileContent, bool includeDebug = false)
- {
- var matchers = GetContentMatchSets();
- return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
- }
+ public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) => null;
}
}
diff --git a/BurnOutSharp/Tools/Utilities.cs b/BurnOutSharp/Tools/Utilities.cs
index c99ac0be..1e51eacf 100644
--- a/BurnOutSharp/Tools/Utilities.cs
+++ b/BurnOutSharp/Tools/Utilities.cs
@@ -22,6 +22,10 @@ namespace BurnOutSharp.Tools
/// String value to add
public static void AppendToDictionary(ConcurrentDictionary> original, string key, string value)
{
+ // If the value is empty, don't add it
+ if (string.IsNullOrWhiteSpace(value))
+ return;
+
var values = new ConcurrentQueue();
values.Enqueue(value);
AppendToDictionary(original, key, values);