Пример #1
0
 private void btnapply_Click(object sender, EventArgs e)
 {
     if ((tbusername.TextLength <= 0 || tbusername.Text == null) || (tbpassword.TextLength <= 0 || tbpassword.Text == null))
     {
         MessageBox.Show("Missing Credentials.", "Misssing Credentials.", MessageBoxButtons.OK);
         btnapply.Enabled = false;
     }
     else
     {
         string dsn = cbdsn.SelectedItem.ToString();
         if (dsn == null || dsn.Length <= 0)
         {
             MessageBox.Show("Please double check data source name.", "Data Source Missing.", MessageBoxButtons.OK);
             btnapply.Enabled = false;
         }
         else
         {
             if (Dejitaru.TestDB(dsn, tbusername.Text, tbpassword.Text))
             {
                 MessageBox.Show("Connection saved.", "Data Source.", MessageBoxButtons.OK);
                 Dejitaru.CreateODBCkey(dsn);
                 Dejitaru.SControl(tbpassword.Text, dsn);
                 btnapply.Enabled = false;
             }
             else
             {
                 MessageBox.Show("DB Connection failed.", "DB Connection", MessageBoxButtons.OK);
                 btnapply.Enabled = false;
             }
         }
     }
 }
Пример #2
0
        private void Afterload()
        {
            string[] keys = DejitaruInit.GetncheckDSNKey();
            if (keys.Length > 0)
            {
                lblloadstatus.Text = "Data source found.";

                if (Dejitaru.TestDB(keys[0], keys[1], keys[2]))
                {
                    DejitaruInit.IsDBReady = true;
                    this.Close();
                }
                else
                {
                    DejitaruInit.IsDBReady = false;
                    this.Close();
                }
            }
            else
            {
                lblloadstatus.Text     = "No data source found.";
                DejitaruInit.IsDBReady = false;
                this.Close();
            }
        }
Пример #3
0
        private void btnsettings_Click(object sender, EventArgs e)
        {
            string[] datasource = Dejitaru.getDSNLists();
            string[] sysinfo    = new string[5];
            sysinfo = Dejitaru.SystemInfo();


            lblmachname_container.Text  = sysinfo[0];
            lblosv_container.Text       = sysinfo[1];
            lblproccount_container.Text = sysinfo[2];
            lblclrv_container.Text      = sysinfo[3];
            if (sysinfo[4] == "True")
            {
                lblsystype_container.Text = "64-Bit Operating System";
            }
            else
            {
                lblsystype_container.Text = "32-Bit Operating System";
            }


            cbdsn.Items.Clear();
            foreach (string dsn in datasource)
            {
                cbdsn.Items.Add(dsn);
            }
        }
Пример #4
0
 private void btntestconn_Click(object sender, EventArgs e)
 {
     if ((tbusername.TextLength <= 0 || tbusername.Text == null) || (tbpassword.TextLength <= 0 || tbpassword.Text == null))
     {
         MessageBox.Show("Can't inititate test connection. Missing Credentials.", "Misssing Credentials.", MessageBoxButtons.OK);
     }
     else
     {
         string dsn = cbdsn.SelectedItem.ToString();
         if (dsn == null || dsn.Length <= 0)
         {
             MessageBox.Show("Can't inititate test connection. Please double check data source name.", "Data Source Missing.", MessageBoxButtons.OK);
         }
         else
         {
             if (Dejitaru.TestDB(dsn, tbusername.Text, tbpassword.Text))
             {
                 MessageBox.Show("Test connection successful.", "Test Connection", MessageBoxButtons.OK);
                 btnapply.Enabled = true;
             }
             else
             {
                 MessageBox.Show("Test connection failed.", "Test Connection", MessageBoxButtons.OK);
             }
         }
     }
 }
Пример #5
0
 public void OnReaderConnect(object Capture, string ReaderSerialNumber)
 {
     Dejitaru.SetControlProperty(this, lstatus, "Text", "Connected");
     Dejitaru.SetControlProperty(this, lstatus, "ForeColor", Color.LightGreen);
     Dejitaru.SetControlProperty(this, btnverify, "Visible", true);
     Dejitaru.SetControlProperty(this, btnenroll, "Visible", true);
     SetControl();
 }
