diff --git a/BurnOutSharp/IContentCheck.cs b/BurnOutSharp/IContentCheck.cs
index d0f1de03..950574ca 100644
--- a/BurnOutSharp/IContentCheck.cs
+++ b/BurnOutSharp/IContentCheck.cs
@@ -9,6 +9,7 @@
/// Byte array representing the file contents
/// True to include positional data, false otherwise
/// String containing any protections found in the file
+ /// TODO: This should be replaced with a "GenerateMatchers" that produces a list of matchers to be run instead
string CheckContents(string file, byte[] fileContent, bool includePosition);
}
}
diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs
index cd3aafe3..cfa9204e 100644
--- a/BurnOutSharp/PackerType/Armadillo.cs
+++ b/BurnOutSharp/PackerType/Armadillo.cs
@@ -17,7 +17,7 @@ namespace BurnOutSharp.PackerType
new Matcher(new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }, "Armadillo"),
};
- return Utilities.GetContentMatches(fileContent, matchers, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs
index b977a622..38efa4e5 100644
--- a/BurnOutSharp/ProtectionType/ActiveMARK.cs
+++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,16 +8,16 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// TMSAMVOF
- [new byte?[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }] = "ActiveMARK",
+ new Matcher(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)0x0 + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00
- [new byte?[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x0, 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 }] = "ActiveMARK 5",
+ new Matcher(new byte?[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x0, 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 }, "ActiveMARK 5"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs
index 812580cb..3d669fa8 100644
--- a/BurnOutSharp/ProtectionType/AlphaROM.cs
+++ b/BurnOutSharp/ProtectionType/AlphaROM.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// SETTEC
- [new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }] = "Alpha-ROM",
+ new Matcher(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs
index ce01cfbd..980faaed 100644
--- a/BurnOutSharp/ProtectionType/CDCheck.cs
+++ b/BurnOutSharp/ProtectionType/CDCheck.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,31 +8,31 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// MGS CDCheck
- [new byte?[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }] = "Microsoft Game Studios CD Check",
+ new Matcher(new byte?[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Microsoft Game Studios CD Check"),
// CDCheck
- [new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }] = "Executable-Based CD Check",
+ new Matcher(new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Executable-Based CD Check"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
// These content checks are too broad to be useful
- private static string CheckContentsBroad(byte[] fileContent, bool includePosition = false)
+ private static string CheckContentsBroad(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// GetDriveType
- [new byte?[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 }] = "Executable-Based CD Check",
+ new Matcher(new byte?[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 }, "Executable-Based CD Check"),
// GetVolumeInformation
- [new byte?[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E }] = "Executable-Based CD Check",
+ new Matcher(new byte?[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E }, "Executable-Based CD Check"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs
index 5de96d9e..a668dfc7 100644
--- a/BurnOutSharp/ProtectionType/CDLock.cs
+++ b/BurnOutSharp/ProtectionType/CDLock.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ 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 byte?[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, 0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF, 0x74 }] = "CD-Lock",
+ new Matcher(new byte?[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, 0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF, 0x74 }, "CD-Lock"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
index 1288b440..c9f75c5d 100644
--- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
+++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// ~0017.tmp
- [new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }] = "CDSHiELD SE",
+ new Matcher(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs
index 714cfa97..0b9a2c8d 100644
--- a/BurnOutSharp/ProtectionType/CactusDataShield.cs
+++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -11,19 +12,19 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// DATA.CDS
- [new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }] = "Cactus Data Shield 200",
+ new Matcher(new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"),
// \*.CDS
- [new byte?[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }] = "Cactus Data Shield 200",
+ new Matcher(new byte?[] { 0x5C, 0x2A, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"),
// CDSPlayer
- [new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }] = "Cactus Data Shield 200",
+ new Matcher(new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }, "Cactus Data Shield 200"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
index 5ca9289b..80d3033f 100644
--- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
+++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// .cenega
- [new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }] = "Cenega ProtectDVD",
+ new Matcher(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs
index 366a25c2..ce1b3298 100644
--- a/BurnOutSharp/ProtectionType/CodeLock.cs
+++ b/BurnOutSharp/ProtectionType/CodeLock.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -8,19 +9,19 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// icd1 + (char)0x00
- [new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }] = "Code Lock",
+ new Matcher(new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }, "Code Lock"),
// icd2 + (char)0x00
- [new byte?[] { 0x69, 0x63, 0x64, 0x32, 0x00 }] = "Code Lock",
+ new Matcher(new byte?[] { 0x69, 0x63, 0x64, 0x32, 0x00 }, "Code Lock"),
// CODE-LOCK.OCX
- [new byte?[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 }] = "Code Lock",
+ new Matcher(new byte?[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 }, "Code Lock"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs
index b340d15b..45601cbb 100644
--- a/BurnOutSharp/ProtectionType/CopyKiller.cs
+++ b/BurnOutSharp/ProtectionType/CopyKiller.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// Tom Commander
- [new byte?[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 }] = "CopyKiller",
+ new Matcher(new byte?[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 }, "CopyKiller"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs
index af448611..e148cd21 100644
--- a/BurnOutSharp/ProtectionType/GFWL.cs
+++ b/BurnOutSharp/ProtectionType/GFWL.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// xlive.dll
- [new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }] = "Games for Windows - Live",
+ new Matcher(new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }, "Games for Windows - Live"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs
index 5bd1d832..1e27c3d5 100644
--- a/BurnOutSharp/ProtectionType/Intenium.cs
+++ b/BurnOutSharp/ProtectionType/Intenium.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -23,13 +24,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// Trial + (char)0x00 + P
- [new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }] = "INTENIUM Trial & Buy Protection",
+ new Matcher(new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }, "INTENIUM Trial & Buy Protection"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs
index 93df8386..c66d5715 100644
--- a/BurnOutSharp/ProtectionType/KeyLock.cs
+++ b/BurnOutSharp/ProtectionType/KeyLock.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// KEY-LOCK COMMAND
- [new byte?[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 }] = "Key-Lock (Dongle)",
+ new Matcher(new byte?[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 }, "Key-Lock (Dongle)"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs
index 9f47c87a..4baf2ae9 100644
--- a/BurnOutSharp/ProtectionType/Origin.cs
+++ b/BurnOutSharp/ProtectionType/Origin.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ 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 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 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"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
index b26d795b..05e72e49 100644
--- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
+++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -9,16 +10,16 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690
- [new byte?[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x41, 0x54, 0x45, 0x44, 0x5C, 0x6E, 0x43, 0x4F, 0x4E, 0x53, 0x4F, 0x4C, 0x45, 0x20, 0x4D, 0x41, 0x59, 0x20, 0x48, 0x41, 0x56, 0x45, 0x20, 0x42, 0x45, 0x45, 0x4E, 0x20, 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5C, 0x6E, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x31, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x37, 0x38, 0x30, 0x2D, 0x37, 0x36, 0x39, 0x30 }] = "PlayStation Anti-modchip (English)",
+ new Matcher(new byte?[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x41, 0x54, 0x45, 0x44, 0x5C, 0x6E, 0x43, 0x4F, 0x4E, 0x53, 0x4F, 0x4C, 0x45, 0x20, 0x4D, 0x41, 0x59, 0x20, 0x48, 0x41, 0x56, 0x45, 0x20, 0x42, 0x45, 0x45, 0x4E, 0x20, 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5C, 0x6E, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x31, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x37, 0x38, 0x30, 0x2D, 0x37, 0x36, 0x39, 0x30 }, "PlayStation Anti-modchip (English)"),
// 強制終了しました。\n本体が改造されている\nおそれがあります。
- [new byte?[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, 0x30, 0x02, 0x5C, 0x6E, 0x67, 0x2C, 0x4F, 0x53, 0x30, 0x4C, 0x65, 0x39, 0x90, 0x20, 0x30, 0x55, 0x30, 0x8C, 0x30, 0x66, 0x30, 0x44, 0x30, 0x8B, 0x5C, 0x6E, 0x30, 0x4A, 0x30, 0x5D, 0x30, 0x8C, 0x30, 0x4C, 0x30, 0x42, 0x30, 0x8A, 0x30, 0x7E, 0x30, 0x59, 0x30, 0x02 }] = "PlayStation Anti-modchip (Japanese)",
+ new Matcher(new byte?[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, 0x30, 0x02, 0x5C, 0x6E, 0x67, 0x2C, 0x4F, 0x53, 0x30, 0x4C, 0x65, 0x39, 0x90, 0x20, 0x30, 0x55, 0x30, 0x8C, 0x30, 0x66, 0x30, 0x44, 0x30, 0x8B, 0x5C, 0x6E, 0x30, 0x4A, 0x30, 0x5D, 0x30, 0x8C, 0x30, 0x4C, 0x30, 0x42, 0x30, 0x8A, 0x30, 0x7E, 0x30, 0x59, 0x30, 0x02 }, "PlayStation Anti-modchip (Japanese)"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs
index 55403afe..41db49f5 100644
--- a/BurnOutSharp/ProtectionType/RingPROTECH.cs
+++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -8,13 +9,13 @@ namespace BurnOutSharp.ProtectionType
/// TODO: Investigate as this may be over-matching
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// (char)0x00 + Allocator + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
- [new byte?[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 }] = "Ring PROTECH [Check disc for physical ring]",
+ new Matcher(new byte?[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 }, "Ring PROTECH [Check disc for physical ring]"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs
index 6d3a527b..c4c899b7 100644
--- a/BurnOutSharp/ProtectionType/SVKProtector.cs
+++ b/BurnOutSharp/ProtectionType/SVKProtector.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// ?SVKP + (char)0x00 + (char)0x00
- [new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }] = "SVK Protector",
+ new Matcher(new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }, "SVK Protector"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs
index 1ed3665f..9373bdbc 100644
--- a/BurnOutSharp/ProtectionType/SmartE.cs
+++ b/BurnOutSharp/ProtectionType/SmartE.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// BITARTS
- [new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }] = "SmartE",
+ new Matcher(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
index dfb202a9..f414ff2e 100644
--- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
+++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ 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 byte?[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 }] = "321Studios Online Activation",
+ new Matcher(new byte?[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 }, "321Studios Online Activation"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}
diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
index 43dbb135..fc70958b 100644
--- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs
+++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -10,13 +11,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// WTM76545
- [new byte?[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }] = "WTM CD Protect",
+ new Matcher(new byte?[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 }, "WTM CD Protect"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs
index c84a5e40..5eeb52f9 100644
--- a/BurnOutSharp/ProtectionType/XCP.cs
+++ b/BurnOutSharp/ProtectionType/XCP.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using BurnOutSharp.FileType;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -11,19 +12,19 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// XCP.DAT
- [new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }] = "XCP",
+ new Matcher(new byte?[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 }, "XCP"),
// XCPPlugins.dll
- [new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x6C, 0x75, 0x67, 0x69, 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }] = "XCP",
+ new Matcher(new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x6C, 0x75, 0x67, 0x69, 0x6E, 0x73, 0x2E, 0x64, 0x6C, 0x6C }, "XCP"),
// XCPPhoenix.dll
- [new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C }] = "XCP",
+ new Matcher(new byte?[] { 0x58, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x65, 0x6E, 0x69, 0x78, 0x2E, 0x64, 0x6C, 0x6C }, "XCP"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
///
diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs
index e3857b73..203be39c 100644
--- a/BurnOutSharp/ProtectionType/XtremeProtector.cs
+++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
@@ -7,13 +8,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
- var mappings = new Dictionary
+ var matchers = new List
{
// XPROT
- [new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }] = "Xtreme-Protector",
+ new Matcher(new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }, "Xtreme-Protector"),
};
- return Utilities.GetContentMatches(fileContent, mappings, includePosition);
+ return Utilities.GetContentMatches(file, fileContent, matchers, includePosition);
}
}
}