internal static bool verifychk(byte[] input)
{
ushort checksum = 0;
if (input.Length == 100 || input.Length == 80) // Gen 3 Files
{
for (int i = 32; i < 80; i += 2)
checksum += BitConverter.ToUInt16(input, i);
return (checksum == BitConverter.ToUInt16(input, 28));
}
{
if (input.Length == 236 || input.Length == 220 || input.Length == 136) // Gen 4/5
Array.Resize(ref input, 136);
else if (input.Length == 232 || input.Length == 260) // Gen 6
Array.Resize(ref input, 232);
else throw new Exception("Wrong sized input array to verifychecksum");
ushort chk = 0;
for (int i = 8; i < input.Length; i += 2)
chk += BitConverter.ToUInt16(input, i);
return (chk == BitConverter.ToUInt16(input, 0x6));
}
}
internal static uint getPSV(uint PID)