diff --git a/MPF.Library/Utilities/Drive.cs b/MPF.Library/Utilities/Drive.cs
index f4c6febf..46e4631c 100644
--- a/MPF.Library/Utilities/Drive.cs
+++ b/MPF.Library/Utilities/Drive.cs
@@ -14,14 +14,19 @@ namespace MPF.Utilities
public InternalDriveType? InternalDriveType { get; set; }
///
- /// DriveInfo object representing the drive, if possible
+ /// Drive partition format
///
- public DriveInfo DriveInfo { get; private set; }
+ public string DriveFormat { get { return driveInfo.DriveFormat; } }
///
/// Windows drive letter
///
- public char Letter { get { return DriveInfo?.Name[0] ?? '\0'; } }
+ public char Letter { get { return driveInfo?.Name[0] ?? '\0'; } }
+
+ ///
+ /// Represents if Windows has marked the drive as active
+ ///
+ public bool MarkedActive { get { return driveInfo.IsReady; } }
///
/// Media label as read by Windows
@@ -31,12 +36,12 @@ namespace MPF.Utilities
get
{
string volumeLabel = Template.DiscNotDetected;
- if (DriveInfo.IsReady)
+ if (driveInfo.IsReady)
{
- if (string.IsNullOrWhiteSpace(DriveInfo.VolumeLabel))
+ if (string.IsNullOrWhiteSpace(driveInfo.VolumeLabel))
volumeLabel = "track";
else
- volumeLabel = DriveInfo.VolumeLabel;
+ volumeLabel = driveInfo.VolumeLabel;
}
foreach (char c in Path.GetInvalidFileNameChars())
@@ -47,19 +52,14 @@ namespace MPF.Utilities
}
///
- /// Drive partition format
+ /// DriveInfo object representing the drive, if possible
///
- public string DriveFormat { get { return DriveInfo.DriveFormat; } }
-
- ///
- /// Represents if Windows has marked the drive as active
- ///
- public bool MarkedActive { get { return DriveInfo.IsReady; } }
+ private DriveInfo driveInfo = null;
public Drive(InternalDriveType? driveType, DriveInfo driveInfo)
{
this.InternalDriveType = driveType;
- this.DriveInfo = driveInfo;
+ this.driveInfo = driveInfo;
}
///
@@ -71,7 +71,7 @@ namespace MPF.Utilities
public byte[] ReadSector(long num, int size = 2048)
{
// Missing drive leter is not supported
- if (string.IsNullOrEmpty(this.DriveInfo?.Name))
+ if (string.IsNullOrEmpty(this.driveInfo?.Name))
return null;
// We don't support negative sectors