Пример #1
0
        /// <summary>
        /// This function is used to read the value of MHL feature functions of BINARY type.
        /// </summary>
        /// <param name="name">Name of the requested feature</param>
        /// <exception cref="System.ArgumentException">If exceptions are enabled, on failure exception is thrown with valid error message.</exception>
        /// <returns>Binary array value for requested feature. Null on failure, if exceptions are not enabled.</returns>
        /// <remarks>On failure, use GetLastError() ot GetLastErrorMessage() for more information.</remarks>
        public byte[] GetBin(string name)
        {
            int  retLen;
            uint len = MHLSRV._MHL_GetBinLength(loadedDrvHandle, name);

            if (this.GetLastError() != 0)
            {
                if (throwsException)
                {
                    throw new System.ArgumentException("Get BIN Failed " + name, "Error " + this.GetLastError().ToString() + "; " + this.GetLastErrorMessage());
                }
                return(null);
            }

            byte[] buf = new byte[len];

            retLen = (int)MHLSRV._MHL_GetBin(loadedDrvHandle, name, buf, (int)len);
            if (this.GetLastError() != 0)
            {
                if (throwsException)
                {
                    throw new System.ArgumentException("Get BIN Failed " + name, "Error " + this.GetLastError().ToString() + "; " + this.GetLastErrorMessage());
                }
                return(null);
            }

            buf = (byte[])ResizeArray(buf, retLen);

            return(buf);
        }
Пример #2
0
        /// <summary>PROVIDED ONLY FOR BACKWARD COMPATIBILITY. Please use new HotkeyHelper class.</summary>
        /// <remarks>PROVIDED ONLY FOR BACKWARD COMPATIBILITY. Please use new MHLDriver class.</remarks>
        public byte[] GetBin(int handle, String name)
        {
            int  retLen;
            uint len = MHLSRV._MHL_GetBinLength(handle, name);

            byte[] buf = new byte[len];

            retLen = (int)MHLSRV._MHL_GetBin(handle, name, buf, (int)len);
            buf    = (byte[])ResizeArray(buf, retLen);

            return(buf);
        }