validateHeader static method
- Uint8List patch,
- PatchFormat format
Validates that a patch file has a valid header for the specified format.
patch
is the patch data.
format
is the expected patch format.
Returns true if the header is valid, false otherwise.
Implementation
static bool validateHeader(Uint8List patch, PatchFormat format) {
if (patch.length < 4) {
return false;
}
final signature = format.signature;
if (patch.length < signature.length) {
return false;
}
for (int i = 0; i < signature.length; i++) {
if (patch[i] != signature[i]) {
return false;
}
}
return true;
}