Added code to handle exceptions when creating the report for drives that are no longer available/ready.

This commit is contained in:
Michael Möller
2013-06-09 20:11:20 +00:00
parent 4d5fa18490
commit 57915384c8
2 changed files with 11 additions and 7 deletions
+9 -5
View File
@@ -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();
+2 -2
View File
@@ -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")]