Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RazerDeviceGroup.cs
Go to the documentation of this file.
1using System;
5
7
8public sealed class RazerDeviceGroup : RgbDeviceGroup
9{
10 private readonly List<RgbDevice> _devices = new List<RgbDevice>();
11
12 private bool _isInitialized;
13
15
17
22
23 protected override void Initialize()
24 {
26 {
27 return;
28 }
29 if (!NativeLibrary.TryLoad("RzChromaSDK64.dll", Assembly.GetEntryAssembly(), DllImportSearchPath.SafeDirectories, out var _))
30 {
32 return;
33 }
34 try
35 {
37 if (rzResult != 0)
38 {
39 int num = (int)rzResult;
40 throw new DeviceInitializationException("Unable to initialize Razer Synapse: " + num);
41 }
42 _isInitialized = true;
49 Console.WriteLine("Razer Chroma initialized.");
50 }
52 {
53 Console.WriteLine("Razer Chroma not supported. (Can be disabled via Config.json)");
55 }
56 catch (Exception ex2)
57 {
58 Console.WriteLine("Razer Chroma not supported: " + ex2);
60 }
61 }
62
63 protected override void Uninitialize()
64 {
65 if (!_isInitialized)
66 {
67 return;
68 }
69 try
70 {
73 if (rzResult != 0)
74 {
75 int num = (int)rzResult;
76 throw new DeviceInitializationException("Unable to uninitialize Razer Synapse: " + num);
77 }
78 Console.WriteLine("Razer Chroma unitialized.");
79 }
80 catch (Exception ex)
81 {
83 {
84 Console.WriteLine("Razer Chroma failed to uninitialize: " + ex);
85 }
86 }
87 _isInitialized = false;
88 }
89
91 {
92 return _devices.GetEnumerator();
93 }
94}
RazerDeviceGroup(VendorColorProfile colorProfiles)
override IEnumerator< RgbDevice > GetEnumerator()
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static ? Assembly GetEntryAssembly()
Definition Assembly.cs:486
static bool TryLoad(string libraryPath, out IntPtr handle)