public EnrollmentProcess(string FingerSerialNumber, FingerData data) { InitializeComponent(); this.Data = data; EnrollmentControl.ReaderSerialNumber = FingerSerialNumber; EnrollmentControl.EnrolledFingerMask = this.Data.EnrolledFingersMask; }
public static void DelTemplateToUser(UserClass theUser, int fingerIndex) { FingerData newfinger = new FingerData(); newfinger.CopyUserToFinger(theUser); newfinger.Templates[fingerIndex] = null; if (fingerIndex > 4) { newfinger.EnrolledFingersMask = newfinger.EnrolledFingersMask & (0xFE << ConvertSCtoFPIndex(fingerIndex)); } else { newfinger.EnrolledFingersMask = newfinger.EnrolledFingersMask & (0xFE << ConvertSCtoFPIndex(fingerIndex)); } newfinger.CopyFingerToUser(theUser); }
public static void AddTemplateToUser(UserClass theUser, byte[] template, int fingerIndex) { System.IO.Stream dataStream = new System.IO.MemoryStream(template); DPFP.Template templateToLoad = new DPFP.Template(dataStream); FingerData newfinger = new FingerData(); newfinger.CopyUserToFinger(theUser); newfinger.Templates[fingerIndex] = templateToLoad; if (fingerIndex > 4) { newfinger.EnrolledFingersMask = newfinger.EnrolledFingersMask | (0x01 << ConvertSCtoFPIndex(fingerIndex)); } else { newfinger.EnrolledFingersMask = newfinger.EnrolledFingersMask | (0x01 << ConvertSCtoFPIndex(fingerIndex)); } newfinger.CopyFingerToUser(theUser); }
protected virtual void Process(DPFP.Sample Sample) { if (Mode == FingerprintMode.Verify) { bool bVerified = false; int fingerFind = -1; UserClass VerifiedUser = new UserClass(); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); if (features != null) { foreach (UserClass TheUser in UserList) { FingerData fingdata = new FingerData(); fingdata.CopyUserToFinger(TheUser); //foreach (DPFP.Template Template in fingdata.Templates) for (int index = 0; index < 10; index++) { DPFP.Template Template = fingdata.Templates[index]; if (Template != null) { FingerIndexValue fiv = (FingerIndexValue)index; // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); SetTextBox("Verify : " + TheUser.firstName + " " + TheUser.lastName + " : " + fiv.ToString() + " - FAR :" + result.FARAchieved.ToString() + " / " + Verificator.FARRequested.ToString() + " - Verified : " + result.Verified.ToString(), DateTime.Now); if (CloseFarFinger > result.FARAchieved) { CloseFarFinger = result.FARAchieved; } if ((result.Verified) || (result.FARAchieved < Verificator.FARRequested)) { bVerified = true; VerifiedUser = TheUser; fingerFind = index; break; } } } if (bVerified) { break; } } if (bVerified) { string strUser = VerifiedUser.firstName + ";" + VerifiedUser.lastName + ";" + fingerFind.ToString(); debugFirstName = VerifiedUser.firstName; debugLastName = VerifiedUser.lastName; debugFinger = (FingerIndexValue)fingerFind; if (debugOnFailedOnly) { errorCaptFP = false; } notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_AuthentificationCompleted, strUser); if (NotifyEvent != null) { SetTextBox("User verify : " + strUser, DateTime.Now); NotifyEvent(this, notifyEvent); } } else { debugFirstName = "Unknown User"; debugLastName = "Unknown User"; debugFinger = FingerIndexValue.Unknown_Finger; notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerUserUnknown, "Unknown User"); if (NotifyEvent != null) { SetTextBox("Unknown User", DateTime.Now); NotifyEvent(this, notifyEvent); } } } } }
public string EnrollUser(string FPSerialNumber, string FirstName, string LastName, string template, bool bNotEnroll) { if (myFinger != null) { ReleaseFingerprint(); } // myFinger.SetTextBox("Request Enroll User :"******"{")) { fingerSerial = "{" + FPSerialNumber; } else { fingerSerial = FPSerialNumber; } if (!FPSerialNumber.Contains("}")) { fingerSerial += "}"; } Guid guid; if (!IsGuid(fingerSerial, out guid)) { return(null); } } FingerData newfinger = new FingerData(); UserClass TheUser = new UserClass(); if (!String.IsNullOrEmpty(template)) { BinaryFormatter bf = new BinaryFormatter(); MemoryStream mem = new MemoryStream(Convert.FromBase64String(template)); TheUser = (UserClass)bf.Deserialize(mem); } else { TheUser.firstName = FirstName; TheUser.lastName = LastName; } if (!bNotEnroll) { newfinger.CopyUserToFinger(TheUser); EnrollmentProcess Enroller = new EnrollmentProcess(fingerSerial, newfinger); Enroller.ShowDialog(); // process enrollment newfinger.CopyFingerToUser(TheUser); } BinaryFormatter bf2 = new BinaryFormatter(); MemoryStream mem2 = new MemoryStream(); bf2.Serialize(mem2, TheUser); return(Convert.ToBase64String(mem2.ToArray())); }