mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-18 23:05:11 +00:00
Use content matching helper, part 4
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BurnOutSharp.Matching;
|
||||
|
||||
namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
@@ -10,12 +11,13 @@ namespace BurnOutSharp.ProtectionType
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
// "SafeLock"
|
||||
byte?[] check = new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B };
|
||||
if (fileContent.FirstPosition(check, out int position))
|
||||
return "SafeLock" + (includePosition ? $" (Index {position})" : string.Empty);
|
||||
var matchers = new List<Matcher>
|
||||
{
|
||||
// SafeLock
|
||||
new Matcher(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"),
|
||||
};
|
||||
|
||||
return null;
|
||||
return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user