Ejemplo n.º 1
0
        /// <summary>
        /// Handles the error.
        /// </summary>
        /// <exception cref="Exception"></exception>
        private bool HandleError()
        {
            CorsairError error = CorsairLightingSDK.GetLastError();

            if (error == CorsairError.ServerNotFound)
            {
                return(false);
            }
            else if (error != CorsairError.Success)
            {
                throw new Exception(error + "");
            }
            return(true);
        }
        /// <summary>
        /// Performs a health check on the provider
        /// </summary>
        public void PerformHealthCheck()
        {
            var cueRunning = Process.GetProcessesByName("iCUE").Length != 0;

            while (!cueRunning)
            {
                Thread.Sleep(1000);
                cueRunning = Process.GetProcessesByName("iCUE").Length != 0;
            }

            CorsairLightingSDK.GetDeviceCount();
            var error = CorsairLightingSDK.GetLastError();

            while (error == CorsairError.ServerNotFound || error == CorsairError.ProtocolHandshakeMissing)
            {
                CorsairLightingSDK.PerformProtocolHandshake();
                Thread.Sleep(1000);
                error = CorsairLightingSDK.GetLastError();
            }
        }
Ejemplo n.º 3
0
 public CorsairError CorsairGetLastError()
 {
     return(CorsairLightingSDK.GetLastError());
 }