Add Menu for selecting Capture Device
This commit is contained in:
@@ -2,13 +2,29 @@
|
||||
using FlashCap;
|
||||
|
||||
var device = new CaptureDevices();
|
||||
foreach (var descriptor in device.GetDescriptors())
|
||||
var descriptors = device.GetDescriptors().Where(x=>x.Characteristics.Length > 0).ToList();
|
||||
var deviceIndex = -1;
|
||||
while (deviceIndex == -1)
|
||||
{
|
||||
Console.WriteLine($"Name: {descriptor.Name}, " +
|
||||
$"Description: {descriptor.Description}, " +
|
||||
$"DeviceType: {descriptor.DeviceType}, " +
|
||||
$"Identity: {descriptor.Identity}" +
|
||||
$"Characteristics:\n" +
|
||||
$"\t{string.Join("\n\t",descriptor.Characteristics.Where(x=>x.Height >=1080))}"
|
||||
);
|
||||
PrintDevices(descriptors);
|
||||
var input = Console.ReadLine();
|
||||
int.TryParse(input, out var result);
|
||||
if (result<1 || result>descriptors.Count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
deviceIndex = result-1;
|
||||
}
|
||||
var captureDescriptor = descriptors[deviceIndex];
|
||||
Console.WriteLine($"Characteristics:\n\t{string.Join("\n\t",captureDescriptor.Characteristics)}");
|
||||
return;
|
||||
|
||||
void PrintDevices(List<CaptureDeviceDescriptor> captureDeviceDescriptors)
|
||||
{
|
||||
Console.WriteLine("Choose your Device:");
|
||||
for (var index = 0; index < captureDeviceDescriptors.Count; index++)
|
||||
{
|
||||
var descriptor = captureDeviceDescriptors[index];
|
||||
Console.WriteLine($"\t({index+1}): {descriptor.Name}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user