Added function to get drives
This commit is contained in:
parent
6adb106018
commit
ba28d2dc9b
1 changed files with 13 additions and 2 deletions
|
@ -9,9 +9,20 @@ namespace Saviour_Backup_System
|
||||||
{
|
{
|
||||||
public class USBTools
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue