Skip to content

Commit db4fdf0

Browse files
authored
Merge pull request #289 from chroma-sdk/hotfix/registry-fix
2 parents 1aa47d0 + d9d48ae commit db4fdf0

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

Colore.sln.DotSettings

+4
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@
280280
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
281281
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
282282
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
283+
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=Colore_002ETests_003B_002A_003B_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
284+
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=Colore_003B_002A_003BColore_002ELogging_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
285+
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=Colore_003B_002A_003BColore_002ELogging_002ELogProviders_002E_002A_003B_002A/@EntryIndexedValue">True</s:Boolean>
286+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EdotCover_002EIde_002ECore_002EFilterManagement_002EModel_002ESolutionFilterSettingsManagerMigrateSettings/@EntryIndexedValue">True</s:Boolean>
283287
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
284288
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
285289
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>

src/Colore/Helpers/RegistryHelper.cs

+26-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ namespace Colore.Helpers
3939
/// </summary>
4040
internal static class RegistryHelper
4141
{
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+
4251
/// <summary>
4352
/// Logger instance for this class.
4453
/// </summary>
@@ -103,9 +112,9 @@ internal static bool TryGetSdkVersion(out SdkVersion ver)
103112

104113
Log.WarnFormat(
105114
"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>");
109118

110119
ver = new SdkVersion(0, 0, 0);
111120
return false;
@@ -188,6 +197,19 @@ private static bool IsSdkEnabledInRegistry()
188197

189198
var value = key.GetValue("Enable");
190199

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+
191213
if (value is int i)
192214
{
193215
return i == 1;
@@ -196,7 +218,7 @@ private static bool IsSdkEnabledInRegistry()
196218
Log.Warn(
197219
"Chroma SDK has changed registry setting format. Please update Colore to latest version.");
198220

199-
Log.DebugFormat("New Enabled type: {0}", value.GetType());
221+
Log.DebugFormat("New Enabled type: {0}", value?.GetType().ToString() ?? "<NULL>");
200222

201223
return true;
202224
}

0 commit comments

Comments
 (0)