Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LogitechDeviceGroup.cs
Go to the documentation of this file.
1using System;
4
6
8{
9 private readonly List<RgbDevice> _devices = new List<RgbDevice>();
10
11 private bool _isInitialized;
12
14
16
21
22 protected override void Initialize()
23 {
25 {
26 return;
27 }
28 if (!NativeLibrary.TryLoad("LogitechLedEnginesWrapper ", out var _))
29 {
31 return;
32 }
33 try
34 {
36 {
37 throw new DeviceInitializationException("LogitechGSDK failed to initialize.");
38 }
39 _isInitialized = true;
41 {
42 throw new DeviceInitializationException("LogitechGSDK failed to target RGB devices.");
43 }
46 Console.WriteLine("Logitech RGB initialized.");
47 }
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 }
58
59 protected override void Uninitialize()
60 {
62 {
63 try
64 {
66 Console.WriteLine("Logitech RGB uninitialized.");
67 }
69 {
70 }
71 catch (Exception ex2)
72 {
73 Console.WriteLine("Logitech RGB failed to uninitialize: " + ex2);
74 }
75 _isInitialized = false;
76 }
77 }
78
80 {
81 return _devices.GetEnumerator();
82 }
83}
static bool LogiLedSetTargetDevice(int targetDevice)
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static bool TryLoad(string libraryPath, out IntPtr handle)