diff --git a/Saviour Backup System/USBTools.cs b/Saviour Backup System/USBTools.cs index 4c83158..9b9d92c 100644 --- a/Saviour Backup System/USBTools.cs +++ b/Saviour Backup System/USBTools.cs @@ -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 drivesList = new List(); + 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(); } } }