コード例 #1
0
        protected override void OnLoad(EventArgs e)
        {
            _identity = null;
            comboUnitId.Items.Clear();
            comboUnitId.ResetText();

            var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint);

            Log(string.Format("Found {0} units", units.Length));
            if (units.Length == 0)
            {
                return;
            }
            for (int i = 0; i < units.Length; i++)
            {
                Log(string.Format("- Unit id: {0}", units[i].UnitId));
                comboUnitId.Items.Add(units[i].UnitId);

                string strDeviceInstanceId = units[i].DeviceInstanceId;
                Log(string.Format("     Unit id: {0}", strDeviceInstanceId));
                string strFirmwareVersion = getFirmwareVersion(strDeviceInstanceId);
                if (strFirmwareVersion.Equals(""))
                {
                    Log(string.Format("     Firmware: {0}", units[i].FirmwareVersion.ToString()));
                }
                else
                {
                    Log(string.Format("     Firmware: {0}", strFirmwareVersion));
                }

                int lastInvSlash = units[i].DeviceInstanceId.LastIndexOf("\\");
                Log(string.Format("     Key code: {0}",
                                  strDeviceInstanceId.Substring(lastInvSlash + 1, strDeviceInstanceId.Length - lastInvSlash - 1)));
            }

            _unitId = units[0].UnitId;
            setComboxSelectedIndex(comboUnitId, 0); // use 1st one by default.
            Log(string.Format("Using unit id: {0}", _unitId));

            _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.System, WinBioSessionFlag.Default, null, 0);
            Log("Session opened: " + _session.Value);

            comboBoxFp.Items.Clear();
            comboBoxFp.ResetText();
            String[] myArr = new String[] {
                "Unknown",//0
                "RhThumb",
                "RhIndexFinger",
                "RhMiddleFinger",
                "RhRingFinger",
                "RhLittleFinger",
                "LhThumb",
                "LhIndexFinger",
                "LhMiddleFinger",
                "LhRingFinger",
                "LhLittleFinger"
            };                      //10
            comboBoxFp.Items.AddRange(myArr);
            setComboxSelectedIndex(comboBoxFp, 1);
        }
コード例 #2
0
        private void OpenBiometricSession()
        {
            var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint);

            _unitId  = units.FirstOrDefault().UnitId;
            _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { _unitId }, Shared.DatabaseId);
            WriteLog("Session opened: " + _session.Value);
        }
コード例 #3
0
        protected override void OnLoad(EventArgs e)
        {
            var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint);

            Log(string.Format("Found {0} units", units.Length));
            if (units.Length == 0)
            {
                return;
            }
            var unit = units[0];

            _unitId = unit.UnitId;
            Log(string.Format("Using unit id: {0}", _unitId));
            Log(string.Format("Device instance id: {0}", unit.DeviceInstanceId));
            Log(string.Format("Using database: {0}", DatabaseId));
            _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { _unitId }, DatabaseId);
            //_session = WinBio.OpenSession(WinBioBiometricType.Fingerprint);
            Log("Session opened: " + _session.Value);
        }
コード例 #4
0
 public void OpenBiometricSession()
 {
     try
     {
         Debug("Opening session...");
         _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.System, WinBioSessionFlag.Raw, null, WinBioDatabaseId.Default);
         if (_session.IsValid)
         {
             Debug("Session opened!");
             Debug(_session.Value.ToString());
             UpdateStatus(Statuses.NoFocus);
         }
         else
         {
             throw new Exception("Invalid session handle");
         }
     }
     catch (Exception e)
     {
         Log("Error trying to open biometric session");
         Debug(e.Message);
         UpdateStatus(Statuses.NoSession);
     }
 }
コード例 #5
0
ファイル: WinBioSession.cs プロジェクト: kszczek/WinBioNET
 public WinBioSession()
 {
     _handle = WinBio.OpenSession(WinBioBiometricType.Fingerprint);
     SetID(_handle.Value);
     Console.WriteLine("WinBioSession opened: " + _handle.Value);
 }
コード例 #6
0
 private void OpenBiometricSession()
 {
     _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { _unitId }, DatabaseId);
     Log("Session opened: " + _session.Value);
 }
コード例 #7
0
ファイル: WinBioForm.cs プロジェクト: kszczek/WinBioNET
 private void OpenBiometricSession()
 {
     _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.System, WinBioSessionFlag.Raw, null, WinBioDatabaseId.Default);
     Log("Session opened: " + _session.Value);
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: mrpullen/WinBioNET
 public static void Main()
 {
     try
     {
         var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint);
         Console.WriteLine("Found {0} units", units.Length);
         if (units.Length == 0)
         {
             return;
         }
         var unit   = units[0];
         var unitId = unit.UnitId;
         Console.WriteLine("Using unit id: {0}", unitId);
         Console.WriteLine("Device instance id: {0}", unit.DeviceInstanceId);
         var databases = WinBio.EnumDatabases(WinBioBiometricType.Fingerprint);
         Console.WriteLine("Found {0} databases", databases.Length);
         for (var i = 0; i < databases.Length; i++)
         {
             Console.WriteLine("DatabaseId {0}: {1}", i, databases[i].DatabaseId);
         }
         if (WinBioConfiguration.DatabaseExists(DatabaseId))
         {
             Console.WriteLine("Removing database: {0}", DatabaseId);
             WinBioConfiguration.RemoveDatabase(DatabaseId);
         }
         Console.WriteLine("Creating database: {0}", DatabaseId);
         WinBioConfiguration.AddDatabase(DatabaseId, unitId);
         Console.WriteLine("Adding sensor to the pool: {0}", unitId);
         WinBioConfiguration.AddUnit(DatabaseId, unitId);
         Console.WriteLine("Opening biometric session");
         var session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { unitId }, DatabaseId);
         try
         {
             Console.WriteLine("Type sub type and press enter:");
             WinBioBiometricSubType subType;
             if (!Enum.TryParse(Console.ReadLine(), true, out subType))
             {
                 Console.WriteLine("Invalid sub type");
                 return;
             }
             var identity = AddEnrollment(session, unitId, subType);
             Console.WriteLine("Identity: {0}", identity);
             Console.WriteLine();
             var enrollments = WinBio.EnumEnrollments(session, unitId, identity);
             Console.WriteLine("Found {0} enrollments for that identity:", enrollments.Length);
             foreach (var enrollment in enrollments)
             {
                 Console.WriteLine(enrollment);
             }
             Console.WriteLine();
             Console.WriteLine("Verify identity with any finger:");
             WinBioRejectDetail rejectDetail;
             WinBio.Verify(session, identity, WinBioBiometricSubType.Any, out unitId, out rejectDetail);
             Console.WriteLine("Success");
         }
         finally
         {
             Console.WriteLine("Closing biometric session");
             WinBio.CloseSession(session);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exception: " + ex.GetType().Name);
         Console.WriteLine(ex.Message);
         Console.WriteLine(ex.StackTrace);
     }
 }