Пример #6
0
 public void OnReaderDisconnect(object Capture, string ReaderSerialNumber)
 {
     Dejitaru.SetControlProperty(this, lstatus, "Text", "Disconnected");
     Dejitaru.SetControlProperty(this, lstatus, "ForeColor", Color.Red);
     Dejitaru.SetControlProperty(this, btnverify, "Visible", false);
     Dejitaru.SetControlProperty(this, btnenroll, "Visible", false);
     Dejitaru.SetControlProperty(this, prbenroll, "Visible", false);
     Dejitaru.SetControlProperty(this, lblnote, "Visible", false);
     Dejitaru.SetControlProperty(this, lblnote, "Text", "");
 }
Пример #7
0
        private void cbdsn_SelectedIndexChanged(object sender, EventArgs e)
        {
            string[] values = new string[4];
            values = Dejitaru.getODBCValue(cbdsn.SelectedItem.ToString());

            if (values != null || values.Length <= 0)
            {
                tbusername.Text = values[2];
                tbpassword.Text = "";

                Dejitaru.lastuser = values[2];
            }
        }
Пример #8
0
 private void Stop()
 {
     if (Capturer != null)
     {
         try
         {
             Capturer.StopCapture();
         }
         catch
         {
             Dejitaru.SetControlProperty(this, lstatus, "Text", "Can't stop capture.");
         }
     }
 }
Пример #9
0
 private void Start()
 {
     if (Capturer != null)
     {
         try
         {
             Capturer.StartCapture();
             Dejitaru.SetControlProperty(this, lstatus, "Text", "Place finger on the scanner to start.");
         }
         catch
         {
             Dejitaru.SetControlProperty(this, lstatus, "Text", "Can't start capture.");
         }
     }
 }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string[] keys = DejitaruInit.GetncheckDSNKey();



            if (keys != null)
            {
                foreach (string key in keys)
                {
                    MessageBox.Show(key);
                }

                MessageBox.Show(Dejitaru.TestDB(keys[0], keys[1], keys[2]).ToString());
            }
        }
Пример #11
0
        public void OnComplete(object Capture, string ReaderSerialNumber, Sample sample)
        {
            Dejitaru.ShowFP(sample, picfinger, this);

            if (gpurpose == DPFP.Processing.DataPurpose.Enrollment)
            {
                Process(sample, gpurpose);
            }
            else if (gpurpose == DPFP.Processing.DataPurpose.Verification)
            {
                // ImageCC();
                // usample = sample;
            }
            else
            {
                //SetText("Please specify task.", labelResult);
                //Enroller.Clear();
            }
        }
Пример #12
0
 private void Init()
 {
     Enroller = new DPFP.Processing.Enrollment();
     try
     {
         Capturer = new DPFP.Capture.Capture();
         if (null != Capturer)
         {
             Capturer.EventHandler = this;
         }
         else
         {
             Dejitaru.SetControlProperty(this, lstatus, "Text", "Can't initiate capture operation.");
         }
     }
     catch
     {
         Dejitaru.SetControlProperty(this, lstatus, "Text", "Can't initiate capture operation.");
     }
 }
Пример #13
0
        //Check registry if db key exists
        public static string[] GetncheckDSNKey()
        {
            RegistryKey dejitarudsnkey = Registry.LocalMachine.OpenSubKey(@"Software\\Dejitaruyubi\\ODBC Strings\\");
            RegistryKey dsnkey;

            dsnkey = null;


            string[] keys = new string[] { };
            string[] dsn  = new string[3];
            if (dejitarudsnkey != null)
            {
                keys = dejitarudsnkey.GetSubKeyNames();

                if (keys != null && keys.Length > 0)
                {
                    dsnkey = Registry.LocalMachine.OpenSubKey(@"Software\\Dejitaruyubi\\ODBC Strings\\" + keys[0]);
                    if (dsnkey != null)
                    {
                        if (dsnkey.GetValue("DSN").ToString() != null & dsnkey.GetValue("LastUser").ToString() != null && dsnkey.GetValue("hControl") != null)
                        {
                            DSN = dsnkey.GetValue("DSN").ToString();
                            UID = dsnkey.GetValue("LastUser").ToString();
                            PWD = Dejitaru.DecryptStringFromBytes_Aes((byte[])dsnkey.GetValue("hControl", RegistryValueKind.Binary), Dejitaru.key, Dejitaru.iv);

                            dsn[0] = DSN;
                            dsn[1] = UID;
                            dsn[2] = PWD;
                        }
                    }
                }
            }
            else
            {
                return(null);
            }

            return(dsn);
        }
