Is there a way to check if a driver is ready?
Since I am listing all directories, when it reach the dvd for example, I get an exception saying that the driver is not ready.
Thanls a lot
@{
try
{
//Resgata todos os drivers Lógicos do Sistema
string[] drives = System.IO.Directory.GetLogicalDrives();
Response.Write("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n");
//Itera sobre cada driver no array
foreach(string drive in directoryEntries) {
//Para cada driver cria um LI A
Response.Write("\t<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + drive + "\">" + drive + "</a></li>\n");
//Resgata subDiretórios de cada driver
string[] directoryEntries = System.IO.Directory.GetFileSystemEntries(drive);
}
}
catch (Exception)
{
throw;
}
}
thanks a lot
Have a look at the DriveInfo.IsReady property.
Further information can be found on this MSDN entry: