Exemplo n.º 1
0
        // Token: 0x06000165 RID: 357 RVA: 0x00005058 File Offset: 0x00003258
        public override int isValidCard(bool silent)
        {
            if (!this.checkDevice(true))
            {
                return(-2);
            }
            this.pwd = base.getPassword(silent);
            if (this.pwd == null)
            {
                return(-1);
            }
            byte[] array = new byte[28];
            MHCardReader.E5557_Select_Page(0);
            if (MHCardReader.E5557_Read_Free(7, array) == 0)
            {
                return(1);
            }
            int num = MHCardReader.E5557_Direct_Read(0, 0, 1, this.pwd, array);

            if (array[0] == 0 && array[1] == 8 && array[2] == 128 && array[3] == 56 && num == 0)
            {
                return(2);
            }
            return(-1);
        }
Exemplo n.º 2
0
        // Token: 0x06000168 RID: 360 RVA: 0x000051E4 File Offset: 0x000033E4
        public override int clearAllData(bool beep, bool initialize)
        {
            if (!this.checkDevice(true))
            {
                return(-2);
            }
            this.pwd = base.getPassword(beep);
            if (this.pwd == null)
            {
                return(-1);
            }
            byte[] array = new byte[28];
            MHCardReader.E5557_Select_Page(0);
            int num = MHCardReader.E5557_Read_Free(7, array);

            if (num != 0)
            {
                num = MHCardReader.E5557_Direct_Read(0, 0, 1, this.pwd, array);
                if (array[0] != 0 || array[1] != 8 || array[2] != 128 || array[3] != 56 || num != 0)
                {
                    return(-1);
                }
                byte[] data = new byte[]
                {
                    0,
                    8,
                    128,
                    232
                };
                num = MHCardReader.E5557_Write_Pwd(0, 0, 0, this.pwd, data);
            }
            if (num == 0)
            {
                num = MHCardReader.E5557_Write_Free(0, 1, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 2, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 3, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 4, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 5, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 6, 0, new byte[4]) + MHCardReader.E5557_Write_Free(0, 7, 0, new byte[4]);
            }
            MHCardReader.E5557_Select_Page(0);
            if (MHCardReader.E5557_Read_Free(7, array) == 0)
            {
                if (beep)
                {
                    MHCardReader.Beep_Option();
                }
                MHCardReader.Led_Option();
                if (initialize)
                {
                    this.initializeCard();
                }
                return(0);
            }
            WMMessageBox.Show(this.owner, "清除数据失败,请手工清除!");
            return(-1);
        }
Exemplo n.º 3
0
        // Token: 0x06000163 RID: 355 RVA: 0x00004E9C File Offset: 0x0000309C
        public override uint[] readCard(bool beep)
        {
            if (!this.checkDevice(true))
            {
                return(null);
            }
            uint num = this.getCardID(false);

            this.pwd = base.getPassword(false, num);
            if (this.pwd == null)
            {
                return(null);
            }
            int num2 = this.isValidCard(true);

            if (num2 == 1)
            {
                WMMessageBox.Show(this.owner, "空卡!");
                return(null);
            }
            if (num2 == -2)
            {
                WMMessageBox.Show(this.owner, "无效卡!");
                return(null);
            }
            byte[] array  = new byte[28];
            byte[] array2 = new byte[4];
            for (short num3 = 0; num3 < 7; num3 += 1)
            {
                num2 = MHCardReader.E5557_Direct_Read(0, num3, 1, this.pwd, array2);
                if (num2 != 0)
                {
                    WMMessageBox.Show(this.owner, "读卡错误!");
                    return(null);
                }
                array[(int)(num3 * 4)]     = array2[0];
                array[(int)(num3 * 4 + 1)] = array2[1];
                array[(int)(num3 * 4 + 2)] = array2[2];
                array[(int)(num3 * 4 + 3)] = array2[3];
            }
            MHCardReader.Beep_Option();
            MHCardReader.Led_Option();
            uint[] array3 = base.byte2Uint32(array);
            uint[] array4 = new uint[]
            {
                array3[1],
                array3[2],
                array3[3],
                array3[4],
                array3[5],
                array3[6]
            };
            num = num * ICardReader.DATA_PASS1 + ICardReader.DATA_PASS2;
            for (int i = 0; i < array4.Length; i++)
            {
                array4[i] ^= num;
            }
            CRCUtil crcutil = new CRCUtil(array4);

            if (!crcutil.checkCRC())
            {
                WMMessageBox.Show(this.owner, "CRC检查错误!");
                return(null);
            }
            return(array4);
        }