Exemple #1
0
        private void btnSelectionVerify_Click(object sender, EventArgs e)
        {
            UFD_STATUS ufd_res;
            UFM_STATUS ufm_res;
            int        Serial;

            // Input finger data
            byte[] Template = new byte[MAX_TEMPLATE_SIZE];
            int    TemplateSize;
            //
            bool VerifySucceed;

            if (lvDatabaseList.SelectedIndices.Count == 0)
            {
                tbxMessage.AppendText("Select data\r\n");
                return;
            }
            else
            {
                Serial = Convert.ToInt32(lvDatabaseList.SelectedItems[0].SubItems[DATABASE_COL_SERIAL].Text);
            }

            ufd_res = m_Database.GetDataBySerial(Serial,
                                                 out m_UserID, out m_FingerIndex, m_Template1, out m_Template1Size, m_Template2, out m_Template2Size, out m_Memo);
            if (ufd_res != UFD_STATUS.OK)
            {
                UFDatabase.GetErrorString(ufd_res, out m_strError);
                tbxMessage.AppendText("UFDatabase UpdateDataBySerial: " + m_strError + "\r\n");
                return;
            }

            if (!ExtractTemplate(Template, out TemplateSize))
            {
                return;
            }

            DrawCapturedImage(m_Scanner);

            ufm_res = m_Matcher.Verify(Template, TemplateSize, m_Template1, m_Template1Size, out VerifySucceed);
            if (ufm_res != UFM_STATUS.OK)
            {
                UFMatcher.GetErrorString(ufm_res, out m_strError);
                tbxMessage.AppendText("UFMatcher Verify: " + m_strError + "\r\n");
                return;
            }

            if (VerifySucceed)
            {
                tbxMessage.AppendText("Verification succeed (Serial = " + Serial + ")\r\n");
            }
            else
            {
                tbxMessage.AppendText("Verification failed\r\n");
            }
        }
        private void btnVerify_Click(object sender, EventArgs e)
        {
            UFScanner  Scanner;
            UFS_STATUS ufs_res;
            UFM_STATUS ufm_res;

            byte[] Template = new byte[MAX_TEMPLATE_SIZE];
            int    TemplateSize;
            int    EnrollQuality;
            bool   VerifySucceed;
            int    SelectID;

            SelectID = cbID.SelectedIndex;
            if (SelectID == -1)
            {
                tbxMessage.AppendText("Select Enroll ID\r\n");
                return;
            }

            if (!GetGetCurrentScanner(out Scanner))
            {
                return;
            }
            Scanner.ClearCaptureImageBuffer();

            tbxMessage.AppendText("Place Finger\r\n");

            ufs_res = Scanner.CaptureSingleImage();
            if (ufs_res != UFS_STATUS.OK)
            {
                UFScanner.GetErrorString(ufs_res, out m_strError);
                tbxMessage.AppendText("UFScanner CaptureSingleImage: " + m_strError + "\r\n");
                return;
            }

            switch (this.cbScanTemplateType.SelectedIndex)
            {
            case 0:
                Scanner.nTemplateType = 2001;
                break;

            case 1:
                Scanner.nTemplateType = 2002;
                break;

            case 2:
                Scanner.nTemplateType = 2003;
                break;
            }

            ufs_res = Scanner.Extract(Template, out TemplateSize, out EnrollQuality);
            if (ufs_res == UFS_STATUS.OK)
            {
                DrawCapturedImage(Scanner);
            }
            else
            {
                UFScanner.GetErrorString(ufs_res, out m_strError);
                tbxMessage.AppendText("UFScanner Extract: " + m_strError + "\r\n");
                return;
            }

            switch (this.cbMatchTemplateType.SelectedIndex)
            {
            case 0:
                m_Matcher.nTemplateType = 2001;
                break;

            case 1:
                m_Matcher.nTemplateType = 2002;
                break;

            case 2:
                m_Matcher.nTemplateType = 2003;
                break;
            }

            ufm_res = m_Matcher.Verify(Template, TemplateSize, m_template[SelectID], m_template_size[SelectID], out VerifySucceed);
            if (ufm_res != UFM_STATUS.OK)
            {
                UFMatcher.GetErrorString(ufm_res, out m_strError);
                tbxMessage.AppendText("UFMatcher Verify: " + m_strError + "\r\n");
                return;
            }

            if (VerifySucceed)
            {
                tbxMessage.AppendText("Verification succeed (No." + (SelectID + 1) + ")\r\n");
            }
            else
            {
                tbxMessage.AppendText("Verification failed\r\n");
            }
        }
        private void btnVerify_Click(object sender, EventArgs e)
        {
            UFScanner  Scanner;
            UFS_STATUS ufs_res;
            UFM_STATUS ufm_res;

            byte[] Template = new byte[MAX_TEMPLATE_SIZE];
            int    TemplateSize;
            int    EnrollQuality;
            bool   VerifySucceed;
            int    Serial;

            if (lvFingerDataList.SelectedIndices.Count == 0)
            {
                tbxMessage.AppendText("Select data\r\n");
                return;
            }
            else
            {
                Serial = Convert.ToInt32(lvFingerDataList.SelectedItems[0].SubItems[FINGERDATA_COL_SERIAL].Text);
            }

            if (!GetGetCurrentScanner(out Scanner))
            {
                return;
            }
            tbxMessage.AppendText("Verify with serial: " + Serial + "\r\n");

            Scanner.ClearCaptureImageBuffer();

            tbxMessage.AppendText("Place Finger\r\n");

            ufs_res = Scanner.CaptureSingleImage();
            if (ufs_res != UFS_STATUS.OK)
            {
                UFScanner.GetErrorString(ufs_res, out m_strError);
                tbxMessage.AppendText("UFScanner CaptureSingleImage: " + m_strError + "\r\n");
                return;
            }

            switch (this.cbScanTemplateType.SelectedIndex)
            {
            case 0:
                Scanner.nTemplateType = 2001;
                break;

            case 1:
                Scanner.nTemplateType = 2002;
                break;

            case 2:
                Scanner.nTemplateType = 2003;
                break;
            }

            ufs_res = Scanner.ExtractEx(MAX_TEMPLATE_SIZE, Template, out TemplateSize, out EnrollQuality);
            if (ufs_res == UFS_STATUS.OK)
            {
                DrawCapturedImage(Scanner);
            }
            else
            {
                UFScanner.GetErrorString(ufs_res, out m_strError);
                tbxMessage.AppendText("UFScanner ExtractEx: " + m_strError + "\r\n");
                return;
            }

            switch (this.cbScanTemplateType.SelectedIndex)
            {
            case 0:
                m_Matcher.nTemplateType = 2001;
                break;

            case 1:
                m_Matcher.nTemplateType = 2002;
                break;

            case 2:
                m_Matcher.nTemplateType = 2003;
                break;
            }

            ufm_res = m_Matcher.Verify(Template, TemplateSize, m_template1[Serial], m_template_size1[Serial], out VerifySucceed);
            if (ufm_res != UFM_STATUS.OK)
            {
                UFMatcher.GetErrorString(ufm_res, out m_strError);
                tbxMessage.AppendText("UFMatcher Verify: " + m_strError + "\r\n");
                return;
            }

            if (VerifySucceed)
            {
                tbxMessage.AppendText("Verification succeed (Serial." + Serial + ") (ID." + m_UserID[Serial] + ")\r\n");
            }
            else
            {
                if (m_template_size2[Serial] != 0)
                {
                    ufm_res = m_Matcher.Verify(Template, TemplateSize, m_template2[Serial], m_template_size2[Serial], out VerifySucceed);
                    if (ufm_res != UFM_STATUS.OK)
                    {
                        UFMatcher.GetErrorString(ufm_res, out m_strError);
                        tbxMessage.AppendText("UFMatcher Verify: " + m_strError + "\r\n");
                        return;
                    }

                    if (VerifySucceed)
                    {
                        tbxMessage.AppendText("Verification succeed (Serial." + Serial + ") (ID." + m_UserID[Serial] + ")\r\n");
                    }
                    else
                    {
                        tbxMessage.AppendText("Verification failed\r\n");
                    }
                }
                else
                {
                    tbxMessage.AppendText("Verification failed\r\n");
                }
            }
        }