using System.IO; using DICUI.Data; namespace DICUI.Utilities { /// /// Represents information for a single drive /// public class Drive { /// /// Represents drive type /// public InternalDriveType? InternalDriveType { get; set; } /// /// DriveInfo object representing the drive, if possible /// public DriveInfo DriveInfo { get; private set; } /// /// Windows drive letter /// public char Letter { get { return DriveInfo?.Name[0] ?? '\0'; } } /// /// Media label as read by Windows /// public string VolumeLabel { get { if (DriveInfo.IsReady) { if (string.IsNullOrWhiteSpace(DriveInfo.VolumeLabel)) return "track"; else return DriveInfo.VolumeLabel; } else { return Template.DiscNotDetected; } } } /// /// Drive partition format /// public string DriveFormat { get { return DriveInfo.DriveFormat; } } /// /// Represents if Windows has marked the drive as active /// public bool MarkedActive { get { return DriveInfo.IsReady; } } public Drive(InternalDriveType? driveType, DriveInfo driveInfo) { this.InternalDriveType = driveType; this.DriveInfo = driveInfo; } } }