Add sanity-check to CueSDK.EnableKeypressHandler() to ensure handlers are only enabled once. Resolves #69.

This commit is contained in:
hmmwhatsthisdo committed 2018-04-22 06:27:10 -07:00
1 parent 3b4649604f
commit f3f7f498af
1 file changed
+3
+3
View File
@@ -269,6 +269,9 @@ namespace CUE.NET
if (!IsInitialized)
throw new WrapperException("CueSDK isn't initialized.");
if (_onKeyPressedDelegate != null)
return;
_onKeyPressedDelegate = OnKeyPressed;
_CUESDK.CorsairRegisterKeypressCallback(Marshal.GetFunctionPointerForDelegate(_onKeyPressedDelegate), IntPtr.Zero);
}