From 353243dbf8030070e711b4f2d8cf2e153342dc89 Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Wed, 28 Oct 2015 13:50:13 +0100 Subject: [PATCH 1/4] Update SetEffect to ignore resource errors Updates SetEffect to ignore RzResourceDisabled error due to ambiguity introduced by Razer. --- Corale.Colore/Core/NativeWrapper.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Corale.Colore/Core/NativeWrapper.cs b/Corale.Colore/Core/NativeWrapper.cs index f703939c..2ec0fcd2 100644 --- a/Corale.Colore/Core/NativeWrapper.cs +++ b/Corale.Colore/Core/NativeWrapper.cs @@ -471,10 +471,17 @@ internal static void SetEffect(Guid guid) if (result) return; - if (result == Result.RzAccessDenied) - Log.Warn("Ambigous RzAccessDenied error thrown from call to native function SetEffect."); - else - throw new NativeCallException("SetEffect", result); + switch (result) + { + case Result.RzResourceDisabled: + case Result.RzAccessDenied: + Log.WarnFormat("Ambigous {0} error thrown from call to native function SetEffect.", result); + break; + + default + throw new NativeCallException("SetEffect", result); + break; + } } /// From e27b28c191e715e25801e78008953b8b7fcc051d Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Wed, 28 Oct 2015 13:53:18 +0100 Subject: [PATCH 2/4] Fix spelling error in warn message --- Corale.Colore/Core/NativeWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Core/NativeWrapper.cs b/Corale.Colore/Core/NativeWrapper.cs index 2ec0fcd2..951062a0 100644 --- a/Corale.Colore/Core/NativeWrapper.cs +++ b/Corale.Colore/Core/NativeWrapper.cs @@ -475,7 +475,7 @@ internal static void SetEffect(Guid guid) { case Result.RzResourceDisabled: case Result.RzAccessDenied: - Log.WarnFormat("Ambigous {0} error thrown from call to native function SetEffect.", result); + Log.WarnFormat("Ambiguous {0} error thrown from call to native function SetEffect.", result); break; default From e560494084bfb35de7e729f8d6ef8fc00f0782ac Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Wed, 28 Oct 2015 13:53:59 +0100 Subject: [PATCH 3/4] Fix missing colon after case --- Corale.Colore/Core/NativeWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Core/NativeWrapper.cs b/Corale.Colore/Core/NativeWrapper.cs index 951062a0..1af40267 100644 --- a/Corale.Colore/Core/NativeWrapper.cs +++ b/Corale.Colore/Core/NativeWrapper.cs @@ -478,7 +478,7 @@ internal static void SetEffect(Guid guid) Log.WarnFormat("Ambiguous {0} error thrown from call to native function SetEffect.", result); break; - default + default: throw new NativeCallException("SetEffect", result); break; } From d3b6302db4000b3c96b7999315ec39c8df2e294d Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Wed, 28 Oct 2015 13:59:14 +0100 Subject: [PATCH 4/4] Fix incorrect use of switch --- Corale.Colore/Core/NativeWrapper.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Corale.Colore/Core/NativeWrapper.cs b/Corale.Colore/Core/NativeWrapper.cs index 1af40267..19da5f30 100644 --- a/Corale.Colore/Core/NativeWrapper.cs +++ b/Corale.Colore/Core/NativeWrapper.cs @@ -471,17 +471,10 @@ internal static void SetEffect(Guid guid) if (result) return; - switch (result) - { - case Result.RzResourceDisabled: - case Result.RzAccessDenied: - Log.WarnFormat("Ambiguous {0} error thrown from call to native function SetEffect.", result); - break; - - default: - throw new NativeCallException("SetEffect", result); - break; - } + if (result == Result.RzResourceDisabled || result == Result.RzAccessDenied) + Log.WarnFormat("Ambiguous {0} error thrown from call to native function SetEffect.", result); + else + throw new NativeCallException("SetEffect", result); } ///