Add unset reserved bytes extension

This commit is contained in:
Matt Nadareski
2025-10-30 16:22:05 -04:00
parent f2d2fe97bb
commit a24a92e97c

View File

@@ -42,6 +42,21 @@ namespace SabreTools.Data.Extensions
return blockLength;
}
/// <summary>
/// Check if a volume descriptor has all 0x00 reserved bytes
/// </summary>
/// <param name="bvd">Volume descriptor containing the reserved bytes</param>
/// <returns>True if the reserved bytes are all 0x00, false otherwise</returns>
public static bool HasUnsetReservedBytes(this BaseVolumeDescriptor? bvd)
{
// Invalid volume descriptor
if (bvd?.Reserved653Bytes == null)
return false;
// Check if all bytes are 0x00
return Array.TrueForAll(bvd.Reserved653Bytes, b => b == 0x00);
}
/// <summary>
/// Indicates if an array contains all ASCII numeric digits
/// </summary>