Added code to handle exceptions when creating the report for drives that are no longer available/ready.
This commit is contained in:
@@ -317,11 +317,15 @@ namespace OpenHardwareMonitor.Hardware.HDD {
|
||||
}
|
||||
|
||||
foreach (DriveInfo di in driveInfos) {
|
||||
r.AppendLine("Logical drive name: " + di.Name);
|
||||
r.AppendLine("Format: " + di.DriveFormat);
|
||||
r.AppendLine("Total size: " + di.TotalSize);
|
||||
r.AppendLine("Total free space: " + di.TotalFreeSpace);
|
||||
r.AppendLine();
|
||||
if (!di.IsReady)
|
||||
continue;
|
||||
try {
|
||||
r.AppendLine("Logical drive name: " + di.Name);
|
||||
r.AppendLine("Format: " + di.DriveFormat);
|
||||
r.AppendLine("Total size: " + di.TotalSize);
|
||||
r.AppendLine("Total free space: " + di.TotalFreeSpace);
|
||||
r.AppendLine();
|
||||
} catch (IOException) { } catch (UnauthorizedAccessException) { }
|
||||
}
|
||||
|
||||
return r.ToString();
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("0.5.1.15")]
|
||||
[assembly: AssemblyInformationalVersion("0.5.1.15 Alpha")]
|
||||
[assembly: AssemblyVersion("0.5.1.16")]
|
||||
[assembly: AssemblyInformationalVersion("0.5.1.16 Alpha")]
|
||||
Reference in New Issue
Block a user