Exemple #1
0
        /// <summary>
        /// Reads integer property value for device at provided index.
        /// </summary>
        /// <param name="deviceIndex">Zero-based index of device. Should be strictly less than value returned by CorsairGetDeviceCount()</param>
        /// <param name="propertyId">Id of property to read from device</param>
        /// <param name="propertyValue">Integer property value read from device.</param>
        /// <returns>Boolean value. True if successful. Use CorsairGetLastError() to check the reason of failure.</returns>
        public static bool CorsairGetInt32PropertyValue(int deviceIndex, CorsairDevicePropertyId propertyId, ref int propertyValue)
        {
            var propertySize = Marshal.SizeOf <int>();
            var propertyPtr  = Marshal.AllocHGlobal(propertySize);

            Marshal.WriteInt32(propertyPtr, propertyValue);

            var result = CUESDKNative.CorsairGetInt32PropertyValue(deviceIndex, propertyId, propertyPtr);

            propertyValue = Marshal.ReadInt32(propertyPtr);

            Marshal.FreeHGlobal(propertyPtr);

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Reads boolean property value for device at provided index.
        /// </summary>
        /// <param name="deviceIndex">Zero-based index of device. Should be strictly less than value returned by CorsairGetDeviceCount()</param>
        /// <param name="propertyId">Id of property to read from device</param>
        /// <param name="propertyValue">Boolean property value read from device.</param>
        /// <returns>Boolean value. True if successful. Use CorsairGetLastError() to check the reason of failure.</returns>
        public static bool CorsairGetBoolPropertyValue(int deviceIndex, CorsairDevicePropertyId propertyId, ref bool propertyValue)
        {
            var propertySize = Marshal.SizeOf(typeof(int));
            var propertyPtr  = Marshal.AllocHGlobal(propertySize);

            Marshal.WriteInt32(propertyPtr, Convert.ToInt32(propertyValue));

            var result = CUESDKNative.CorsairGetBoolPropertyValue(deviceIndex, propertyId, propertyPtr);

            propertyValue = Convert.ToBoolean(Marshal.ReadInt32(propertyPtr));

            Marshal.FreeHGlobal(propertyPtr);

            return(result);
        }
Exemple #3
0
 public static extern bool CorsairGetInt32PropertyValue(int deviceIndex, CorsairDevicePropertyId propertyId, IntPtr propertyValue);