Make protection location optional (default off)

This commit is contained in:
Matt Nadareski
2020-09-10 21:43:18 -07:00
parent c4f8fa4b0d
commit 0c137e97f0
54 changed files with 224 additions and 219 deletions

View File

@@ -2,22 +2,22 @@
{
public class ThreePLock
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// ".ldr"
byte[] check = new byte[] { 0x2E, 0x6C, 0x64, 0x72 };
if (fileContent.Contains(check, out int position))
return $"3PLock (Index {position})";
return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
// ".ldt"
check = new byte[] { 0x2E, 0x6C, 0x64, 0x74 };
if (fileContent.Contains(check, out position))
return $"3PLock (Index {position})";
return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
// "Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW"
// check = new byte[] { 0x59, 0xC3, 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x30, 0x53, 0x56, 0x57 };
//if (fileContent.Contains(check, out position))
// return $"3PLock (Index {position})";
// return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}