diff --git a/BurnOutSharp/Matching/ContentMatch.cs b/BurnOutSharp/Matching/ContentMatch.cs index b272ab26..d5f87629 100644 --- a/BurnOutSharp/Matching/ContentMatch.cs +++ b/BurnOutSharp/Matching/ContentMatch.cs @@ -1,11 +1,9 @@ -using System.Diagnostics.Eventing.Reader; - namespace BurnOutSharp.Matching { /// /// Content matching criteria /// - internal class ContentMatch + internal class ContentMatch : IMatch { /// /// Content to match @@ -22,6 +20,12 @@ namespace BurnOutSharp.Matching /// public int End { get; set; } + /// + /// Constructor + /// + /// Byte array representing the search + /// Optional starting index + /// Optional ending index public ContentMatch(byte?[] needle, int start = -1, int end = -1) { Needle = needle; @@ -36,7 +40,8 @@ namespace BurnOutSharp.Matching /// /// Array to search for the given content /// True to search from the end of the array, false from the start - public (bool, int) Match(byte[] stack, bool reverse = false) + /// Tuple of success and found position + public (bool success, int position) Match(byte[] stack, bool reverse = false) { // If either array is null or empty, we can't do anything if (stack == null || stack.Length == 0 || Needle == null || Needle.Length == 0) @@ -66,6 +71,7 @@ namespace BurnOutSharp.Matching /// /// Array to search for the given content /// Starting index to check equality + /// True if the needle matches the stack at a given index private bool EqualAt(byte[] stack, int index) { // If the index is invalid, we can't do anything diff --git a/BurnOutSharp/Matching/ContentMatchSet.cs b/BurnOutSharp/Matching/ContentMatchSet.cs new file mode 100644 index 00000000..de756202 --- /dev/null +++ b/BurnOutSharp/Matching/ContentMatchSet.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BurnOutSharp.Matching +{ + /// + /// A set of content matches that work together + /// + internal class ContentMatchSet : MatchSet + { + /// + /// Function to get a content version + /// + /// + /// A content version method takes the file path, the file contents, + /// and a list of found positions and returns a single string. That + /// string is either a version string, in which case it will be appended + /// to the protection name, or `null`, in which case it will cause + /// the protection to be omitted. + /// + public Func, string> GetVersion { get; set; } + + #region Constructors + + public ContentMatchSet(byte?[] needle, string protectionName) + : this(new List { needle }, null, protectionName) { } + + public ContentMatchSet(List needles, string protectionName) + : this(needles, null, protectionName) { } + + public ContentMatchSet(byte?[] needle, Func, string> getVersion, string protectionName) + : this(new List { needle }, getVersion, protectionName) { } + + public ContentMatchSet(List needles, Func, string> getVersion, string protectionName) + : this(needles.Select(n => new ContentMatch(n)).ToList(), getVersion, protectionName) { } + + public ContentMatchSet(ContentMatch needle, string protectionName) + : this(new List() { needle }, null, protectionName) { } + + public ContentMatchSet(List needles, string protectionName) + : this(needles, null, protectionName) { } + + public ContentMatchSet(ContentMatch needle, Func, string> getVersion, string protectionName) + : this(new List() { needle }, getVersion, protectionName) { } + + public ContentMatchSet(List needles, Func, string> getVersion, string protectionName) + { + Matchers = needles; + GetVersion = getVersion; + ProtectionName = protectionName; + } + + #endregion + + #region Matching + + /// + /// Determine whether all content matches pass + /// + /// Byte array representing the file contents + /// Tuple of passing status and matching positions + public (bool, List) MatchesAll(byte[] fileContent) + { + // If no content matches are defined, we fail out + if (Matchers == null || !Matchers.Any()) + return (false, null); + + // Initialize the position list + List positions = new List(); + + // Loop through all content matches and make sure all pass + foreach (var contentMatch in Matchers) + { + (bool match, int position) = contentMatch.Match(fileContent); + if (!match) + return (false, null); + else + positions.Add(position); + } + + return (true, positions); + } + + /// + /// Determine whether any content matches pass + /// + /// Byte array representing the file contents + /// Tuple of passing status and first matching position + public (bool, int) MatchesAny(byte[] fileContent) + { + // If no content matches are defined, we fail out + if (Matchers == null || !Matchers.Any()) + return (false, -1); + + // Loop through all content matches and make sure all pass + foreach (var contentMatch in Matchers) + { + (bool match, int position) = contentMatch.Match(fileContent); + if (match) + return (true, position); + } + + return (false, -1); + } + + #endregion + } +} \ No newline at end of file diff --git a/BurnOutSharp/Matching/IMatch.cs b/BurnOutSharp/Matching/IMatch.cs new file mode 100644 index 00000000..d56f6244 --- /dev/null +++ b/BurnOutSharp/Matching/IMatch.cs @@ -0,0 +1,7 @@ +namespace BurnOutSharp.Matching +{ + internal interface IMatch + { + T Needle { get; set; } + } +} diff --git a/BurnOutSharp/Matching/MatchSet.cs b/BurnOutSharp/Matching/MatchSet.cs new file mode 100644 index 00000000..78c5ab6a --- /dev/null +++ b/BurnOutSharp/Matching/MatchSet.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace BurnOutSharp.Matching +{ + /// + /// Wrapper for a single set of matching criteria + /// + internal class MatchSet where T : IMatch + { + /// + /// Set of all matchers + /// + public IEnumerable Matchers { get; set; } + + /// + /// Name of the protection to show + /// + public string ProtectionName { get; set; } + } +} \ No newline at end of file diff --git a/BurnOutSharp/Matching/MatchUtil.cs b/BurnOutSharp/Matching/MatchUtil.cs index 6eea0cc6..1a25b1fd 100644 --- a/BurnOutSharp/Matching/MatchUtil.cs +++ b/BurnOutSharp/Matching/MatchUtil.cs @@ -15,13 +15,13 @@ namespace BurnOutSharp.Matching /// /// File to check for matches /// Byte array representing the file contents - /// Enumerable of matchers to be run on the file + /// Enumerable of ContentMatchSets to be run on the file /// True to include positional data, false otherwise /// List of strings representing the matched protections, null or empty otherwise public static List GetAllContentMatches( string file, byte[] fileContent, - IEnumerable matchers, + IEnumerable matchers, bool includePosition = false) { return FindAllContentMatches(file, fileContent, matchers, includePosition, false); @@ -32,13 +32,13 @@ namespace BurnOutSharp.Matching /// /// File to check for matches /// Byte array representing the file contents - /// Enumerable of matchers to be run on the file + /// Enumerable of ContentMatchSets to be run on the file /// True to include positional data, false otherwise /// String representing the matched protection, null otherwise public static string GetFirstContentMatch( string file, byte[] fileContent, - IEnumerable matchers, + IEnumerable matchers, bool includePosition = false) { var contentMatches = FindAllContentMatches(file, fileContent, matchers, includePosition, true); @@ -53,14 +53,14 @@ namespace BurnOutSharp.Matching /// /// File to check for matches /// Byte array representing the file contents - /// Enumerable of matchers to be run on the file + /// Enumerable of ContentMatchSets to be run on the file /// 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 List FindAllContentMatches( string file, byte[] fileContent, - IEnumerable matchers, + IEnumerable matchers, bool includePosition, bool stopAfterFirst) { @@ -83,7 +83,7 @@ namespace BurnOutSharp.Matching string positionsString = string.Join(", ", positions); // If we there is no version method, just return the protection name - if (matcher.GetContentVersion == null) + if (matcher.GetVersion == null) { matchedProtections.Add((matcher.ProtectionName ?? "Unknown Protection") + (includePosition ? $" (Index {positionsString})" : string.Empty)); } @@ -92,7 +92,7 @@ namespace BurnOutSharp.Matching else { // A null version returned means the check didn't pass at the version step - string version = matcher.GetContentVersion(file, fileContent, positions); + string version = matcher.GetVersion(file, fileContent, positions); if (version == null) continue; @@ -106,7 +106,7 @@ namespace BurnOutSharp.Matching return matchedProtections; } - + #endregion #region Path Matching @@ -115,10 +115,10 @@ namespace BurnOutSharp.Matching /// Get all path matches for a given list of matchers /// /// File path to check for matches - /// Enumerable of matchers to be run on the file + /// Enumerable of PathMatchSets to be run on the file /// True if any path match is a success, false if all have to match /// List of strings representing the matched protections, null or empty otherwise - public static List GetAllPathMatches(string file, IEnumerable matchers, bool any = false) + public static List GetAllPathMatches(string file, IEnumerable matchers, bool any = false) { return FindAllPathMatches(new List { file }, matchers, any, false); } @@ -127,10 +127,10 @@ namespace BurnOutSharp.Matching /// Get all path matches for a given list of matchers /// /// File paths to check for matches - /// Enumerable of matchers to be run on the file + /// Enumerable of PathMatchSets to be run on the file /// True if any path match is a success, false if all have to match /// List of strings representing the matched protections, null or empty otherwise - public static List GetAllPathMatches(List files, IEnumerable matchers, bool any = false) + public static List GetAllPathMatches(List files, IEnumerable matchers, bool any = false) { return FindAllPathMatches(files, matchers, any, false); } @@ -139,10 +139,10 @@ namespace BurnOutSharp.Matching /// Get first path match for a given list of matchers /// /// File path to check for matches - /// Enumerable of matchers to be run on the file + /// Enumerable of PathMatchSets to be run on the file /// True if any path match is a success, false if all have to match /// String representing the matched protection, null otherwise - public static string GetFirstPathMatch(string file, IEnumerable matchers, bool any = false) + public static string GetFirstPathMatch(string file, IEnumerable matchers, bool any = false) { var contentMatches = FindAllPathMatches(new List { file }, matchers, any, true); if (contentMatches == null || !contentMatches.Any()) @@ -155,10 +155,10 @@ namespace BurnOutSharp.Matching /// Get first path match for a given list of matchers /// /// File paths to check for matches - /// Enumerable of matchers to be run on the file + /// Enumerable of PathMatchSets to be run on the file /// True if any path match is a success, false if all have to match /// String representing the matched protection, null otherwise - public static string GetFirstPathMatch(List files, IEnumerable matchers, bool any = false) + public static string GetFirstPathMatch(List files, IEnumerable matchers, bool any = false) { var contentMatches = FindAllPathMatches(files, matchers, any, true); if (contentMatches == null || !contentMatches.Any()) @@ -171,11 +171,11 @@ namespace BurnOutSharp.Matching /// Get the required set of path matches on a per Matcher basis /// /// File paths to check for matches - /// Enumerable of matchers to be run on the file + /// Enumerable of PathMatchSets to be run on the file /// True if any path match is a success, false if all have to match /// True to stop after the first match, false otherwise /// List of strings representing the matched protections, null or empty otherwise - private static List FindAllPathMatches(List files, IEnumerable matchers, bool any, bool stopAfterFirst) + private static List FindAllPathMatches(List files, IEnumerable matchers, bool any, bool stopAfterFirst) { // If there's no mappings, we can't match if (matchers == null || !matchers.Any()) @@ -189,17 +189,26 @@ namespace BurnOutSharp.Matching { // Determine if the matcher passes bool passes; + string firstMatchedString; if (any) - (passes, _) = matcher.MatchesAny(files); + { + (bool anyPasses, string matchedString) = matcher.MatchesAny(files); + passes = anyPasses; + firstMatchedString = matchedString; + } else - (passes, _) = matcher.MatchesAll(files); + { + (bool allPasses, List matchedStrings) = matcher.MatchesAll(files); + passes = allPasses; + firstMatchedString = matchedStrings.FirstOrDefault(); + } // If we don't have a pass, just continue if (!passes) continue; // If we there is no version method, just return the protection name - if (matcher.GetPathVersion == null) + if (matcher.GetVersion == null) { matchedProtections.Add(matcher.ProtectionName ?? "Unknown Protection"); } @@ -207,8 +216,12 @@ namespace BurnOutSharp.Matching // Otherwise, invoke the version method else { - string version = matcher.GetPathVersion(files) ?? "Unknown Version"; - matchedProtections.Add($"{matcher.ProtectionName ?? "Unknown Protection"} {version}"); + // A null version returned means the check didn't pass at the version step + string version = matcher.GetVersion(firstMatchedString, files); + if (version == null) + continue; + + matchedProtections.Add($"{matcher.ProtectionName ?? "Unknown Protection"} {version}".TrimEnd()); } // If we're stopping after the first protection, bail out here diff --git a/BurnOutSharp/Matching/Matcher.cs b/BurnOutSharp/Matching/Matcher.cs deleted file mode 100644 index de4c40c8..00000000 --- a/BurnOutSharp/Matching/Matcher.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace BurnOutSharp.Matching -{ - /// - /// Wrapper for a single set of matching criteria - /// - internal class Matcher - { - /// - /// Set of all content matches - /// - public IEnumerable ContentMatches { get; set; } - - /// - /// Function to get a content version for this Matcher - /// - public Func, string> GetContentVersion { get; set; } - - /// - /// Set of all path matches - /// - public IEnumerable PathMatches { get; set; } - - /// - /// Function to get a path version for this Matcher - /// - public Func, string> GetPathVersion { get; set; } - - /// - /// Name of the protection to show - /// - public string ProtectionName { get; set; } - - #region ContentMatch Constructors - - public Matcher(byte?[] needle, string protectionName) - : this(new List { needle }, null, protectionName) { } - - public Matcher(List needles, string protectionName) - : this(needles, null, protectionName) { } - - public Matcher(byte?[] needle, Func, string> getVersion, string protectionName) - : this(new List { needle }, getVersion, protectionName) { } - - public Matcher(List needles, Func, string> getVersion, string protectionName) - : this(needles.Select(n => new ContentMatch(n)).ToList(), getVersion, protectionName) { } - - public Matcher(ContentMatch needle, string protectionName) - : this(new List() { needle }, null, protectionName) { } - - public Matcher(List needles, string protectionName) - : this(needles, null, protectionName) { } - - public Matcher(ContentMatch needle, Func, string> getVersion, string protectionName) - : this(new List() { needle }, getVersion, protectionName) { } - - public Matcher(List needles, Func, string> getVersion, string protectionName) - { - ContentMatches = needles; - GetContentVersion = getVersion; - ProtectionName = protectionName; - } - - #endregion - - #region PathMatch Constructors - - public Matcher(string needle, string protectionName) - : this(new List { needle }, null, protectionName) { } - - public Matcher(List needles, string protectionName) - : this(needles, null, protectionName) { } - - public Matcher(string needle, Func, string> getVersion, string protectionName) - : this(new List { needle }, getVersion, protectionName) { } - - public Matcher(List needles, Func, string> getVersion, string protectionName) - : this(needles.Select(n => new PathMatch(n)).ToList(), getVersion, protectionName) { } - - public Matcher(PathMatch needle, string protectionName) - : this(new List() { needle }, null, protectionName) { } - - public Matcher(List needles, string protectionName) - : this(needles, null, protectionName) { } - - public Matcher(PathMatch needle, Func, string> getVersion, string protectionName) - : this(new List() { needle }, getVersion, protectionName) { } - - public Matcher(List needles, Func, string> getVersion, string protectionName) - { - PathMatches = needles; - GetPathVersion = getVersion; - ProtectionName = protectionName; - } - - #endregion - - #region Matching - - /// - /// Determine whether all content matches pass - /// - /// Byte array representing the file contents - /// Tuple of passing status and matching positions - public (bool, List) MatchesAll(byte[] fileContent) - { - // If no content matches are defined, we fail out - if (ContentMatches == null || !ContentMatches.Any()) - return (false, null); - - // Initialize the position list - List positions = new List(); - - // Loop through all content matches and make sure all pass - foreach (var contentMatch in ContentMatches) - { - (bool match, int position) = contentMatch.Match(fileContent); - if (!match) - return (false, null); - else - positions.Add(position); - } - - return (true, positions); - } - - /// - /// Determine whether all content matches pass - /// - /// List of strings to try to match - /// Tuple of passing status and matching values - public (bool, List) MatchesAll(List stack) - { - // If no path matches are defined, we fail out - if (PathMatches == null || !PathMatches.Any()) - return (false, null); - - // Initialize the value list - List values = new List(); - - // Loop through all path matches and make sure all pass - foreach (var pathMatch in PathMatches) - { - (bool match, string value) = pathMatch.Match(stack); - if (!match) - return (false, null); - else - values.Add(value); - } - - return (true, values); - } - - /// - /// Determine whether any content matches pass - /// - /// List of strings to try to match - /// Tuple of passing status and matching values - public (bool, string) MatchesAny(List stack) - { - // If no path matches are defined, we fail out - if (PathMatches == null || !PathMatches.Any()) - return (false, null); - - // Loop through all path matches and make sure all pass - foreach (var pathMatch in PathMatches) - { - (bool match, string value) = pathMatch.Match(stack); - if (match) - return (true, value); - } - - return (false, null); - } - - #endregion - } -} \ No newline at end of file diff --git a/BurnOutSharp/Matching/PathMatch.cs b/BurnOutSharp/Matching/PathMatch.cs index b1a6c460..ff94c771 100644 --- a/BurnOutSharp/Matching/PathMatch.cs +++ b/BurnOutSharp/Matching/PathMatch.cs @@ -5,7 +5,7 @@ namespace BurnOutSharp.Matching /// /// Path matching criteria /// - internal class PathMatch + internal class PathMatch : IMatch { /// /// String to match @@ -22,6 +22,12 @@ namespace BurnOutSharp.Matching /// public bool UseEndsWith { get; set; } + /// + /// Constructor + /// + /// String representing the search + /// True to match exact casing, false otherwise + /// True to match the end only, false for all contents public PathMatch(string needle, bool matchExact = false, bool useEndsWith = false) { Needle = needle; @@ -35,6 +41,7 @@ namespace BurnOutSharp.Matching /// Get if this match can be found in a stack /// /// List of strings to search for the given content + /// Tuple of success and matched item public (bool, string) Match(List stack) { // If either array is null or empty, we can't do anything @@ -46,7 +53,7 @@ namespace BurnOutSharp.Matching foreach (string stackItem in stack) { - // Preprocess the stack item, ir necessary + // Preprocess the stack item, if necessary string procStackItem = MatchExact ? stackItem : stackItem.ToLowerInvariant(); if (UseEndsWith && procStackItem.EndsWith(procNeedle)) diff --git a/BurnOutSharp/Matching/PathMatchSet.cs b/BurnOutSharp/Matching/PathMatchSet.cs new file mode 100644 index 00000000..977cdd23 --- /dev/null +++ b/BurnOutSharp/Matching/PathMatchSet.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BurnOutSharp.Matching +{ + /// + /// A set of path matches that work together + /// + internal class PathMatchSet : MatchSet + { + /// + /// Function to get a path version for this Matcher + /// + /// + /// A path version method takes the matched path and a list of files + /// and returns a single string. That string is either a version string, + /// in which case it will be appended to the protection name, or `null`, + /// in which case it will cause the protection to be omitted. + /// + public Func, string> GetVersion { get; set; } + + #region Constructors + + public PathMatchSet(string needle, string protectionName) + : this(new List { needle }, null, protectionName) { } + + public PathMatchSet(List needles, string protectionName) + : this(needles, null, protectionName) { } + + public PathMatchSet(string needle, Func, string> getVersion, string protectionName) + : this(new List { needle }, getVersion, protectionName) { } + + public PathMatchSet(List needles, Func, string> getVersion, string protectionName) + : this(needles.Select(n => new PathMatch(n)).ToList(), getVersion, protectionName) { } + + public PathMatchSet(PathMatch needle, string protectionName) + : this(new List() { needle }, null, protectionName) { } + + public PathMatchSet(List needles, string protectionName) + : this(needles, null, protectionName) { } + + public PathMatchSet(PathMatch needle, Func, string> getVersion, string protectionName) + : this(new List() { needle }, getVersion, protectionName) { } + + public PathMatchSet(List needles, Func, string> getVersion, string protectionName) + { + Matchers = needles; + GetVersion = getVersion; + ProtectionName = protectionName; + } + + #endregion + + #region Matching + + /// + /// Determine whether all path matches pass + /// + /// List of strings to try to match + /// Tuple of passing status and matching values + public (bool, List) MatchesAll(List stack) + { + // If no path matches are defined, we fail out + if (Matchers == null || !Matchers.Any()) + return (false, null); + + // Initialize the value list + List values = new List(); + + // Loop through all path matches and make sure all pass + foreach (var pathMatch in Matchers) + { + (bool match, string value) = pathMatch.Match(stack); + if (!match) + return (false, null); + else + values.Add(value); + } + + return (true, values); + } + + /// + /// Determine whether any path matches pass + /// + /// List of strings to try to match + /// Tuple of passing status and first matching value + public (bool, string) MatchesAny(List stack) + { + // If no path matches are defined, we fail out + if (Matchers == null || !Matchers.Any()) + return (false, null); + + // Loop through all path matches and make sure all pass + foreach (var pathMatch in Matchers) + { + (bool match, string value) = pathMatch.Match(stack); + if (match) + return (true, value); + } + + return (false, null); + } + + #endregion + } +} \ No newline at end of file diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs index 00430e62..7f165095 100644 --- a/BurnOutSharp/PackerType/AdvancedInstaller.cs +++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs @@ -9,10 +9,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Software\Caphyon\Advanced Installer - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E, diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs index 11d1310b..64829e50 100644 --- a/BurnOutSharp/PackerType/Armadillo.cs +++ b/BurnOutSharp/PackerType/Armadillo.cs @@ -8,13 +8,13 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // .nicode + (char)0x00 - new Matcher(new byte?[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }, "Armadillo"), + new ContentMatchSet(new byte?[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }, "Armadillo"), // ARMDEBUG - new Matcher(new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }, "Armadillo"), + new ContentMatchSet(new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }, "Armadillo"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs index ced25a9a..bf7f1fbc 100644 --- a/BurnOutSharp/PackerType/CExe.cs +++ b/BurnOutSharp/PackerType/CExe.cs @@ -14,10 +14,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // %Wo�a6.�a6.�a6.�a6.�{6.�.).�f6.��).�`6.��0.�`6.� - new Matcher( + new ContentMatchSet( new ContentMatch(new byte?[] { 0x25, 0x57, 0x6F, 0xC1, 0x61, 0x36, 0x01, 0x92, diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs index 331f9d1e..78dbf201 100644 --- a/BurnOutSharp/PackerType/EXEStealth.cs +++ b/BurnOutSharp/PackerType/EXEStealth.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // ??[[__[[_ + (char)0x00 + {{ + (char)0x0 + (char)0x00 + {{ + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + ?;??;?? - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x3F, 0x3F, 0x5B, 0x5B, 0x5F, 0x5F, 0x5B, 0x5B, 0x5F, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x7B, 0x7B, diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs index 17ba365c..6acb5dc6 100644 --- a/BurnOutSharp/PackerType/InnoSetup.cs +++ b/BurnOutSharp/PackerType/InnoSetup.cs @@ -14,10 +14,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Inno - new Matcher( + new ContentMatchSet( new ContentMatch(new byte?[] { 0x49, 0x6E, 0x6E, 0x6F }, start: 0x30, end: 0x31), GetVersion, "Inno Setup"), diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index 7ae11a7e..f9edc674 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Nullsoft Install System - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, @@ -22,7 +22,7 @@ namespace BurnOutSharp.PackerType }, GetVersion, "NSIS"), // NullsoftInst - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74 diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index 799db138..c3f68664 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -11,16 +11,16 @@ namespace BurnOutSharp.PackerType public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { // Another possible version string for version 1 is "PECO" (50 45 43 4F) - var matchers = new List + var matchers = new List { // pec1 - new Matcher(new byte?[] { 0x70, 0x65, 0x63, 0x31 }, "PE Compact 1"), + new ContentMatchSet(new byte?[] { 0x70, 0x65, 0x63, 0x31 }, "PE Compact 1"), // PEC2 - new Matcher(new byte?[] { 0x50, 0x45, 0x43, 0x32 }, GetVersion, "PE Compact 2"), + new ContentMatchSet(new byte?[] { 0x50, 0x45, 0x43, 0x32 }, GetVersion, "PE Compact 2"), // PECompact2 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x50, 0x45, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0x32 diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs index 1c47fd40..e94a7fad 100644 --- a/BurnOutSharp/PackerType/SetupFactory.cs +++ b/BurnOutSharp/PackerType/SetupFactory.cs @@ -12,10 +12,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // S.e.t.u.p. .F.a.c.t.o.r.y. - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, @@ -25,7 +25,7 @@ namespace BurnOutSharp.PackerType // Longer version of the check that can be used if false positves become an issue: // S.e.t.u.p. .F.a.c.t.o.r.y. .i.s. .a. .t.r.a.d.e.m.a.r.k. .o.f. .I.n.d.i.g.o. .R.o.s.e. .C.o.r.p.o.r.a.t.i.o.n. - // new Matcher(new byte?[] + // new ContentMatchSet(new byte?[] // { // 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, // 0x70, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs index 40bc2542..379a7b60 100644 --- a/BurnOutSharp/PackerType/UPX.cs +++ b/BurnOutSharp/PackerType/UPX.cs @@ -9,15 +9,15 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // UPX! - new Matcher(new byte?[] { 0x55, 0x50, 0x58, 0x21 }, GetVersion, "UPX"), + new ContentMatchSet(new byte?[] { 0x55, 0x50, 0x58, 0x21 }, GetVersion, "UPX"), // NOS - new Matcher(new byte?[] { 0x4E, 0x4F, 0x53, 0x20 }, GetVersion, "UPX (NOS Variant)"), + new ContentMatchSet(new byte?[] { 0x4E, 0x4F, 0x53, 0x20 }, GetVersion, "UPX (NOS Variant)"), - new Matcher( + new ContentMatchSet( new List { // UPX0 @@ -29,7 +29,7 @@ namespace BurnOutSharp.PackerType "UPX (Unknown Version)" ), - new Matcher( + new ContentMatchSet( new List { // NOS0 diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs index 0f518834..69365b5a 100644 --- a/BurnOutSharp/PackerType/WinRARSFX.cs +++ b/BurnOutSharp/PackerType/WinRARSFX.cs @@ -15,10 +15,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Software\WinRAR SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x5C, 0x57, 0x69, 0x6E, 0x52, 0x41, 0x52, 0x20, diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index a7afe43d..2ee5b46a 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -15,10 +15,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // WinZip Self-Extractor - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x57, 0x69, 0x6E, 0x5A, 0x69, 0x70, 0x20, 0x53, 0x65, 0x6C, 0x66, 0x2D, 0x45, 0x78, 0x74, 0x72, @@ -26,7 +26,7 @@ namespace BurnOutSharp.PackerType }, GetVersion, "WinZip SFX"), // _winzip_ - new Matcher(new byte?[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }, GetVersion, "WinZip SFX"), + new ContentMatchSet(new byte?[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }, GetVersion, "WinZip SFX"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); @@ -105,11 +105,11 @@ namespace BurnOutSharp.PackerType private static string GetV2Version(string file, byte[] fileContent) { - var matchers = new List + var matchers = new List { #region 16-bit NE Header Checks - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -121,7 +121,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.0 (MS-DOS/16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -133,7 +133,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.0 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -145,7 +145,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "Compact 2.0 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xCD, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -157,7 +157,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "Software Installation 2.0 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -169,7 +169,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.1 RC2 (MS-DOS/16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -181,7 +181,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.1 RC2 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -193,7 +193,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "Compact 2.1 RC2 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -205,7 +205,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "Software Installation 2.1 RC2 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -217,7 +217,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.1 (MS-DOS/16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -229,7 +229,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "2.1 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x03, 0x03, 0x00, @@ -241,7 +241,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, }, "Compact 2.1 (16-bit)"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4E, 0x45, 0x11, 0x20, 0xBE, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x00, @@ -258,7 +258,7 @@ namespace BurnOutSharp.PackerType #region 32-bit SFX Header Checks // .............8�92....�P..............�P..�P..�P..VW95SE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9C, 0x39, @@ -271,7 +271,7 @@ namespace BurnOutSharp.PackerType }, "2.0 (32-bit)"), // .............]�92....�P..............�P..�P..�P..VW95SRE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x9C, 0x39, @@ -284,7 +284,7 @@ namespace BurnOutSharp.PackerType }, "Software Installation 2.0 (32-bit)"), // .............���3....�P..............�P..�P..�P..VW95SE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x82, 0x94, @@ -297,7 +297,7 @@ namespace BurnOutSharp.PackerType }, "2.1 RC2 (32-bit)"), // .............���3....�P..............�P..�P..�P..VW95SRE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x82, 0x94, @@ -310,7 +310,7 @@ namespace BurnOutSharp.PackerType }, "Software Installation 2.1 RC2 (32-bit)"), // .............U��3....�P..............�P..�P..�P..VW95SE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xCD, 0xCC, @@ -323,7 +323,7 @@ namespace BurnOutSharp.PackerType }, "2.1 (32-bit)"), // .............{��3....�P..............�P..�P..�P..VW95SRE.SFX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xCD, 0xCC, @@ -339,7 +339,7 @@ namespace BurnOutSharp.PackerType #region 32-bit PE Header Checks - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x05, 0x00, 0x69, 0x1B, 0x5B, 0x3A, 0x00, 0x00, 0x00, 0x00, @@ -350,7 +350,7 @@ namespace BurnOutSharp.PackerType 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, }, "2.2.4003"), - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x05, 0x00, 0x81, 0x1B, 0x5B, 0x3A, 0x00, 0x00, 0x00, 0x00, diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index ee221894..6a5a05ad 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -14,10 +14,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // WiseMain - new Matcher(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, "Wise Installation Wizard Module"), + new ContentMatchSet(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, "Wise Installation Wizard Module"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs index 931a1e07..a60e6cbd 100644 --- a/BurnOutSharp/PackerType/dotFuscator.cs +++ b/BurnOutSharp/PackerType/dotFuscator.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.PackerType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // DotfuscatorAttribute - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x44, 0x6F, 0x74, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x41, 0x74, 0x74, 0x72, 0x69, diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index d7b6be96..ee9862b0 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -8,13 +8,13 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // TMSAMVOF - new Matcher(new byte?[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }, "ActiveMARK"), + new ContentMatchSet(new byte?[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }, "ActiveMARK"), // " " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0xB8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x86 + (char)0xC8 + (char)0x16 + (char)0x00 + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x00, diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index 01c06a4c..0b605c40 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // SETTEC - new Matcher(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"), + new ContentMatchSet(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index 6408866d..b59717f1 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -8,17 +8,17 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // MGS CDCheck - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Microsoft Game Studios CD Check"), // CDCheck - new Matcher(new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Executable-Based CD Check"), + new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Executable-Based CD Check"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); @@ -27,17 +27,17 @@ namespace BurnOutSharp.ProtectionType // These content checks are too broad to be useful private static string CheckContentsBroad(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // GetDriveType - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 }, "Executable-Based CD Check"), // GetVolumeInformation - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index 2ade018a..67e75248 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -11,17 +11,17 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // CD-Cops, ver. - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }, GetVersion, "CD-Cops"), // .grand + (char)0x00 - new Matcher(new byte?[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00 }, "CD-Cops"), + new ContentMatchSet(new byte?[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00 }, "CD-Cops"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index 9ad413db..cefe0cd1 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // 2 + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B + $ + (char)0x99 + (char)0xAD + 'C + (char)0xE4 + (char)0x9D + st + (char)0x99 + (char)0xFA + 2$ + (char)0x9D + )4 + (char)0xFF + t - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index 7fd5b644..517f6635 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // ~0017.tmp - new Matcher(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"), + new ContentMatchSet(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index 55ce78f8..1cc9eaa6 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -12,16 +12,16 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // DATA.CDS - new Matcher(new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"), + new ContentMatchSet(new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"), // \*.CDS - new Matcher(new byte?[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"), + new ContentMatchSet(new byte?[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"), // CDSPlayer - new Matcher(new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }, "Cactus Data Shield 200"), + new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }, "Cactus Data Shield 200"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs index de121a8e..43061fb1 100644 --- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // .cenega - new Matcher(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"), + new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index 81ed4d3e..4333a2fd 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -9,16 +9,16 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // icd1 + (char)0x00 - new Matcher(new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }, "Code Lock"), + new ContentMatchSet(new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }, "Code Lock"), // icd2 + (char)0x00 - new Matcher(new byte?[] { 0x69, 0x63, 0x64, 0x32, 0x00 }, "Code Lock"), + new ContentMatchSet(new byte?[] { 0x69, 0x63, 0x64, 0x32, 0x00 }, "Code Lock"), // CODE-LOCK.OCX - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index b96c9fbd..a703e3de 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Tom Commander - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index ca26480c..5eb829e4 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -10,10 +10,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // DVD-Cops, ver. - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x44, 0x56, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index 1af77592..df44788b 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -12,13 +12,13 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // EASTL - //new Matcher(new byte?[] { 0x45, 0x41, 0x53, 0x54, 0x4C }, "Cucko (EA Custom)"), + //new ContentMatchSet(new byte?[] { 0x45, 0x41, 0x53, 0x54, 0x4C }, "Cucko (EA Custom)"), // R + (char)0x00 + e + (char)0x00 + g + (char)0x00 + i + (char)0x00 + s + (char)0x00 + t + (char)0x00 + r + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + C + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 + + (char)0x00 + i + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + e + (char)0x00 + r + (char)0x00 + + (char)0x00 + p + (char)0x00 + r + (char)0x00 + o + (char)0x00 + g + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, @@ -32,7 +32,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // R + (char)0x00 + e + (char)0x00 + g + (char)0x00 + i + (char)0x00 + s + (char)0x00 + t + (char)0x00 + r + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + c + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 + + (char)0x00 + i + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + e + (char)0x00 + r + (char)0x00 + + (char)0x00 + p + (char)0x00 + r + (char)0x00 + o + (char)0x00 + g + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x52, 0x00, 0x65, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00, @@ -46,7 +46,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // A + (char)0x00 + b + (char)0x00 + o + (char)0x00 + u + (char)0x00 + t + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x41, 0x00, 0x62, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x43, 0x00, 0x44, 0x00, @@ -54,7 +54,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, @@ -64,7 +64,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + C + (char)0x00 + o + (char)0x00 + d + (char)0x00 + e + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, @@ -74,14 +74,14 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // EReg Config Form - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x45, 0x52, 0x65, 0x67, 0x20, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x20, 0x46, 0x6F, 0x72, 0x6D }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // ereg.ea-europe.com - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x65, 0x72, 0x65, 0x67, 0x2E, 0x65, 0x61, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x65, 0x2E, 0x63, @@ -89,7 +89,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "EA CdKey Registration Module"), // GenericEA + (char)0x00 + (char)0x00 + (char)0x00 + Activation - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x45, 0x41, 0x00, 0x00, 0x00, 0x41, 0x63, 0x74, 0x69, @@ -97,7 +97,7 @@ namespace BurnOutSharp.ProtectionType }, "EA DRM Protection"), // E + (char)0x00 + A + (char)0x00 + + (char)0x00 + D + (char)0x00 + R + (char)0x00 + M + (char)0x00 + + (char)0x00 + H + (char)0x00 + e + (char)0x00 + l + (char)0x00 + p + (char)0x00 + e + (char)0x00 + r + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x45, 0x00, 0x41, 0x00, 0x20, 0x00, 0x44, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x48, 0x00, diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index 151a710f..69860ae6 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // xlive.dll - new Matcher(new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }, "Games for Windows - Live"), + new ContentMatchSet(new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }, "Games for Windows - Live"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index 6d2c3678..7cf1e93c 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -11,9 +11,9 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { - new Matcher(new List + new ContentMatchSet(new List { // CVPInitializeClient new byte?[] @@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "Impulse Reactor"), // CVPInitializeClient - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x43, 0x56, 0x50, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x43, 0x6C, 0x69, diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs index ca8c74e8..9ee4217d 100644 --- a/BurnOutSharp/ProtectionType/Intenium.cs +++ b/BurnOutSharp/ProtectionType/Intenium.cs @@ -24,10 +24,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Trial + (char)0x00 + P - new Matcher(new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }, "INTENIUM Trial & Buy Protection"), + new ContentMatchSet(new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }, "INTENIUM Trial & Buy Protection"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs index 7bf535b4..156a3359 100644 --- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs +++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs @@ -10,12 +10,12 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // @HC09 - new Matcher(new byte?[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v2"), + new ContentMatchSet(new byte?[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v2"), - new Matcher(new List + new ContentMatchSet(new List { // .ext new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }, @@ -31,7 +31,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "JoWooD X-Prot"), // .ext - new Matcher(new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v1"), + new ContentMatchSet(new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v1"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index 9f20eb2f..82e21eeb 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // KEY-LOCK COMMAND - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs index 347f7e7b..af2cffeb 100644 --- a/BurnOutSharp/ProtectionType/LaserLock.cs +++ b/BurnOutSharp/ProtectionType/LaserLock.cs @@ -30,10 +30,10 @@ namespace BurnOutSharp.ProtectionType if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)) return $"LaserLock {GetVersion16Bit(fileContent)}" + (includePosition ? $" (Index 71)" : string.Empty); - var matchers = new List + var matchers = new List { // :\\LASERLOK\\LASERLOK.IN + (char)0x00 + C:\\NOMOUSE.SP - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x3A, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5C, 0x5C, 0x4C, 0x41, 0x53, @@ -43,7 +43,7 @@ namespace BurnOutSharp.ProtectionType }, "LaserLock 3"), // LASERLOK_INIT + (char)0xC + LASERLOK_RUN + (char)0xE + LASERLOK_CHECK + (char)0xF + LASERLOK_CHECK2 + (char)0xF + LASERLOK_CHECK3 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x49, 0x4E, 0x49, 0x54, 0x0C, 0x4C, 0x41, diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs index 0e363aea..4ead01a4 100644 --- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs +++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs @@ -11,13 +11,13 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // Cd3Ctl - new Matcher(new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }, "MediaMax CD-3"), + new ContentMatchSet(new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }, "MediaMax CD-3"), // DllInstallSbcp - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs index 8aeb9f1c..f56b862f 100644 --- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + E + (char)0x00 + R + (char)0x00 + e + (char)0x00 + g + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs index dd2914f2..c9e8689a 100644 --- a/BurnOutSharp/ProtectionType/Origin.cs +++ b/BurnOutSharp/ProtectionType/Origin.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // O + (char)0x00 + r + (char)0x00 + i + (char)0x00 + g + (char)0x00 + i + (char)0x00 + n + (char)0x00 + S + (char)0x00 + e + (char)0x00 + t + (char)0x00 + u + (char)0x00 + p + (char)0x00 + . + (char)0x00 + e + (char)0x00 + x + (char)0x00 + e + (char)0x00 - new Matcher(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"), + 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.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs index 26c0034b..533d010f 100644 --- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs +++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs @@ -10,10 +10,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, @@ -29,7 +29,7 @@ namespace BurnOutSharp.ProtectionType }, "PlayStation Anti-modchip (English)"), // 強制終了しました。\n本体が改造されている\nおそれがあります。 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index 4d22b502..b119ce30 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -13,13 +13,13 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // HúMETINF - new Matcher(new byte?[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 }, GetVersion76till10, "ProtectDisc"), + new ContentMatchSet(new byte?[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 }, GetVersion76till10, "ProtectDisc"), // ACE-PCD - new Matcher(new byte?[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }, GetVersion6till8, "ProtectDisc"), + new ContentMatchSet(new byte?[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }, GetVersion6till8, "ProtectDisc"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index 1e2be7d0..086baefa 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -9,10 +9,10 @@ namespace BurnOutSharp.ProtectionType /// TODO: Investigate as this may be over-matching public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // (char)0x00 + Allocator + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs index 64f4b3e2..18dcf84c 100644 --- a/BurnOutSharp/ProtectionType/SVKProtector.cs +++ b/BurnOutSharp/ProtectionType/SVKProtector.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // ?SVKP + (char)0x00 + (char)0x00 - new Matcher(new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }, "SVK Protector"), + new ContentMatchSet(new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }, "SVK Protector"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index ae9704a2..785727ef 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -13,9 +13,9 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { - new Matcher(new List + new ContentMatchSet(new List { // BoG_ *90.0&!! Yy> new byte?[] @@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "SafeCast"), // BoG_ *90.0&!! Yy> - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x42, 0x6F, 0x47, 0x5F, 0x20, 0x2A, 0x39, 0x30, 0x2E, 0x30, 0x26, 0x21, 0x21, 0x20, 0x20, 0x59, @@ -44,13 +44,13 @@ namespace BurnOutSharp.ProtectionType }, "SafeDisc"), // (char)0x00 + (char)0x00 + BoG_ - new Matcher(new byte?[] { 0x00, 0x00, 0x42, 0x6F, 0x47, 0x5F }, Get320to4xVersion, "SafeDisc"), + new ContentMatchSet(new byte?[] { 0x00, 0x00, 0x42, 0x6F, 0x47, 0x5F }, Get320to4xVersion, "SafeDisc"), // stxt774 - new Matcher(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x37, 0x37, 0x34 }, Get320to4xVersion, "SafeDisc"), + new ContentMatchSet(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x37, 0x37, 0x34 }, Get320to4xVersion, "SafeDisc"), // stxt371 - new Matcher(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }, Get320to4xVersion, "SafeDisc"), + new ContentMatchSet(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }, Get320to4xVersion, "SafeDisc"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); @@ -82,7 +82,7 @@ namespace BurnOutSharp.ProtectionType protections.Add("SafeDisc for Macintosh"); } - if (protections.Count() == 0) + if (protections.Count == 0) return null; else return string.Join(", ", protections); diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 3077ab31..00c69367 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // SafeLock - new Matcher(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"), + new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index 49e7e173..21ee0319 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -12,26 +12,26 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // AddD + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00) - new Matcher(new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }, GetV4Version, "SecuROM"), + new ContentMatchSet(new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }, GetV4Version, "SecuROM"), // (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03 - new Matcher(new byte?[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }, GetV5Version, "SecuROM"), + new ContentMatchSet(new byte?[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }, GetV5Version, "SecuROM"), // .securom + (char)0xE0 + (char)0xC0 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D, 0xE0, 0xC0 }, GetV7Version, "SecuROM"), // .securom - new Matcher(new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }, GetV7Version, "SecuROM"), + new ContentMatchSet(new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }, GetV7Version, "SecuROM"), // _and_play.dll + (char)0x00 + drm_pagui_doit - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x5F, 0x61, 0x6E, 0x64, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x64, 0x72, @@ -40,10 +40,10 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "SecuROM Product Activation"), // .cms_t + (char)0x00 - new Matcher(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }, "SecuROM 1-3"), + new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }, "SecuROM 1-3"), // .cms_d + (char)0x00 - new Matcher(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"), + new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index 71c9022b..457e6160 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // BITARTS - new Matcher(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"), + new ContentMatchSet(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index c6303078..d14eef71 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -12,10 +12,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // D + (char)0x00 + V + (char)0x00 + M + (char)0x00 + + (char)0x00 + L + (char)0x00 + i + (char)0x00 + b + (char)0x00 + r + (char)0x00 + a + (char)0x00 + r + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x44, 0x00, 0x56, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, @@ -23,7 +23,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "SolidShield"), // S + (char)0x00 + o + (char)0x00 + l + (char)0x00 + i + (char)0x00 + d + (char)0x00 + s + (char)0x00 + h + (char)0x00 + i + (char)0x00 + e + (char)0x00 + l + (char)0x00 + d + (char)0x00 + + (char)0x00 + L + (char)0x00 + i + (char)0x00 + b + (char)0x00 + r + (char)0x00 + a + (char)0x00 + r + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, @@ -33,7 +33,7 @@ namespace BurnOutSharp.ProtectionType }, GetFileVersion, "SolidShield Core.dll"), // S + (char)0x00 + o + (char)0x00 + l + (char)0x00 + i + (char)0x00 + d + (char)0x00 + s + (char)0x00 + h + (char)0x00 + i + (char)0x00 + e + (char)0x00 + l + (char)0x00 + d + (char)0x00 + + (char)0x00 + A + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + v + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + L + (char)0x00 + i + (char)0x00 + b + (char)0x00 + r + (char)0x00 + a + (char)0x00 + r + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, @@ -46,10 +46,10 @@ namespace BurnOutSharp.ProtectionType }, GetFileVersion, "SolidShield Core.dll"), // (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE - new Matcher(new byte?[] { 0xEF, 0xBE, 0xAD, 0xDE }, GetExeWrapperVersion, "SolidShield"), + new ContentMatchSet(new byte?[] { 0xEF, 0xBE, 0xAD, 0xDE }, GetExeWrapperVersion, "SolidShield"), // A + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + v + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + M + (char)0x00 + a + (char)0x00 + n + (char)0x00 + a + (char)0x00 + g + (char)0x00 + e + (char)0x00 + r + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, @@ -59,20 +59,20 @@ namespace BurnOutSharp.ProtectionType }, GetFileVersion, "SolidShield Activation Manager Module"), // dvm.dll - new Matcher(new byte?[] { 0x64, 0x76, 0x6D, 0x2E, 0x64, 0x6C, 0x6C }, "SolidShield EXE Wrapper"), + new ContentMatchSet(new byte?[] { 0x64, 0x76, 0x6D, 0x2E, 0x64, 0x6C, 0x6C }, "SolidShield EXE Wrapper"), // (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA - new Matcher(new byte?[] { 0xAD, 0xDE, 0xFE, 0xCA }, GetVersionPlusTages, "SolidShield"), + new ContentMatchSet(new byte?[] { 0xAD, 0xDE, 0xFE, 0xCA }, GetVersionPlusTages, "SolidShield"), // Solidshield - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x53, 0x6F, 0x6C, 0x69, 0x64, 0x73, 0x68, 0x69, 0x65, 0x6C, 0x64 }, GetVersion, "SolidShield"), // B + (char)0x00 + I + (char)0x00 + N + (char)0x00 + (char)0x7 + (char)0x00 + I + (char)0x00 + D + (char)0x00 + R + (char)0x00 + _ + (char)0x00 + S + (char)0x00 + G + (char)0x00 + T + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x42, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x07, 0x00, 0x49, 0x00, 0x44, 0x00, 0x52, 0x00, 0x5F, 0x00, diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 886e9f03..9a559410 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -11,9 +11,9 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { - new Matcher(new List + new ContentMatchSet(new List { // ( + (char)0x00 + c + (char)0x00 + ) + (char)0x00 + + (char)0x00 + P + (char)0x00 + r + (char)0x00 + o + (char)0x00 + t + (char)0x00 + e + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + T + (char)0x00 + e + (char)0x00 + c + (char)0x00 + h + (char)0x00 + n + (char)0x00 + o + (char)0x00 + l + (char)0x00 + o + (char)0x00 + g + (char)0x00 + y + (char)0x00 new byte?[] @@ -48,7 +48,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "StarForce"), // ( + (char)0x00 + c + (char)0x00 + ) + (char)0x00 + + (char)0x00 + P + (char)0x00 + r + (char)0x00 + o + (char)0x00 + t + (char)0x00 + e + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + T + (char)0x00 + e + (char)0x00 + c + (char)0x00 + h + (char)0x00 + n + (char)0x00 + o + (char)0x00 + l + (char)0x00 + o + (char)0x00 + g + (char)0x00 + y + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x28, 0x00, 0x63, 0x00, 0x29, 0x00, 0x20, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x74, 0x00, @@ -59,7 +59,7 @@ namespace BurnOutSharp.ProtectionType 0x79, 0x00 }, Utilities.GetFileVersion, "StarForce"), - new Matcher(new List + new ContentMatchSet(new List { // Protection Technology, Ltd. new byte?[] @@ -91,7 +91,7 @@ namespace BurnOutSharp.ProtectionType }, GetVersion, "StarForce"), // Protection Technology, Ltd. - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, @@ -100,13 +100,13 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "StarForce"), // .sforce - new Matcher(new byte?[] { 0x2E, 0x73, 0x66, 0x6F, 0x72, 0x63, 0x65 }, "StarForce 3-5"), + new ContentMatchSet(new byte?[] { 0x2E, 0x73, 0x66, 0x6F, 0x72, 0x63, 0x65 }, "StarForce 3-5"), // .brick - new Matcher(new byte?[] { 0x2E, 0x62, 0x72, 0x69, 0x63, 0x6B }, "StarForce 3-5"), + new ContentMatchSet(new byte?[] { 0x2E, 0x62, 0x72, 0x69, 0x63, 0x6B }, "StarForce 3-5"), // P + (char)0x00 + r + (char)0x00 + o + (char)0x00 + t + (char)0x00 + e + (char)0x00 + c + (char)0x00 + t + (char)0x00 + e + (char)0x00 + d + (char)0x00 + + (char)0x00 + M + (char)0x00 + o + (char)0x00 + d + (char)0x00 + u + (char)0x00 + l + (char)0x00 + e + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index dba575f7..0f74192f 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -8,17 +8,17 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // V SUHPISYSDVD - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 }, GetVersion, "Sysiphus DVD"), // V SUHPISYSDVD - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53 diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index 315cf74e..b47d3cca 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // protected-tages-runtime.exe - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2D, 0x74, 0x61, 0x67, 0x65, 0x73, 0x2D, @@ -23,7 +23,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "TAGES"), // tagesprotection.com - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x74, 0x61, 0x67, 0x65, 0x73, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x2E, @@ -31,7 +31,7 @@ namespace BurnOutSharp.ProtectionType }, Utilities.GetFileVersion, "TAGES"), // (char)0xE8 + u + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8 - new Matcher(new byte?[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }, GetVersion, "TAGES"), + new ContentMatchSet(new byte?[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }, GetVersion, "TAGES"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); @@ -64,7 +64,7 @@ namespace BurnOutSharp.ProtectionType protections.Add("TAGES Setup " + Utilities.GetFileVersion(file)); } - if (protections.Count() == 0) + if (protections.Count == 0) return null; else return string.Join(", ", protections); diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index 3ef1b077..df2a3fe3 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -8,9 +8,9 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { - new Matcher(new List + new ContentMatchSet(new List { // .ldr new byte?[] { 0x2E, 0x6C, 0x64, 0x72 }, @@ -21,7 +21,7 @@ namespace BurnOutSharp.ProtectionType // This produced false positives in some DirectX 9.0c installer files // "Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW" - // new Matcher(new byte?[] + // new ContentMatchSet(new byte?[] // { // 0x59, 0xC3, 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x30, // 0x53, 0x56, 0x57 diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs index e4d3a115..db9a3c64 100644 --- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs +++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // 3 + (char)0x00 + 1 + 2 + (char)0x00 + 1 + (char)0x00 + S + (char)0x00 + t + (char)0x00 + u + (char)0x00 + d + (char)0x00 + i + (char)0x00 + o + (char)0x00 + s + (char)0x00 + + (char)0x00 + A + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + v + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs index cfd5f4c7..0d8b7ec4 100644 --- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs +++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs @@ -13,20 +13,20 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // VOB ProtectCD - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x56, 0x4F, 0x42, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x43, 0x44 }, GetOldVersion, "VOB ProtectCD/DVD"), // DCP-BOV + (char)0x00 + (char)0x00 - new Matcher(new byte?[] { 0x44, 0x43, 0x50, 0x2D, 0x42, 0x4F, 0x56, 0x00, 0x00 }, GetVersion, "VOB ProtectCD/DVD"), + new ContentMatchSet(new byte?[] { 0x44, 0x43, 0x50, 0x2D, 0x42, 0x4F, 0x56, 0x00, 0x00 }, GetVersion, "VOB ProtectCD/DVD"), // .vob.pcd - new Matcher(new byte?[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }, "VOB ProtectCD"), + new ContentMatchSet(new byte?[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }, "VOB ProtectCD"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index c9b9ff2e..bf129835 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -11,10 +11,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // WTM76545 - new Matcher(new byte?[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }, "WTM CD Protect"), + new ContentMatchSet(new byte?[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }, "WTM CD Protect"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index 936484e5..bd4c2b3c 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -12,20 +12,20 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // XCP.DAT - new Matcher(new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }, "XCP"), + new ContentMatchSet(new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }, "XCP"), // XCPPlugins.dll - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x6C, 0x75, 0x67, 0x69, 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }, "XCP"), // XCPPhoenix.dll - new Matcher(new byte?[] + new ContentMatchSet(new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs index 2592ae6c..0db85612 100644 --- a/BurnOutSharp/ProtectionType/XtremeProtector.cs +++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.ProtectionType /// public string CheckContents(string file, byte[] fileContent, bool includePosition = false) { - var matchers = new List + var matchers = new List { // XPROT - new Matcher(new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }, "Xtreme-Protector"), + new ContentMatchSet(new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }, "Xtreme-Protector"), }; return MatchUtil.GetFirstContentMatch(file, fileContent, matchers, includePosition); diff --git a/BurnOutSharp/Scanner.cs b/BurnOutSharp/Scanner.cs index f52da73d..65405c3a 100644 --- a/BurnOutSharp/Scanner.cs +++ b/BurnOutSharp/Scanner.cs @@ -90,7 +90,7 @@ namespace BurnOutSharp Utilities.AppendToDictionary(protections, directoryPathProtections); // Scan each file in directory separately - for (int i = 0; i < files.Count(); i++) + for (int i = 0; i < files.Count; i++) { // Get the current file string file = files.ElementAt(i); @@ -101,7 +101,7 @@ namespace BurnOutSharp reportableFileName = reportableFileName.Substring(tempFilePathWithGuid.Length); // Checkpoint - FileProgress?.Report(new ProtectionProgress(reportableFileName, i / (float)files.Count(), "Checking file" + (file != reportableFileName ? " from archive" : string.Empty))); + FileProgress?.Report(new ProtectionProgress(reportableFileName, i / (float)files.Count, "Checking file" + (file != reportableFileName ? " from archive" : string.Empty))); // Scan for path-detectable protections var filePathProtections = GetFilePathProtections(file); @@ -123,7 +123,7 @@ namespace BurnOutSharp // Checkpoint protections.TryGetValue(file, out List fullProtectionList); string fullProtection = (fullProtectionList != null && fullProtectionList.Any() ? string.Join(", ", fullProtectionList) : null); - FileProgress?.Report(new ProtectionProgress(reportableFileName, (i + 1) / (float)files.Count(), fullProtection ?? string.Empty)); + FileProgress?.Report(new ProtectionProgress(reportableFileName, (i + 1) / (float)files.Count, fullProtection ?? string.Empty)); } } @@ -407,7 +407,7 @@ namespace BurnOutSharp /// /// Initialize all IPathCheck implementations /// - private void InitPathCheckClasses() + private static void InitPathCheckClasses() { if (pathCheckClasses == null) {