mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-21 21:54:13 +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,17 +11,20 @@ namespace BurnOutSharp.ProtectionType
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
// Cd3Ctl
|
||||
byte?[] check = new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C };
|
||||
if (fileContent.FirstPosition(check, out int position))
|
||||
return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty);
|
||||
var matchers = new List<Matcher>
|
||||
{
|
||||
// Cd3Ctl
|
||||
new Matcher(new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }, "MediaMax CD-3"),
|
||||
|
||||
// DllInstallSbcp
|
||||
check = new byte?[] { 0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 };
|
||||
if (fileContent.FirstPosition(check, out position))
|
||||
return "MediaMax CD-3" + (includePosition ? $" (Index {position})" : string.Empty);
|
||||
// DllInstallSbcp
|
||||
new Matcher(new byte?[]
|
||||
{
|
||||
0x44, 0x6C, 0x6C, 0x49, 0x6E, 0x73, 0x74, 0x61,
|
||||
0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70
|
||||
}, "MediaMax CD-3"),
|
||||
};
|
||||
|
||||
return null;
|
||||
return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user