@@ -39,6 +39,15 @@ namespace Colore.Helpers
39
39
/// </summary>
40
40
internal static class RegistryHelper
41
41
{
42
+ /// <summary>
43
+ /// Path to a SubKey under "Razer Chroma SDK" in the registry containing information about the SDK.
44
+ /// </summary>
45
+ /// <remarks>
46
+ /// In some version of the SDK, the location of the "Enabled" key changed to be in this SubKey
47
+ /// under the main key in the registry for the Chroma SDK.
48
+ /// </remarks>
49
+ private const string AppsSubKeyPath = "Apps" ;
50
+
42
51
/// <summary>
43
52
/// Logger instance for this class.
44
53
/// </summary>
@@ -103,9 +112,9 @@ internal static bool TryGetSdkVersion(out SdkVersion ver)
103
112
104
113
Log . WarnFormat (
105
114
"Unknown version component types, please tell a developer: Ma is {0}, Mi is {1}, R is {2}." ,
106
- major . GetType ( ) ,
107
- minor . GetType ( ) ,
108
- revision . GetType ( ) ) ;
115
+ major ? . GetType ( ) . ToString ( ) ?? "<NULL>" ,
116
+ minor ? . GetType ( ) . ToString ( ) ?? "<NULL>" ,
117
+ revision ? . GetType ( ) . ToString ( ) ?? "<NULL>" ) ;
109
118
110
119
ver = new SdkVersion ( 0 , 0 , 0 ) ;
111
120
return false ;
@@ -188,6 +197,19 @@ private static bool IsSdkEnabledInRegistry()
188
197
189
198
var value = key . GetValue ( "Enable" ) ;
190
199
200
+ if ( value is null )
201
+ {
202
+ Log . Debug ( "'Enable' under main registry subkey was NULL, trying 'Apps' subkey" ) ;
203
+
204
+ using ( var appsSubKey = key . OpenSubKey ( AppsSubKeyPath ) )
205
+ {
206
+ if ( appsSubKey != null )
207
+ {
208
+ value = appsSubKey . GetValue ( "Enable" ) ;
209
+ }
210
+ }
211
+ }
212
+
191
213
if ( value is int i )
192
214
{
193
215
return i == 1 ;
@@ -196,7 +218,7 @@ private static bool IsSdkEnabledInRegistry()
196
218
Log . Warn (
197
219
"Chroma SDK has changed registry setting format. Please update Colore to latest version." ) ;
198
220
199
- Log . DebugFormat ( "New Enabled type: {0}" , value . GetType ( ) ) ;
221
+ Log . DebugFormat ( "New Enabled type: {0}" , value ? . GetType ( ) . ToString ( ) ?? "<NULL>" ) ;
200
222
201
223
return true ;
202
224
}
0 commit comments