public static void RFS(uint hDongle)
        {
            uint ret = RockeyArmHelper.Dongle_RFS(hDongle);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }
        }
        public static void OpenRockey(ref uint hDongle, int index)
        {
            uint ret = RockeyArmHelper.Dongle_Open(ref hDongle, index);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }
        }
        public static void VerifyPIN(uint hDongle, byte[] sPin)
        {
            int  uiRemainCount = 0;
            uint ret           = RockeyArmHelper.Dongle_VerifyPIN(hDongle, DongleDef.FLAG_ADMINPIN, sPin, out uiRemainCount);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }
        }
        public static void GenUniqueKey(uint hDongle, byte[] seed)
        {
            byte[] cPid      = new byte[9];
            byte[] cAdminPin = new byte[17];
            var    ret       = RockeyArmHelper.Dongle_GenUniqueKey(hDongle, seed.Length, seed, cPid, cAdminPin);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }
        }
        public static IntPtr EnumRockeyArm(out ushort pCount)
        {
            IntPtr pt  = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DONGLE_INFO)) * 64);
            uint   ret = Dongle_Enum(pt, out pCount);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }

            return(pt);
        }
        public static byte[] ReadData(uint hDongle, int index, int length)
        {
            //写数据区,匿名和用户权限可写前4k(0~4095),开发商有所有8k的写权限
            byte[] datas = new byte[length];//数据区总大小8k
            uint   ret   = RockeyArmHelper.Dongle_ReadData(hDongle, 4096 + index, datas, length);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }

            return(datas);
        }
        public static void WriteData(uint hDongle, byte[] datas)
        {
            if (datas.Length > 4096)
            {
                throw new Exception("写入的内容字节长度不能超过4096!");
            }

            uint ret = RockeyArmHelper.Dongle_WriteData(hDongle, 4096, datas, datas.Length);

            if (ret != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret));
            }
        }
        public static byte[] ReadData(uint hDongle, int index)
        {
            //写数据区,匿名和用户权限可写前4k(0~4095),开发商有所有8k的写权限
            byte[] dataLengthBytes = new byte[4];//数据区总大小8k
            uint   ret1            = RockeyArmHelper.Dongle_ReadData(hDongle, 4096 + index, dataLengthBytes, 4);

            if (ret1 != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret1));
            }
            int dataLength = BitConverter.ToInt32(dataLengthBytes, 0);

            byte[] datas = new byte[dataLength];//数据区总大小8k
            uint   ret2  = RockeyArmHelper.Dongle_ReadData(hDongle, 4100 + index, datas, datas.Length);

            if (ret2 != 0)
            {
                throw new Exception(RockeyArmHelper.GetErrorInfo(ret2));
            }

            return(datas);
        }