Пример #1
0
        // Token: 0x0600019F RID: 415 RVA: 0x00006040 File Offset: 0x00004240
        public override uint getCardID(bool silent)
        {
            if (!this.checkDevice(true))
            {
                return(0U);
            }
            byte[] array  = new byte[8];
            byte[] array2 = new byte[4];
            int    num    = (int)QingtongReader.qt_T5557_RegularRead(this.device, 17, 2, array);

            if (num != 0)
            {
                if (!silent)
                {
                    WMMessageBox.Show(this.owner, "无法读取卡片密码!");
                }
                return(0U);
            }
            array2[0] = array[4];
            array2[1] = array[5];
            array2[2] = array[6];
            array2[3] = array[7];
            if (array2 == null)
            {
                return(0U);
            }
            uint[] array3 = base.byte2Uint32(array2);
            if (array3.Length <= 0)
            {
                return(0U);
            }
            return(array3[0]);
        }
Пример #2
0
        // Token: 0x0600019E RID: 414 RVA: 0x00005FA8 File Offset: 0x000041A8
        public override int initializeCard()
        {
            if (!this.checkDevice(true))
            {
                return(-1);
            }
            this.pwd = base.getPassword();
            if (this.pwd == null)
            {
                return(-2);
            }
            byte[] revbuffer = new byte[28];
            int    num       = (int)QingtongReader.qt_T5557_readm(this.device, 0, 1, revbuffer);

            if (num != 0)
            {
                return(1);
            }
            string s = "00000000";

            byte[] array = new byte[4];
            QingtongReader.asc_hex(Encoding.Default.GetBytes(s), array, 4U);
            QingtongReader.qt_T5557_writem(this.device, 7, 1, this.pwd, 0);
            return((int)QingtongReader.qt_T5557_Config(this.device, 49, array, 32, 0, 49, 49, 48));
        }
Пример #3
0
        // Token: 0x0600019A RID: 410 RVA: 0x00005D28 File Offset: 0x00003F28
        public override int writeCard(uint[] datas)
        {
            if (!this.checkDevice(true))
            {
                return(-1);
            }
            uint num = this.getCardID(false);

            this.pwd = base.getPassword(false, num);
            if (this.pwd == null)
            {
                return(-2);
            }
            num = num * ICardReader.DATA_PASS1 + ICardReader.DATA_PASS2;
            for (int i = 0; i < datas.Length; i++)
            {
                datas[i] ^= num;
            }
            byte[] sendbuffer = base.uInt32tobyte(datas);
            if (QingtongReader.qt_T5557_pwdwritem(this.device, 1, 6, this.pwd, sendbuffer, 0) == 0 && (int)this.device > 0)
            {
                QingtongReader.dv_beep(this.device, 10);
                return(0);
            }
            return(-1);
        }
Пример #4
0
 // Token: 0x0600019C RID: 412 RVA: 0x00005F08 File Offset: 0x00004108
 public override bool isEmptyCard()
 {
     if (!this.checkDevice(true))
     {
         return(false);
     }
     byte[] revbuffer = new byte[28];
     return(QingtongReader.qt_T5557_readm(this.device, 0, 1, revbuffer) == 0);
 }
Пример #5
0
        // Token: 0x0600019B RID: 411 RVA: 0x00005DC8 File Offset: 0x00003FC8
        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);
            }
            byte[] array = new byte[28];
            if (QingtongReader.qt_T5557_readm(this.device, 0, 1, array) == 0)
            {
                WMMessageBox.Show(this.owner, "该卡为空白卡,请先初始化!");
                return(null);
            }
            int num2 = (int)QingtongReader.qt_T5557_pwdreadm(this.device, 0, 7, this.pwd, array);

            if (num2 != 0)
            {
                WMMessageBox.Show(this.owner, "读卡错误!");
                return(null);
            }
            if ((int)this.device > 0 && beep)
            {
                QingtongReader.dv_beep(this.device, 10);
            }
            uint[] array2 = base.byte2Uint32(array);
            uint[] array3 = new uint[]
            {
                array2[1],
                array2[2],
                array2[3],
                array2[4],
                array2[5],
                array2[6]
            };
            num = num * ICardReader.DATA_PASS1 + ICardReader.DATA_PASS2;
            for (int i = 0; i < array3.Length; i++)
            {
                array3[i] ^= num;
            }
            CRCUtil crcutil = new CRCUtil(array3);

            if (!crcutil.checkCRC())
            {
                WMMessageBox.Show(this.owner, "CRC检查错误!");
                return(null);
            }
            return(array3);
        }
