public override bool IsRecognizedOn(Drive drive) { if (!DriveTypeCorrect(drive)) { return(false); } for (var i = 1; i < 10; i++) // retries, in case of pesky IOException "drive not ready" errors when trying to read the volume label. What is that about... { try { var localdrive = drive as LocalDrive; if (localdrive == null) { return(false); } return(localdrive.driveinfo.VolumeLabel == label); } catch (IOException e) { } System.Threading.Thread.Sleep(100); } return(false); }
public bool FindOnDrives(IEnumerable <Drive> drives) { if (drives == null) { return(false); } lock (drives) { foreach (var drive in drives) // may take some time! { Console.WriteLine(drive); current_recognition = RecognizedOnDrive(drive); current_drive = drive; if (!(current_recognition is null)) { Console.WriteLine("Detected " + this.Label + " on " + drive.ToString() + " " + (drive is NetworkDrive ? "(network)" : "(local)")); this.current_drive = drive; return(true); } } } Console.WriteLine("Missing " + this.Label); return(false); }
public void Reset() { this.IsPresent = false; this.current_drive = null; }
internal string ToString(Drive drive) { return(drive.ToString() + "+" + rootpath); }
protected bool DriveTypeCorrect(Drive drive) { return((drive is NetworkDrive && CanRecognizeNetworkShare) || (drive is LocalDrive && CanRecognizeLocalDrive)); }
public abstract bool IsRecognizedOn(Drive drive);