Exemplo n.º 1
0
        private void CRV_Start()
        {
            int authenticate = CVRSDK.CVR_Authenticate();

            if (authenticate == 1)
            {
                int readContent = CVRSDK.CVR_Read_Content(4);
                if (readContent == 1)
                {
                    byte[] number           = new byte[30];
                    byte[] name             = new byte[30];
                    byte[] people           = new byte[30];
                    byte[] validtermOfStart = new byte[30];
                    byte[] birthday         = new byte[30];
                    int    length           = 36;
                    CVRSDK.GetPeopleIDCode(ref number[0], ref length);
                    string SFZH = Encoding.Default.GetString(number).Replace("\0", "");
                    length = 30;
                    CVRSDK.GetPeopleName(ref name[0], ref length);
                    string Uname = Encoding.Default.GetString(name).Replace("\0", "");

                    CVRSDK.GetPeopleNation(ref people[0], ref length);
                    string PeopleNation = Encoding.Default.GetString(people).Replace("\0", "");

                    length = 16;
                    CVRSDK.GetStartDate(ref validtermOfStart[0], ref length);
                    string OfStart = Encoding.Default.GetString(validtermOfStart).Replace("\0", "");


                    length = 16;
                    CVRSDK.GetPeopleBirthday(ref birthday[0], ref length);
                    byte[] address = new byte[30];
                    length = 70;
                    CVRSDK.GetPeopleAddress(ref address[0], ref length);
                    string UAddress       = Encoding.Default.GetString(address).Replace("\0", "");
                    byte[] validtermOfEnd = new byte[30];
                    length = 16;
                    CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length);
                    byte[] signdate = new byte[30];
                    length = 30;
                    CVRSDK.GetDepartment(ref signdate[0], ref length);
                    byte[] sex = new byte[30];
                    length = 3;
                    CVRSDK.GetPeopleSex(ref sex[0], ref length);

                    byte[] samid = new byte[32];
                    CVRSDK.CVR_GetSAMID(ref samid[0]);

                    txtName.Text    = Uname;
                    txtIDCard.Text  = SFZH;
                    txtAddress.Text = UAddress;

                    var picbuff = System.IO.File.ReadAllBytes("zp.bmp");
                    picIDCardImage.Image = BytesToImage(picbuff);
                }
            }
        }
Exemplo n.º 2
0
        private bool CRV_Init()
        {
            int iPort;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                m_iUSBOpened = CVRSDK.CVR_InitComm(iPort);
                if (m_iUSBOpened == 1)
                {
                    break;
                }
            }

            return(m_iUSBOpened == 1);
        }