deviceScanner.Join();//the thread will exit when a valid drive has been found
//code here to unlock computer and
}
}
classdeviceScan
{
internalstaticDriveInfovalidDrive;
internalstaticDriveInfo[]driveListing;
privatestaticbooldriveFound=false;
internalstaticvoidscanDevices()
{
while(!driveFound){
driveListing=DriveInfo.GetDrives();
foreach(DriveInfocurrentDriveindriveListing)
{
if(File.Exists(currentDrive.Name+"\\LockDown.config"))// the first check for a valid drive. Could be something else, but this is a lightweight test to be done first!