Changed all device-providers to load as much devices as possible without throwing exceptions

This commit is contained in:
DarthAffe committed 2017-11-19 21:20:23 +01:00
1 parent 800a9c2e72
commit 338936d42f
6 files changed
+190 -196

No files matched your search

@@ -66,15 +66,16 @@ namespace RGB.NET.Devices.Novation
{
IList<IRGBDevice> devices = new List<IRGBDevice>();
try
for (int index = 0; index < OutputDeviceBase.DeviceCount; index++)
{
for (int index = 0; index < OutputDeviceBase.DeviceCount; index++)
try
{
MidiOutCaps outCaps = OutputDeviceBase.GetDeviceCapabilities(index);
if (outCaps.name == null) continue;
NovationDevices? deviceId = (NovationDevices?)Enum.GetValues(typeof(NovationDevices)).Cast<Enum>()
.FirstOrDefault(x => string.Equals(x.GetDeviceId(), outCaps.name, StringComparison.OrdinalIgnoreCase));
NovationDevices? deviceId = (NovationDevices?)Enum.GetValues(typeof(NovationDevices))
.Cast<Enum>()
.FirstOrDefault(x => string.Equals(x.GetDeviceId(), outCaps.name, StringComparison.OrdinalIgnoreCase));
if (deviceId == null) continue;
@@ -82,25 +83,19 @@ namespace RGB.NET.Devices.Novation
device.Initialize();
devices.Add(device);
}
}
catch
{
if (throwExceptions)
throw;
catch { if (throwExceptions) throw; }
}
Devices = new ReadOnlyCollection<IRGBDevice>(devices);
IsInitialized = true;
}
catch
{
if (throwExceptions)
throw;
else
return false;
return false;
}
IsInitialized = true;
return true;
}