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

@@ -82,8 +82,7 @@ namespace RGB.NET.Devices.Logitech
if (IsInitialized)
_LogitechGSDK.LogiLedRestoreLighting();
}
catch
{ /* At least we tried ... */ }
catch { /* At least we tried ... */ }
IsInitialized = false;
@@ -97,34 +96,40 @@ namespace RGB.NET.Devices.Logitech
IList<IRGBDevice> devices = new List<IRGBDevice>();
DeviceChecker.LoadDeviceList();
if (DeviceChecker.IsPerKeyDeviceConnected)
try
{
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerKeyDeviceData;
LogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageBasePath, imageLayout, layoutPath));
device.Initialize();
devices.Add(device);
if (DeviceChecker.IsPerKeyDeviceConnected)
{
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerKeyDeviceData;
LogitechRGBDevice device = new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, imageBasePath, imageLayout, layoutPath));
device.Initialize();
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
if (DeviceChecker.IsPerDeviceDeviceConnected)
try
{
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerDeviceDeviceData;
LogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageBasePath, imageLayout, layoutPath));
device.Initialize();
devices.Add(device);
if (DeviceChecker.IsPerDeviceDeviceConnected)
{
(string model, RGBDeviceType deviceType, int _, string imageBasePath, string imageLayout, string layoutPath) = DeviceChecker.PerDeviceDeviceData;
LogitechRGBDevice device = new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, imageBasePath, imageLayout, layoutPath));
device.Initialize();
devices.Add(device);
}
}
catch { if (throwExceptions) throw; }
Devices = new ReadOnlyCollection<IRGBDevice>(devices);
IsInitialized = true;
}
catch
{
if (throwExceptions)
throw;
else
return false;
return false;
}
IsInitialized = true;
return true;
}