mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
Add unset reserved bytes extension
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user