Пример #6
0
 // Token: 0x06000199 RID: 409 RVA: 0x00005CD4 File Offset: 0x00003ED4
 public override bool initReader(IWin32Window window)
 {
     this.owner  = window;
     this.device = QingtongReader.ic_init(100, 100U);
     if ((int)this.device > 0)
     {
         QingtongReader.dv_beep(this.device, 10);
         byte rateValue = 32;
         QingtongReader.qt_T5557_set_rate(this.device, rateValue);
         return(true);
     }
     return(false);
 }
Пример #7
0
 // Token: 0x0600019D RID: 413 RVA: 0x00005F40 File Offset: 0x00004140
 public override int isValidCard(bool silent)
 {
     if (!this.checkDevice(true))
     {
         return(-2);
     }
     this.pwd = base.getPassword(silent);
     if (this.pwd == null)
     {
         return(-1);
     }
     byte[] revbuffer = new byte[28];
     if (QingtongReader.qt_T5557_readm(this.device, 0, 1, revbuffer) == 0)
     {
         return(1);
     }
     if (QingtongReader.qt_T5557_pwdreadm(this.device, 1, 1, this.pwd, revbuffer) == 0)
     {
         return(2);
     }
     return(-1);
 }
Пример #8
0
        // Token: 0x060001A1 RID: 417 RVA: 0x00006250 File Offset: 0x00004450
        public override short isReaderPlugs()
        {
            short num = -1;

            return(QingtongReader.get_status(this.device, ref num));
        }
Пример #9
0
        // Token: 0x060001A0 RID: 416 RVA: 0x000060C0 File Offset: 0x000042C0
        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];
            int    num   = (int)QingtongReader.qt_T5557_readm(this.device, 0, 7, array);

            if (num != 0)
            {
                num = (int)QingtongReader.qt_T5557_pwdreadm(this.device, 0, 7, this.pwd, array);
                if (num == 0)
                {
                    num = (int)QingtongReader.qt_T5557_Config(this.device, 1, this.pwd, 32, 0, 0, 7, 0);
                }
            }
            if (num == 0)
            {
                num = (int)(QingtongReader.qt_T5557_writem(this.device, 1, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 2, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 3, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 4, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 5, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 6, 1, new byte[4], 0) + QingtongReader.qt_T5557_writem(this.device, 7, 1, new byte[4], 0));
            }
            num = (int)QingtongReader.qt_T5557_read(this.device, 0, array);
            if (num == 0)
            {
                for (byte b = 1; b < 7; b += 1)
                {
                    byte[] array2 = new byte[4];
                    num = (int)QingtongReader.qt_T5557_read(this.device, b, array2);
                    if (num != 0)
                    {
                        break;
                    }
                    if (base.byte2Uint32(array2)[0] != 0U)
                    {
                        num = -1;
                        break;
                    }
                }
                if (num == 0)
                {
                    if (beep)
                    {
                        QingtongReader.dv_beep(this.device, 10);
                    }
                    if (initialize)
                    {
                        this.initializeCard();
                    }
                }
                else
                {
                    WMMessageBox.Show(this.owner, "清除数据失败,请手工清除!");
                }
                return(num);
            }
            return(num);
        }