From 43845cf722441d1d8b8c486a30168da343448bae Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 24 Aug 2021 15:19:23 -0700 Subject: [PATCH] Rename position flag -> debug flag --- BurnOutSharp/FileType/Executable.cs | 2 +- BurnOutSharp/IContentCheck.cs | 4 ++-- BurnOutSharp/Matching/MatchUtil.cs | 20 +++++++++---------- BurnOutSharp/PackerType/AdvancedInstaller.cs | 4 ++-- BurnOutSharp/PackerType/Armadillo.cs | 4 ++-- BurnOutSharp/PackerType/CExe.cs | 4 ++-- BurnOutSharp/PackerType/EXEStealth.cs | 4 ++-- BurnOutSharp/PackerType/InnoSetup.cs | 4 ++-- BurnOutSharp/PackerType/InstallerVISE.cs | 4 ++-- .../PackerType/IntelInstallationFramework.cs | 4 ++-- BurnOutSharp/PackerType/MicrosoftCABSFX.cs | 4 ++-- BurnOutSharp/PackerType/NSIS.cs | 4 ++-- BurnOutSharp/PackerType/PECompact.cs | 4 ++-- BurnOutSharp/PackerType/SetupFactory.cs | 4 ++-- BurnOutSharp/PackerType/UPX.cs | 4 ++-- BurnOutSharp/PackerType/WinRARSFX.cs | 4 ++-- BurnOutSharp/PackerType/WinZipSFX.cs | 4 ++-- BurnOutSharp/PackerType/WiseInstaller.cs | 4 ++-- BurnOutSharp/PackerType/dotFuscator.cs | 4 ++-- BurnOutSharp/ProtectionType/ActiveMARK.cs | 4 ++-- BurnOutSharp/ProtectionType/AlphaROM.cs | 4 ++-- BurnOutSharp/ProtectionType/Bitpool.cs | 4 ++-- BurnOutSharp/ProtectionType/CDCheck.cs | 8 ++++---- BurnOutSharp/ProtectionType/CDCops.cs | 4 ++-- BurnOutSharp/ProtectionType/CDKey.cs | 4 ++-- BurnOutSharp/ProtectionType/CDLock.cs | 4 ++-- BurnOutSharp/ProtectionType/CDSHiELDSE.cs | 4 ++-- .../ProtectionType/CactusDataShield.cs | 4 ++-- .../ProtectionType/CengaProtectDVD.cs | 4 ++-- BurnOutSharp/ProtectionType/CodeLock.cs | 4 ++-- BurnOutSharp/ProtectionType/CopyKiller.cs | 4 ++-- BurnOutSharp/ProtectionType/DVDCops.cs | 4 ++-- BurnOutSharp/ProtectionType/ElectronicArts.cs | 4 ++-- BurnOutSharp/ProtectionType/GFWL.cs | 4 ++-- BurnOutSharp/ProtectionType/ImpulseReactor.cs | 4 ++-- BurnOutSharp/ProtectionType/Intenium.cs | 4 ++-- BurnOutSharp/ProtectionType/JoWooDXProt.cs | 4 ++-- BurnOutSharp/ProtectionType/KeyLock.cs | 4 ++-- BurnOutSharp/ProtectionType/LaserLock.cs | 12 +++++------ BurnOutSharp/ProtectionType/MediaMaxCD3.cs | 4 ++-- .../ProtectionType/OnlineRegistration.cs | 4 ++-- BurnOutSharp/ProtectionType/Origin.cs | 4 ++-- BurnOutSharp/ProtectionType/PSXAntiModchip.cs | 4 ++-- BurnOutSharp/ProtectionType/ProtectDisc.cs | 4 ++-- BurnOutSharp/ProtectionType/RingPROTECH.cs | 4 ++-- BurnOutSharp/ProtectionType/SVKProtector.cs | 4 ++-- BurnOutSharp/ProtectionType/SafeDisc.cs | 4 ++-- BurnOutSharp/ProtectionType/SafeLock.cs | 4 ++-- BurnOutSharp/ProtectionType/SecuROM.cs | 4 ++-- BurnOutSharp/ProtectionType/SmartE.cs | 4 ++-- BurnOutSharp/ProtectionType/SolidShield.cs | 4 ++-- BurnOutSharp/ProtectionType/StarForce.cs | 4 ++-- BurnOutSharp/ProtectionType/Sysiphus.cs | 4 ++-- BurnOutSharp/ProtectionType/Tages.cs | 4 ++-- BurnOutSharp/ProtectionType/ThreePLock.cs | 4 ++-- .../ProtectionType/ThreeTwoOneStudios.cs | 4 ++-- .../ProtectionType/VOBProtectCDDVD.cs | 4 ++-- BurnOutSharp/ProtectionType/WTMCDProtect.cs | 4 ++-- BurnOutSharp/ProtectionType/XCP.cs | 4 ++-- .../ProtectionType/XtremeProtector.cs | 4 ++-- BurnOutSharp/Scanner.cs | 5 ++--- Test/Program.cs | 2 +- 62 files changed, 136 insertions(+), 137 deletions(-) diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index c2406a55..14fbd152 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -90,7 +90,7 @@ namespace BurnOutSharp.FileType // Iterate through all content checks Parallel.ForEach(contentCheckClasses, contentCheckClass => { - string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludePosition); + string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug); // If we have a valid content check based on settings if (!contentCheckClass.GetType().Namespace.ToLowerInvariant().Contains("packertype") || scanner.ScanPackers) diff --git a/BurnOutSharp/IContentCheck.cs b/BurnOutSharp/IContentCheck.cs index f850d2d8..c7c66897 100644 --- a/BurnOutSharp/IContentCheck.cs +++ b/BurnOutSharp/IContentCheck.cs @@ -9,8 +9,8 @@ /// /// File to check for protection indicators /// Byte array representing the file contents - /// True to include positional data, false otherwise + /// True to include debug data, false otherwise /// String containing any protections found in the file - string CheckContents(string file, byte[] fileContent, bool includePosition); + string CheckContents(string file, byte[] fileContent, bool includeDebug); } } diff --git a/BurnOutSharp/Matching/MatchUtil.cs b/BurnOutSharp/Matching/MatchUtil.cs index 0b3e78d0..1aa507eb 100644 --- a/BurnOutSharp/Matching/MatchUtil.cs +++ b/BurnOutSharp/Matching/MatchUtil.cs @@ -17,15 +17,15 @@ namespace BurnOutSharp.Matching /// File to check for matches /// Byte array representing the file contents /// Enumerable of ContentMatchSets to be run on the file - /// True to include positional data, false otherwise + /// True to include positional data, false otherwise /// List of strings representing the matched protections, null or empty otherwise public static ConcurrentQueue GetAllMatches( string file, byte[] fileContent, IEnumerable matchers, - bool includePosition = false) + bool includeDebug = false) { - return FindAllMatches(file, fileContent, matchers, includePosition, false); + return FindAllMatches(file, fileContent, matchers, includeDebug, false); } /// @@ -34,15 +34,15 @@ namespace BurnOutSharp.Matching /// File to check for matches /// Byte array representing the file contents /// Enumerable of ContentMatchSets to be run on the file - /// True to include positional data, false otherwise + /// True to include positional data, false otherwise /// String representing the matched protection, null otherwise public static string GetFirstMatch( string file, byte[] fileContent, IEnumerable matchers, - bool includePosition = false) + bool includeDebug = false) { - var contentMatches = FindAllMatches(file, fileContent, matchers, includePosition, true); + var contentMatches = FindAllMatches(file, fileContent, matchers, includeDebug, true); if (contentMatches == null || !contentMatches.Any()) return null; @@ -55,14 +55,14 @@ namespace BurnOutSharp.Matching /// File to check for matches /// Byte array representing the file contents /// Enumerable of ContentMatchSets to be run on the file - /// True to include positional data, false otherwise + /// True to include positional data, false otherwise /// True to stop after the first match, false otherwise /// List of strings representing the matched protections, null or empty otherwise private static ConcurrentQueue FindAllMatches( string file, byte[] fileContent, IEnumerable matchers, - bool includePosition, + bool includeDebug, bool stopAfterFirst) { // If there's no mappings, we can't match @@ -86,7 +86,7 @@ namespace BurnOutSharp.Matching // If we there is no version method, just return the protection name if (matcher.GetVersion == null) { - matchedProtections.Enqueue((matcher.ProtectionName ?? "Unknown Protection") + (includePosition ? $" (Index {positionsString})" : string.Empty)); + matchedProtections.Enqueue((matcher.ProtectionName ?? "Unknown Protection") + (includeDebug ? $" (Index {positionsString})" : string.Empty)); } // Otherwise, invoke the version method @@ -97,7 +97,7 @@ namespace BurnOutSharp.Matching if (version == null) continue; - matchedProtections.Enqueue($"{matcher.ProtectionName ?? "Unknown Protection"} {version}".TrimEnd() + (includePosition ? $" (Index {positionsString})" : string.Empty)); + matchedProtections.Enqueue($"{matcher.ProtectionName ?? "Unknown Protection"} {version}".TrimEnd() + (includeDebug ? $" (Index {positionsString})" : string.Empty)); } // If we're stopping after the first protection, bail out here diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs index f3491d5e..c15b3bf2 100644 --- a/BurnOutSharp/PackerType/AdvancedInstaller.cs +++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.PackerType public class AdvancedInstaller : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -22,7 +22,7 @@ namespace BurnOutSharp.PackerType }, "Caphyon Advanced Installer"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs index 072aa6ae..6832c7a1 100644 --- a/BurnOutSharp/PackerType/Armadillo.cs +++ b/BurnOutSharp/PackerType/Armadillo.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.PackerType public class Armadillo : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -17,7 +17,7 @@ namespace BurnOutSharp.PackerType new ContentMatchSet(new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }, "Armadillo"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs index baf4ec7b..ebc89424 100644 --- a/BurnOutSharp/PackerType/CExe.cs +++ b/BurnOutSharp/PackerType/CExe.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -30,7 +30,7 @@ namespace BurnOutSharp.PackerType }, end: 200), "CExe"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs index 31d1f464..4fb0b79a 100644 --- a/BurnOutSharp/PackerType/EXEStealth.cs +++ b/BurnOutSharp/PackerType/EXEStealth.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.PackerType public class EXEStealth : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,7 +21,7 @@ namespace BurnOutSharp.PackerType }, "EXE Stealth"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs index 9b55378d..c749c3f5 100644 --- a/BurnOutSharp/PackerType/InnoSetup.cs +++ b/BurnOutSharp/PackerType/InnoSetup.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -33,7 +33,7 @@ namespace BurnOutSharp.PackerType "Inno Setup"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/PackerType/InstallerVISE.cs b/BurnOutSharp/PackerType/InstallerVISE.cs index 11debac7..a2ad8743 100644 --- a/BurnOutSharp/PackerType/InstallerVISE.cs +++ b/BurnOutSharp/PackerType/InstallerVISE.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -23,7 +23,7 @@ namespace BurnOutSharp.PackerType "Installer VISE"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } // TODO: Add Installer VISE extraction diff --git a/BurnOutSharp/PackerType/IntelInstallationFramework.cs b/BurnOutSharp/PackerType/IntelInstallationFramework.cs index be8bce67..20040beb 100644 --- a/BurnOutSharp/PackerType/IntelInstallationFramework.cs +++ b/BurnOutSharp/PackerType/IntelInstallationFramework.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType public class IntelInstallationFramework : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var fvinfo = Utilities.GetFileVersionInfo(file); @@ -56,7 +56,7 @@ namespace BurnOutSharp.PackerType }, Utilities.GetFileVersion, "Intel Installation Framework"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs index 1ed22850..c92213f2 100644 --- a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs +++ b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var fvinfo = Utilities.GetFileVersionInfo(file); @@ -67,7 +67,7 @@ namespace BurnOutSharp.PackerType new ContentMatchSet(new byte?[] { 0x4D, 0x53, 0x43, 0x46, 0x75 }, GetVersion, "Microsoft CAB SFX"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index d0607c13..18c69710 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.PackerType public class NSIS : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -29,7 +29,7 @@ namespace BurnOutSharp.PackerType }, "NSIS"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index 251823a3..11164924 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType public class PECompact : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { // Another possible version string for version 1 is "PECO" (50 45 43 4F) var matchers = new List @@ -27,7 +27,7 @@ namespace BurnOutSharp.PackerType }, "PE Compact 2"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } // TODO: Improve version detection, Protection ID is able to detect ranges of versions. For example, 1.66-1.84 or 2.20-3.02. diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs index 7bd54a12..daaac6dc 100644 --- a/BurnOutSharp/PackerType/SetupFactory.cs +++ b/BurnOutSharp/PackerType/SetupFactory.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -45,7 +45,7 @@ namespace BurnOutSharp.PackerType // }, GetVersion, "Setup Factory"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs index 0bb5df16..19859209 100644 --- a/BurnOutSharp/PackerType/UPX.cs +++ b/BurnOutSharp/PackerType/UPX.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.PackerType public class UPX : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -45,7 +45,7 @@ namespace BurnOutSharp.PackerType ), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs index 2190712f..faf854eb 100644 --- a/BurnOutSharp/PackerType/WinRARSFX.cs +++ b/BurnOutSharp/PackerType/WinRARSFX.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -27,7 +27,7 @@ namespace BurnOutSharp.PackerType }, "WinRAR SFX"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public ConcurrentDictionary> Scan(Scanner scanner, string file) diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index dc0c6a0b..9dee7558 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -14,7 +14,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -30,7 +30,7 @@ namespace BurnOutSharp.PackerType new ContentMatchSet(new byte?[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }, GetVersion, "WinZip SFX"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } // 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 09d09724..7ffb547a 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,7 +21,7 @@ namespace BurnOutSharp.PackerType new ContentMatchSet(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, "Wise Installation Wizard Module"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs index e68f6d03..c3ffbf5b 100644 --- a/BurnOutSharp/PackerType/dotFuscator.cs +++ b/BurnOutSharp/PackerType/dotFuscator.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.PackerType public class dotFuscator : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -19,7 +19,7 @@ namespace BurnOutSharp.PackerType }, "dotFuscator"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index db94da3c..b6ad10b8 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class ActiveMARK : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType }, "ActiveMARK 5"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index 80ff9e17..c2a4f978 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class AlphaROM : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/Bitpool.cs b/BurnOutSharp/ProtectionType/Bitpool.cs index b467c2b7..255ba131 100644 --- a/BurnOutSharp/ProtectionType/Bitpool.cs +++ b/BurnOutSharp/ProtectionType/Bitpool.cs @@ -13,7 +13,7 @@ namespace BurnOutSharp.ProtectionType public class Bitpool : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -26,7 +26,7 @@ namespace BurnOutSharp.ProtectionType }, "Bitpool"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index c1e269a1..dd350333 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class CDCheck : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,11 +21,11 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Executable-Based CD Check"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } // These content checks are too broad to be useful - private static string CheckContentsBroad(string file, byte[] fileContent, bool includePosition = false) + private static string CheckContentsBroad(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -45,7 +45,7 @@ namespace BurnOutSharp.ProtectionType }, "Executable-Based CD Check"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index a777e904..8b99b170 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType public class CDCops : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -24,7 +24,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00 }, "CD-Cops"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/CDKey.cs b/BurnOutSharp/ProtectionType/CDKey.cs index 8a2e7a2a..89d3f977 100644 --- a/BurnOutSharp/ProtectionType/CDKey.cs +++ b/BurnOutSharp/ProtectionType/CDKey.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class CDKey : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,7 +21,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "CD-Key / Serial"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index 348c7c30..76e765f5 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class CDLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,7 +21,7 @@ namespace BurnOutSharp.ProtectionType }, "CD-Lock"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index 4fa47284..1b103b90 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class CDSHiELDSE : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index 3bd08851..8b1bc15b 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public class CactusDataShield : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }, "Cactus Data Shield 200"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs index 13c8c35d..f1ddd2dd 100644 --- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class CengaProtectDVD : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index 1a4b2a75..9dee13e7 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class CodeLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { // TODO: Verify if these are OR or AND var matchers = new List @@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType }, "Code Lock"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index 8f6c0d04..898ffde7 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class CopyKiller : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -19,7 +19,7 @@ namespace BurnOutSharp.ProtectionType }, "CopyKiller"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index 788d82ef..a108f248 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ProtectionType public class DVDCops : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -20,7 +20,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "DVD-Cops"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 73972937..b4527bf8 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType // - Reference to `EASTL` and `EAStdC` are standard for EA products and does not indicate Cucko by itself // - There's little information outside of PiD detection that actually knows about Cucko /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -96,7 +96,7 @@ namespace BurnOutSharp.ProtectionType }, "EA DRM Protection"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index b7a675a1..fc5140fc 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class GFWL : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -44,7 +44,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "Games for Windows LIVE"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index c566e370..e4ce6115 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class ImpulseReactor : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -42,7 +42,7 @@ namespace BurnOutSharp.ProtectionType }, "Impulse Reactor"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs index 082f6af9..8524350e 100644 --- a/BurnOutSharp/ProtectionType/Intenium.cs +++ b/BurnOutSharp/ProtectionType/Intenium.cs @@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType */ /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -30,7 +30,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }, "INTENIUM Trial & Buy Protection"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs index a5928931..5fe80ce9 100644 --- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs +++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ProtectionType public class JoWooDXProt : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -34,7 +34,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v1"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index d65b8cad..c4205f05 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class KeyLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -18,7 +18,7 @@ namespace BurnOutSharp.ProtectionType }, "Key-Lock (Dongle)"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs index b077652a..0d58eafb 100644 --- a/BurnOutSharp/ProtectionType/LaserLock.cs +++ b/BurnOutSharp/ProtectionType/LaserLock.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public class LaserLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { // "Packed by SPEEnc V2 Asterios Parlamentas.PE" byte?[] check = new byte?[] { 0x50, 0x61, 0x63, 0x6B, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x53, 0x50, 0x45, 0x45, 0x6E, 0x63, 0x20, 0x56, 0x32, 0x20, 0x41, 0x73, 0x74, 0x65, 0x72, 0x69, 0x6F, 0x73, 0x20, 0x50, 0x61, 0x72, 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; @@ -22,14 +22,14 @@ namespace BurnOutSharp.ProtectionType bool containsCheck2 = fileContent.FirstPosition(check2, out int position2); if (containsCheck && containsCheck2) - return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty); + return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)}" + (includeDebug ? $" (Index {position}, {position2})" : string.Empty); else if (containsCheck && !containsCheck2) - return $"LaserLock Marathon {GetBuild(fileContent, false)}" + (includePosition ? $" (Index {position})" : string.Empty); + return $"LaserLock Marathon {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position})" : string.Empty); else if (!containsCheck && containsCheck2) - return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)}" + (includePosition ? $" (Index {position2})" : string.Empty); + return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position2})" : string.Empty); if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)) - return $"LaserLock {GetVersion16Bit(fileContent)}" + (includePosition ? $" (Index 71)" : string.Empty); + return $"LaserLock {GetVersion16Bit(fileContent)}" + (includeDebug ? $" (Index 71)" : string.Empty); var matchers = new List { @@ -59,7 +59,7 @@ namespace BurnOutSharp.ProtectionType }, "LaserLock 5"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs index 614ef7c5..59d6c790 100644 --- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs +++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class MediaMaxCD3 : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType }, "MediaMax CD-3"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs index dcad8605..3e3fabf8 100644 --- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class OnlineRegistration : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -21,7 +21,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "Executable-Based Online Registration"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs index acfd0025..3df4fec4 100644 --- a/BurnOutSharp/ProtectionType/Origin.cs +++ b/BurnOutSharp/ProtectionType/Origin.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class Origin : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00 }, "Origin"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs index b4548c89..655dd308 100644 --- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs +++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs @@ -8,7 +8,7 @@ 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 includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -42,7 +42,7 @@ namespace BurnOutSharp.ProtectionType }, "PlayStation Anti-modchip (Japanese)"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index f8e2799f..ab8ed2df 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public class ProtectDisc : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }, GetVersion6till8, "ProtectDisc"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion6till8(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index 2ecff1b0..79b025c7 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class RingPROTECH : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -18,7 +18,7 @@ namespace BurnOutSharp.ProtectionType }, "Ring PROTECH [Check disc for physical ring]"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs index 5090d84e..02cf1d7a 100644 --- a/BurnOutSharp/ProtectionType/SVKProtector.cs +++ b/BurnOutSharp/ProtectionType/SVKProtector.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class SVKProtector : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }, "SVK Protector"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index b5c6366d..79d4a9da 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -39,7 +39,7 @@ namespace BurnOutSharp.ProtectionType }; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -81,7 +81,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }, Get320to4xVersion, "SafeDisc"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 0d5a1c03..10cee201 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class SafeLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index 12a3c7e1..20362e8a 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType public class SecuROM : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -53,7 +53,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index 26e72963..63fdfd27 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ProtectionType public class SmartE : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -16,7 +16,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index bfac9dfc..d2309d4a 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -20,7 +20,7 @@ namespace BurnOutSharp.ProtectionType }; /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -90,7 +90,7 @@ namespace BurnOutSharp.ProtectionType }, "SolidShield"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 39b84d72..fd49697f 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -8,7 +8,7 @@ namespace BurnOutSharp.ProtectionType public class StarForce : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -114,7 +114,7 @@ namespace BurnOutSharp.ProtectionType }, "StarForce 5"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index 1ca62331..627ff000 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class Sysiphus : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "Sysiphus"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } public static string GetVersion(string file, byte[] fileContent, List positions) diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index e69480c4..a60f91c3 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType public class Tages : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }, GetVersion, "TAGES"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index 6dc32a72..972b82a9 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class ThreePLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -28,7 +28,7 @@ namespace BurnOutSharp.ProtectionType // }, "3PLock"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs index 358abdba..69bb8a7b 100644 --- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs +++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class ThreeTwoOneStudios : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType }, "321Studios Online Activation"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs index 4f3e761b..dfc5d9a9 100644 --- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs +++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs @@ -12,7 +12,7 @@ namespace BurnOutSharp.ProtectionType public class VOBProtectCDDVD : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -30,7 +30,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }, "VOB ProtectCD"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index 1d401946..b5f929c6 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType public class WTMCDProtect : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -35,7 +35,7 @@ namespace BurnOutSharp.ProtectionType }, "WTM Protection Viewer"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index 8edf6414..6c625048 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -12,7 +12,7 @@ namespace BurnOutSharp.ProtectionType public class XCP : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -43,7 +43,7 @@ namespace BurnOutSharp.ProtectionType }, "XCP"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } /// diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs index 09a3611e..6e6e43a9 100644 --- a/BurnOutSharp/ProtectionType/XtremeProtector.cs +++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType public class XtremeProtector : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includePosition = false) + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) { var matchers = new List { @@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType new ContentMatchSet(new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }, "Xtreme-Protector"), }; - return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); + return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } } diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs index 3d59dec4..c8993421 100644 --- a/BurnOutSharp/Scanner.cs +++ b/BurnOutSharp/Scanner.cs @@ -17,10 +17,9 @@ namespace BurnOutSharp public IProgress FileProgress { get; set; } = null; /// - /// Determines whether the byte position of found protection is included or not + /// Determines if debug information is output or not /// - /// TODO: Change this to a more generic debug flag for broader use - public bool IncludePosition { get; set; } = false; + public bool IncludeDebug { get; set; } = false; /// /// Determines whether all files are scanned or just executables are diff --git a/Test/Program.cs b/Test/Program.cs index 1f950a66..c45c4ea5 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -17,7 +17,7 @@ namespace Test // Create scanner for all paths var scanner = new Scanner(p) { - IncludePosition = true, + IncludeDebug = true, ScanAllFiles = false, ScanArchives = true, ScanPackers = true,