Fix static matcher issues (fixes #51)

Note: This may result in slower, but more accurate, scans
This commit is contained in:
Matt Nadareski
2021-07-17 23:40:16 -07:00
parent 957d82b2f7
commit 3ac57b1c0c
53 changed files with 1053 additions and 1208 deletions

View File

@@ -5,19 +5,16 @@ namespace BurnOutSharp.ProtectionType
{
public class SafeLock : IContentCheck, IPathCheck
{
/// <summary>
/// Set of all ContentMatchSets for this protection
/// </summary>
private static readonly List<ContentMatchSet> contentMatchers = new List<ContentMatchSet>
{
// SafeLock
new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"),
};
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
return MatchUtil.GetFirstMatch(file, fileContent, contentMatchers, includePosition);
var matchers = new List<ContentMatchSet>
{
// SafeLock
new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"),
};
return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition);
}
/// <inheritdoc/>