mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-14 13:46:05 +00:00
* Who doesn't like drives? * Add another TODO * Use built in stuff, it's quicker * More special handling for floppies, easier this time * Fix broken test * Set active drive priority, String -> string * Track reason for no scanning * Update DIC version and release notes
64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using System.IO;
|
|
using DICUI.Data;
|
|
|
|
namespace DICUI.Utilities
|
|
{
|
|
/// <summary>
|
|
/// Represents information for a single drive
|
|
/// </summary>
|
|
public class Drive
|
|
{
|
|
/// <summary>
|
|
/// Represents drive type
|
|
/// </summary>
|
|
public InternalDriveType? InternalDriveType { get; set; }
|
|
|
|
/// <summary>
|
|
/// DriveInfo object representing the drive, if possible
|
|
/// </summary>
|
|
public DriveInfo DriveInfo { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Windows drive letter
|
|
/// </summary>
|
|
public char Letter { get { return DriveInfo?.Name[0] ?? '\0'; } }
|
|
|
|
/// <summary>
|
|
/// Media label as read by Windows
|
|
/// </summary>
|
|
public string VolumeLabel
|
|
{
|
|
get
|
|
{
|
|
if (DriveInfo.IsReady)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(DriveInfo.VolumeLabel))
|
|
return "track";
|
|
else
|
|
return DriveInfo.VolumeLabel;
|
|
}
|
|
else
|
|
{
|
|
return Template.DiscNotDetected;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Drive partition format
|
|
/// </summary>
|
|
public string DriveFormat { get { return DriveInfo.DriveFormat; } }
|
|
|
|
/// <summary>
|
|
/// Represents if Windows has marked the drive as active
|
|
/// </summary>
|
|
public bool MarkedActive { get { return DriveInfo.IsReady; } }
|
|
|
|
public Drive(InternalDriveType? driveType, DriveInfo driveInfo)
|
|
{
|
|
this.InternalDriveType = driveType;
|
|
this.DriveInfo = driveInfo;
|
|
}
|
|
}
|
|
}
|