mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Move drive scanning to Utilities
This commit is contained in:
21
Utilities.cs
21
Utilities.cs
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
@@ -521,7 +523,7 @@ namespace DICUI
|
||||
/// <summary>
|
||||
/// Create a list of systems matched to their respective enums
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>Systems matched to enums, if possible</returns>
|
||||
/// <remarks>
|
||||
/// This returns a List of Tuples whose structure is as follows:
|
||||
/// Item 1: Printable name
|
||||
@@ -579,5 +581,22 @@ namespace DICUI
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a list of active optical drives matched to their volume labels
|
||||
/// </summary>
|
||||
/// <returns>Active drives, matched to labels, if possible</returns>
|
||||
/// <remarks>
|
||||
/// This returns a List of Tuples whose structure is as follows:
|
||||
/// Item 1: Drive letter
|
||||
/// Item 2: Volume label
|
||||
/// </remarks>
|
||||
public static List<Tuple<char, string>> CreateListOfDrives()
|
||||
{
|
||||
return DriveInfo.GetDrives()
|
||||
.Where(d => d.DriveType == DriveType.CDRom && d.IsReady)
|
||||
.Select(d => new Tuple<char, string>(d.Name[0], d.VolumeLabel))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user