1
Fork 0

Added function to get drives

This commit is contained in:
Jake Howard 2014-07-21 12:39:57 +01:00
parent 6adb106018
commit ba28d2dc9b

View file

@ -9,9 +9,20 @@ namespace Saviour_Backup_System
{
public class USBTools
{
public void updateDriveList()
public DriveInfo[] getConnectedDrives()
{
//Get code for scanning drive (from other project) here
List<DriveInfo> drivesList = new List<DriveInfo>();
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives) {
try {
string driveName = drive.VolumeLabel;
string driveLetter = drive.Name;
} catch { // If there is a problem getting the drive data, then the program would crash!
continue;
}
drivesList.Add(drive);
}
return drivesList.ToArray();
}
}
}