Added code to handle exceptions when creating the report for drives that are no longer available/ready.
authormoel.mich
Sun, 09 Jun 2013 20:11:20 +0000
changeset 4041201889d413a
parent 403 c540cf36b7ce
child 405 8eeac521b3b6
Added code to handle exceptions when creating the report for drives that are no longer available/ready.
Hardware/HDD/AbstractHarddrive.cs
Properties/AssemblyVersion.cs
     1.1 --- a/Hardware/HDD/AbstractHarddrive.cs	Sun Jun 09 19:57:00 2013 +0000
     1.2 +++ b/Hardware/HDD/AbstractHarddrive.cs	Sun Jun 09 20:11:20 2013 +0000
     1.3 @@ -317,11 +317,15 @@
     1.4        }
     1.5  
     1.6        foreach (DriveInfo di in driveInfos) {
     1.7 -        r.AppendLine("Logical drive name: " + di.Name);
     1.8 -        r.AppendLine("Format: " + di.DriveFormat);
     1.9 -        r.AppendLine("Total size: " + di.TotalSize);
    1.10 -        r.AppendLine("Total free space: " + di.TotalFreeSpace);
    1.11 -        r.AppendLine();
    1.12 +        if (!di.IsReady)
    1.13 +          continue;
    1.14 +        try {
    1.15 +          r.AppendLine("Logical drive name: " + di.Name);
    1.16 +          r.AppendLine("Format: " + di.DriveFormat);
    1.17 +          r.AppendLine("Total size: " + di.TotalSize);
    1.18 +          r.AppendLine("Total free space: " + di.TotalFreeSpace);
    1.19 +          r.AppendLine();
    1.20 +        } catch (IOException) { } catch (UnauthorizedAccessException) { }
    1.21        }
    1.22  
    1.23        return r.ToString();
     2.1 --- a/Properties/AssemblyVersion.cs	Sun Jun 09 19:57:00 2013 +0000
     2.2 +++ b/Properties/AssemblyVersion.cs	Sun Jun 09 20:11:20 2013 +0000
     2.3 @@ -10,5 +10,5 @@
     2.4  
     2.5  using System.Reflection;
     2.6  
     2.7 -[assembly: AssemblyVersion("0.5.1.15")]
     2.8 -[assembly: AssemblyInformationalVersion("0.5.1.15 Alpha")]
     2.9 \ No newline at end of file
    2.10 +[assembly: AssemblyVersion("0.5.1.16")]
    2.11 +[assembly: AssemblyInformationalVersion("0.5.1.16 Alpha")]
    2.12 \ No newline at end of file