Add ImgBurn and UltraISO check extensions

This commit is contained in:
Matt Nadareski
2025-10-30 17:04:29 -04:00
parent a24a92e97c
commit acb8e98fe2

View File

@@ -1,5 +1,6 @@
using System;
using SabreTools.Data.Models.ISO9660;
using SabreTools.IO.Extensions;
namespace SabreTools.Data.Extensions
{
@@ -57,6 +58,36 @@ namespace SabreTools.Data.Extensions
return Array.TrueForAll(bvd.Reserved653Bytes, b => b == 0x00);
}
/// <summary>
/// Determine if a volume descriptor was written by ImgBurn
/// </summary>
/// <param name="bvd">Volume descriptor containing the application use bytes</param>
/// <returns>True if the descriptor was written by ImgBurn, false otherwise</returns>
public static bool IsImgBurn(this BaseVolumeDescriptor? bvd)
{
// Invalid volume descriptor
if (bvd?.ApplicationUse == null)
return false;
// "ImgBurn"
return bvd.ApplicationUse.StartsWith([0x49, 0x6D, 0x67, 0x42, 0x75, 0x72, 0x6E]);
}
/// <summary>
/// Determine if a volume descriptor was written by UltraISO
/// </summary>
/// <param name="bvd">Volume descriptor containing the application use bytes</param>
/// <returns>True if the descriptor was written by UltraISO, false otherwise</returns>
public static bool IsUltraISO(this BaseVolumeDescriptor? bvd)
{
// Invalid volume descriptor
if (bvd?.ApplicationUse == null)
return false;
// "ULTRAISO"
return bvd.ApplicationUse.StartsWith([0x55, 0x4C, 0x54, 0x52, 0x41, 0x49, 0x53, 0x4F]);
}
/// <summary>
/// Indicates if an array contains all ASCII numeric digits
/// </summary>