Пример #14
0
 private void SetControl()
 {
     if (gpurpose == DPFP.Processing.DataPurpose.Enrollment)
     {
         Dejitaru.SetControlProperty(this, prbenroll, "Visible", true);
         Dejitaru.SetControlProperty(this, lblnote, "Location", new Point(53, 470));
         Dejitaru.SetControlProperty(this, lblnote, "Visible", true);
         Dejitaru.SetControlProperty(this, lblnote, "Text", "Note: Requires four fingerprint samples for Enrollment.");
     }
     else if (gpurpose == DPFP.Processing.DataPurpose.Verification)
     {
         Dejitaru.SetControlProperty(this, prbenroll, "Visible", false);
         Dejitaru.SetControlProperty(this, lblnote, "Location", new Point(53, 440));
         Dejitaru.SetControlProperty(this, lblnote, "Visible", true);
         Dejitaru.SetControlProperty(this, lblnote, "Text", "Place your index finger on the scanner to verify your identity.");
     }
     else
     {
         Dejitaru.SetControlProperty(this, prbenroll, "Visible", false);
         Dejitaru.SetControlProperty(this, lblnote, "Visible", false);
         Dejitaru.SetControlProperty(this, lblnote, "Text", "");
     }
 }
Пример #15
0
        private void Process(DPFP.Sample sample, DPFP.Processing.DataPurpose purpose)
        {
            if (purpose == DPFP.Processing.DataPurpose.Enrollment)
            {
                DPFP.FeatureSet features = ExtractFeatures(sample, purpose);
                if (features != null)
                {
                    try
                    {
                        Enroller.AddFeatures(features);
                    }
                    finally
                    {
                        switch (Enroller.TemplateStatus)
                        {
                        case DPFP.Processing.Enrollment.Status.Ready:

                            byte[] fpsample = new byte[0];
                            Enroller.Template.Serialize(ref fpsample);
                            Dejitaru.progress += 1;
                            Dejitaru.SetControlProperty(this, prbenroll, "Value", Dejitaru.progress);
                            Dejitaru.progress = 0;
                            Enroller.Clear();
                            gpurpose = DPFP.Processing.DataPurpose.Unknown;
                            Dejitaru.SerializetoDB(fpsample, lstatus, this);
                            Stop();
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:

                            Dejitaru.SetControlProperty(this, lstatus, "Text", "Enrollment failed.");

                            Start();
                            break;

                        case DPFP.Processing.Enrollment.Status.Insufficient:

                            Dejitaru.progress += 1;
                            Dejitaru.SetControlProperty(this, prbenroll, "Value", Dejitaru.progress);

                            Dejitaru.SetControlProperty(this, lstatus, "Text", "Needing more samples for enrollment.Please scan more.");

                            break;

                        case DPFP.Processing.Enrollment.Status.Unknown:
                            Dejitaru.SetControlProperty(this, lstatus, "Text", "Unknown");

                            break;
                        }
                    }
                }
            }
            if (purpose == DPFP.Processing.DataPurpose.Verification)
            {
                DPFP.FeatureSet features = ExtractFeatures(sample, purpose);
                string          rhandler = "";
                if (features != null)
                {
                    //DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                    //Verifier.Verify(features, template, ref result);

                    string[] results = VerifyDB(features);

                    if (results[0].Equals("true"))
                    {
                        rhandler = "Match found. \n\n";
                        for (int i = 1; i < results.Length; i++)
                        {
                            rhandler = rhandler + " " + results[i] + "\n";
                        }
                    }
                    else
                    {
                        rhandler = "No match found.";
                    }
                    Dejitaru.SetControlProperty(this, lstatus, "Text", rhandler);
                }
            }
        }