Some more fixes to magic checks
This commit is contained in:
parent
72ea6d0eb7
commit
7845840209
Binary file not shown.
Binary file not shown.
@ -12,8 +12,18 @@ namespace Switch_Toolbox.Library.IO
|
||||
//https://github.com/exelix11/EditorCore/blob/872d210f85ec0409f8a6ac3a12fc162aaf4cd90c/EditorCoreCommon/CustomClasses.cs#L367
|
||||
public static bool Matches(this byte[] arr, string magic) =>
|
||||
arr.Matches(0, magic.ToCharArray());
|
||||
public static bool Matches(this byte[] arr, uint startIndex, string magic) =>
|
||||
arr.Matches(startIndex, magic.ToCharArray());
|
||||
public static bool Matches(this byte[] arr, uint magic) =>
|
||||
arr.Matches(0, BitConverter.GetBytes(magic));
|
||||
|
||||
public static bool Matches(this byte[] arr, uint startIndex, params byte[] magic)
|
||||
{
|
||||
if (arr.Length < magic.Length + startIndex) return false;
|
||||
for (uint i = 0; i < magic.Length; i++)
|
||||
{
|
||||
if (arr[i + startIndex] != magic[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Matches(this byte[] arr, uint startIndex, params char[] magic)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user