Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Initialize()

override void ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup.Initialize ( )
inlineprotected

Definition at line 22 of file LogitechDeviceGroup.cs.

23 {
25 {
26 return;
27 }
28 if (!NativeLibrary.TryLoad("LogitechLedEnginesWrapper ", out var _))
29 {
31 return;
32 }
33 try
34 {
35 if (!NativeMethods.LogiLedInit())
36 {
37 throw new DeviceInitializationException("LogitechGSDK failed to initialize.");
38 }
39 _isInitialized = true;
40 if (!NativeMethods.LogiLedSetTargetDevice(6))
41 {
42 throw new DeviceInitializationException("LogitechGSDK failed to target RGB devices.");
43 }
44 _devices.Add(new LogitechKeyboard(_colorProfiles.Keyboard));
45 _devices.Add(new LogitechSingleLightDevice(_colorProfiles.Generic));
46 Console.WriteLine("Logitech RGB initialized.");
47 }
48 catch (DeviceInitializationException)
49 {
50 Console.WriteLine("Logitech RGB not supported. (Can be disabled via Config.json)");
52 }
53 catch (Exception ex2)
54 {
55 Console.WriteLine("Logitech RGB not supported: " + ex2);
56 }
57 }
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static bool TryLoad(string libraryPath, out IntPtr handle)

References ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup._colorProfiles, ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup._devices, ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup._initializationFailed, ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup._isInitialized, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), ReLogic.Peripherals.RGB.VendorColorProfile.Generic, ReLogic.Peripherals.RGB.VendorColorProfile.Keyboard, ReLogic.Peripherals.RGB.Logitech.NativeMethods.LogiLedInit(), ReLogic.Peripherals.RGB.Logitech.NativeMethods.LogiLedSetTargetDevice(), System.Runtime.InteropServices.NativeLibrary.TryLoad(), ReLogic.Peripherals.RGB.Logitech.LogitechDeviceGroup.Uninitialize(), and System.Console.WriteLine().