protected virtual void Process(DPFP.Sample Sample) { DrawPicture(ConvertSampleToBitmap(Sample)); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); if (features != null) { byte[] bytes = new byte[1632]; features.Serialize(ref bytes); for (int x = 0; x < List_Usuarios.Count; x++) { DPFP.Template templeate = new DPFP.Template(); templeate.DeSerialize(List_Usuarios[x].fingerPrint); DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, templeate, ref result); if (result.Verified) { _idCliente = List_Usuarios[x].id_Cliente; return; } } //videoSourcePlayer1.BackgroundImage = Properties.Resources.Desconocido; MessageBox.Show("Cliente no encontrado", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
protected void ButtonCreateChannel_Click(object sender, EventArgs e) { try { TwitterEntities context = new TwitterEntities(); Channel channel = new Channel(); var currentUserName = this.User.Identity.Name; var author = context.AspNetUsers.FirstOrDefault(x => x.UserName == currentUserName); Verificator.ValidateChannel(ChannelName.Text); channel.AspNetUser = author; channel.Name = ChannelName.Text; context.Channels.Add(channel); context.SaveChanges(); ErrorSuccessNotifier.AddSuccessMessage("Channel created successfully."); ErrorSuccessNotifier.ShowAfterRedirect = true; Response.Redirect("../Messages/ChannelMessages.aspx?channelId=" + channel.ChannelId, false); } catch (Exception ex) { ErrorSuccessNotifier.AddErrorMessage(ex); } }
protected void ButtonCreateMessage_Click(object sender, EventArgs e) { try { int channelId = Convert.ToInt32(this.DropDownListChannels.SelectedValue); TwitterEntities context = new TwitterEntities(); Message msg = new Message(); Channel channel = context.Channels.Find(channelId); msg.Channel = channel; string msgText = MessageContent.Text; Verificator.ValidateMessage(msgText); msg.MessageContent = msgText; var currentUserName = this.User.Identity.Name; var author = context.AspNetUsers.FirstOrDefault(x => x.UserName == currentUserName); msg.AspNetUser = author; msg.Date = DateTime.Now; context.Messages.Add(msg); context.SaveChanges(); ErrorSuccessNotifier.AddSuccessMessage("Message created successfully."); ErrorSuccessNotifier.ShowAfterRedirect = true; Response.Redirect("ChannelMessages.aspx?channelId=" + channelId, false); } catch (Exception ex) { ErrorSuccessNotifier.AddErrorMessage(ex); } }
// The id parameter name should match the DataKeyNames value set on the control public void GridViewMyChannels_UpdateItem(int ChannelId) { TwitterEntities context = new TwitterEntities(); Twitter.Models.Channel item = null; // Load the item here, e.g. item = MyDataLayer.Find(id); item = context.Channels.Find(ChannelId); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", ChannelId)); return; } TryUpdateModel(item); if (ModelState.IsValid) { try { Verificator.ValidateChannel(item.Name); context.SaveChanges(); ErrorSuccessNotifier.AddInfoMessage("Channel updated successfully"); } catch (Exception ex) { ErrorSuccessNotifier.AddErrorMessage(ex.Message); } // Save changes here, e.g. MyDataLayer.SaveChanges(); } }
protected void LinkButtonUpdate_Command(object sender, CommandEventArgs e) { try { int channelId = Convert.ToInt32(e.CommandArgument); TwitterEntities context = new TwitterEntities(); var channel = context.Channels.FirstOrDefault(x => x.ChannelId == channelId); var button = sender as LinkButton; var tr = button.Parent.Parent; var textBox = tr.FindControl("TextBoxEditChannel") as TextBox; string newChannelName = textBox.Text; Verificator.ValidateChannel(newChannelName); channel.Name = newChannelName; context.SaveChanges(); ErrorSuccessNotifier.AddInfoMessage("Channel name updated successfully."); } catch (Exception ex) { ErrorSuccessNotifier.AddErrorMessage(ex); } }
private void InitializeMain() { logger = new Logger(); logger.StartLog(); if (instance == null) { instance = this; logger.LogInfo("Main gameObject is initialized."); } else { logger.LogError("Another instance of ::Main.cs:: is already running!"); } verificator = new Verificator(); if (verificator == null) { logger.LogError("Verificator is not initialized!"); } else { logger.LogInfo("Verification system is started."); } _year = 1; _season = Season.dawn; town = new Settlement(); }
public void EmptyPath() { var verificator = new Verificator(); var path = string.Empty; Assert.IsFalse(verificator.IsValidSudokuSolution(path)); }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); UpdateStatus(result.FARAchieved); if (result.Verified) { MakeReport("A impressão digital foi verificada."); MetroFramework.MetroMessageBox.Show(this, "A impressão digital foi verificada com sucesso.", "Verificação biométrica", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question); } else { MakeReport("A impressão digital não foi verificada."); MetroFramework.MetroMessageBox.Show(this, "A impressão digital não encontrada. Tente novamente.", "Verificação biométrica", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } } }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); UpdateStatus(result.FARAchieved); if (result.Verified) { MakeReport("The fingerprint was VERIFIED."); } else { MakeReport("The fingerprint was NOT VERIFIED."); } } }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); var FileReader = new CargaFileHandler(); if (features != null) { var biometrias = FileReader.ReadBiometriasFile("digitalPersona"); foreach (var bio in biometrias) { DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); try { Template t = new Template(); t.DeSerialize(bio.GetBytes()); Verificator.Verify(features, t, ref result); } catch { OnVerify?.Invoke(false, ""); return; }; if (result.Verified) { OnVerify?.Invoke(true, bio.Chave); return; } } OnVerify?.Invoke(false, ""); } }
protected virtual void Process(DPFP.Sample Sample) { DrawPicture(ConvertSampleToBitmap(Sample)); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); if (features != null) { byte[] bytes = new byte[1632]; features.Serialize(ref bytes); for (int x = 0; x < List_Usuarios.Count; x++) { DPFP.Template templeate = new DPFP.Template(); templeate.DeSerialize(List_Usuarios[x].fingerPrint); DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, templeate, ref result); if (result.Verified) { int id_usuario = List_Usuarios[x].id_Cliente; var usuario = (from cliente in contexto.tb_Usuarios where cliente.id_usuario == id_usuario select cliente).Single(); MessageBox.Show("VERIFICADO " + usuario.nombre_usuario); return; } } MessageBox.Show("NO ENCONTRADO"); } }
public void EmptyFile() { var verificator = new Verificator(); var path = "./TestFile.txt"; File.Create(path).Dispose(); Assert.IsFalse(verificator.IsValidSudokuSolution(path)); }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); string[] flist = Directory.GetFiles("c:/finger"); int mx = flist.Length; int cnt = 0; bool found = false; DPFP.Template templates; while (cnt < mx && !found) { // MessageBox.Show(flist[cnt]); using (FileStream fs = File.OpenRead(flist[cnt])) { templates = new DPFP.Template(fs); Verificator.Verify(features, templates, ref result); UpdateStatus(result.FARAchieved); } if (result.Verified) { found = true; FileInfo nfo = new FileInfo(flist[cnt]); fname = nfo.Name; break; } else { found = false; cnt++; } } if (found) { MakeReport("The fingerprint was VERIFIED. "+fname); MessageBox.Show("Verified!!"); } else { MakeReport("The fingerprint was NOT VERIFIED."); MessageBox.Show("Not Verified!!"); } } }
protected void HyperLinkAddMessage_Click(object sender, EventArgs e) { try { int channelId = Convert.ToInt32(Request.Params["channelId"]); TwitterEntities context = new TwitterEntities(); string currentUserName = User.Identity.Name; LinkButton button = sender as LinkButton; var tr = button.Parent.Parent; var trControls = tr.Controls; string messageContent = null; foreach (Control tdControl in trControls) { foreach (Control control in tdControl.Controls) { if (control.ID == "MessageContent") { messageContent = (control as TextBox).Text; } } } Verificator.ValidateMessage(messageContent); string userId = context.AspNetUsers.FirstOrDefault(x => x.UserName == currentUserName).Id; Message message = new Message() { ChannelId = channelId, Date = DateTime.Now, MessageContent = messageContent, UserId = userId }; context.Messages.Add(message); context.SaveChanges(); this.GridViewMessages.DataBind(); this.InfoHolder.Visible = false; //ErrorSuccessNotifier.ShowAfterRedirect = false; //ErrorSuccessNotifier.AddSuccessMessage("Message created successfully."); } catch (Exception ex) { this.InfoHolder.InnerText = ex.Message; this.InfoHolder.Attributes.Add("class", "alert alert-error"); this.InfoHolder.Visible = true; //ErrorSuccessNotifier.ShowAfterRedirect = false; //ErrorSuccessNotifier.AddErrorMessage(ex); } }
public Verificator findOne(string username, string password) { IDbConnection connection = DBUtils.getConnection(); Verificator result = connection.Query <Verificator>( @"SELECT id, username, password FROM Verificator WHERE username = @username and password = @password", new { username, password }).FirstOrDefault(); return(result); }
private static void CheckData() { var errors = new Verificator().CheckDataLocation().GetErrors; if (errors.Count > 0) { Logger.WriteRealTimeError(String.Join("\n ", errors)); Exit(); } }
public void FileWithNotEnoughValues() { var verificator = new Verificator(); var path = "./TestFileNotEnoughValues.txt"; var solution = "123456789\n" + "123456789\n" + "1234123456\n"; File.WriteAllText(path, solution); Assert.IsFalse(verificator.IsValidSudokuSolution(path)); }
public void FileWithLineCharacters() { var verificator = new Verificator(); var path = "./TestFile.txt"; using (var sw = File.AppendText(path)) { sw.WriteLine(""); } Assert.IsFalse(verificator.IsValidSudokuSolution(path)); }
public void FileWithValidWrongSolutionCols() { var verificator = new Verificator(); var path = "./TestFileValid.txt"; var solution = "534678912\r\r\n" + "672195348\r\r\n" + "198342567\r\r\n" + "859761423\r\r\n" + "426853791\r\r\n" + "713924856\r\r\n" + "961537284\r\r\n" + "287419635\r\r\n" + "345286197"; File.WriteAllText(path, solution); Assert.IsFalse(verificator.IsValidSudokuSolution(path)); }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { DbConnection.checkConnection(); lst = getbyet(); DPFP.FeatureSet featur; for (int i = 0; i < lst.Count; i++) { Stream s = new MemoryStream(lst[i].Prints); DPFP.Sample sample = new DPFP.Sample(s); featur = ExtractFeatures(sample, DPFP.Processing.DataPurpose.Enrollment); enrol.AddFeatures(featur); if (enrol.TemplateStatus == DPFP.Processing.Enrollment.Status.Ready) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, enrol.Template, ref result); UpdateStatus(result.FARAchieved); if (result.Verified) { cnic = lst[i].CNIC; this.DialogResult = System.Windows.Forms.DialogResult.OK; base.Stop(); this.Dispose(); break; } else { cnic = ""; MakeReport("The fingerprint was NOT VERIFIED."); enrol.Clear(); } } } } }
public async Task <IActionResult> Post([FromBody] VerificatorView verificator) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var ver = new Verificator() { Address = verificator.Address, Certificate = verificator.Certificate, Code = verificator.Code, Director = verificator.Director, Name = verificator.Name, Phone = verificator.Phone }; await db.Verificators.AddAsync(ver); await db.SaveAsync(); return(CreatedAtAction("Get", new { id = ver.Id }, ver)); }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); // Process the sample and create a feature set for the enrollment purpose. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { byte[] bytes = new byte[1632]; features.Serialize(ref bytes); //"0X" + BitConverter.ToString( bytes ).Replace("-","") for (int x = 0; x < List_Usuarios.Count; x++) { DPFP.Template templeate = new DPFP.Template(); templeate.DeSerialize(List_Usuarios[x].dedo); //Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, templeate, ref result); //UpdateStatus(result.FARAchieved); if (result.Verified) { MessageBox.Show("VERIFICADO " + List_Usuarios[x].nombre_usuario);//MakeReport("The fingerprint was VERIFIED."); return; } } MessageBox.Show("NO ENCONTRADO"); //if (templeate == null) // return; } }
protected override void Process(DPFP.Sample Sample) { base.Process(Sample); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); var FileReader = new CargaFileHandler(); if (features != null) { var biometrias = FileReader.ReadBiometriasFile("digitalPersona"); var chaves = new List <string>(); foreach (var bio in biometrias) { Template t = new Template(); t.DeSerialize(bio.GetBytes()); DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, t, ref result); if (result.Verified) { chaves.Add(bio.Chave); } } foreach (var chave in chaves) { biometrias.RemoveAll(x => x.Chave == chave); } if (biometrias.Count > 0) { FileReader.SavaBiometriasFile(biometrias, "digitalPersona", true); } OnDelete?.Invoke(chaves); } }
// The id parameter name should match the DataKeyNames value set on the control public void GridViewMyMessages_UpdateItem(int MessageId) { TwitterEntities context = new TwitterEntities(); Twitter.Models.Message item = null; // Load the item here, e.g. item = MyDataLayer.Find(id); item = context.Messages.FirstOrDefault(x => x.MessageId == MessageId); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", MessageId)); return; } TryUpdateModel(item); if (ModelState.IsValid) { // Save changes here, e.g. MyDataLayer.SaveChanges(); try { Verificator.ValidateMessage(item.MessageContent); context.SaveChanges(); ErrorSuccessNotifier.AddInfoMessage("Message has been edited successfully"); } catch (Exception ex) { if (ex.Message != null) { ErrorSuccessNotifier.AddErrorMessage(ex.Message); } else { ErrorSuccessNotifier.AddErrorMessage(ex); } } } }
public void loginVerificator(string username, string password) { try { Verificator verificator = Service.findOneVerificator(username, password); if (verificator == null) { throw new Exception("Username & password nu corespund niciunui verificator!"); } VerificatorController verificatorController = new VerificatorController(Service); VerificatorWindow verificatorWindow = new VerificatorWindow(verificatorController); addObserver(verificatorController); notifyObservers(); verificatorWindow.Text = "Verificator: " + verificator.username; verificatorWindow.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void RunRules() { this.verificator = new Verificator(); this.verificator.RegisterConventionsFrom(this.conventionAssemblies.ToArray()); this.verificator.StartingRule += (s, e) => { Log.Debug("Starting rule {0}", e.Rule.GetType().Name); this.Report.VerificationRule(e.Rule); }; this.verificator.NodeVerified += (s, e) => { this.Report.NodeVerification(e.Rule, e.Node, e.Violations); }; this.verificator.GraphVerified += (s, e) => { this.Report.GraphVerification(e.Rule, e.Violations); }; this.verificator.FinishedRule += (s, e) => Log.Info("Finished rule {0}", e.Rule.GetType().Name); this.verificationContext = new VerificationContext(); foreach (var rule in this.runlist.Elements.Where(x => x.IsRule)) { this.verificator.AddRule(rule.Type); } try { this.verificator.Verify(this.verificationContext, this.modelBuilder); } catch (Exception e) { Log.Fatal("Error running rules", e); } ReportViolations(this.verificationContext.Violations); }
public void NewRegister() { if (tremsOfUseToggle.GetComponentInChildren <Toggle>().isOn&& labaRulesToggle.GetComponentInChildren <Toggle>().isOn) { string number = Verificator.IsValidPhoneNumber(phone_register.text); if (number == null) { Debug.Log("Неверно введен номер телефона"); return; } if (!TestEmail.IsEmail(email_register.text)) { Debug.Log("Неверно введен Email"); return; } if (password_register.text.Trim().Length < 6) { Debug.Log("Пароль должен быть больше 6-ти символов"); return; } if (name_register.text.Trim().Length < 2) { Debug.Log("Введите Имя"); return; } if (lastName_register.text.Trim().Length < 1) { Debug.Log("Введите Фамилию"); return; } if (patronymic_register.text.Trim().Length < 2) { Debug.Log("Введите Отчество"); return; } Email = email_register.text; Password = password_register.text; Phone_Number = number; Name = name_register.text; LastName = lastName_register.text; Patronymic = patronymic_register.text; Birthday = "" + birthday_register[0].options[birthday_register[0].value].text + "/" + birthday_register[1].options[birthday_register[1].value].text + "/" + birthday_register[2].options[birthday_register[2].value].text; gameManager.ShowLoading(true); uint phoneAuthTimeoutMs = 60 * 1000; Provider = PhoneAuthProvider.GetInstance(Auth); Provider.VerifyPhoneNumber(Phone_Number, phoneAuthTimeoutMs, null, verificationCompleted: (credential) => { Debug.Log("Completed"); SignInAndUpdate(credential); }, verificationFailed: (error) => { Debug.Log("error"); Debug.Log(error); gameManager.ShowLoading(false); }, codeSent: (id, token) => { Debug.Log(id); verificationId = id; gameManager.Panels[1].GetComponent <Animator>().Play("SSCR Fade-out"); gameManager.Panels[2].GetComponent <Animator>().Play("SSCR Fade-in"); gameManager.ShowLoading(false); }, codeAutoRetrievalTimeOut: (id) => { Debug.Log("Phone Auth, auto-verification timed out"); gameManager.ShowLoading(false); }); } }
protected virtual void Process(DPFP.Sample Sample) { DrawPicture(ConvertSampleToBitmap(Sample)); DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); if (features != null) { byte[] bytes = new byte[1632]; features.Serialize(ref bytes); imprimir imprimir = new imprimir(mostrar_info); for (int x = 0; x < lista.Count; x++) { DPFP.Template templeate = new DPFP.Template(); //if (lista[x].huella == null) //{ // return; //} templeate.DeSerialize(lista[x].huella); DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, templeate, ref result); if (result.Verified) { id_usuario = lista[x].id_cliente; tipo_persona = lista[x].tipo; if (tipo_persona == "Cliente") { if (id_usuario == id_usuario_anterior && tipo_persona == tipo_persona_anterior) { } else { var fecha = contexto.sp_Buscar_Clientes_Id(id_usuario).ToList(); //if() valor = verificar_vencimiento(Convert.ToDateTime(fecha[0].fecha_corte)); //var usuario = (from cliente in contexto.Catalogo_Clientes where cliente.id_cliente == id_usuario select cliente).Single(); var data = (Byte[])fecha[0].foto; var stream = new MemoryStream(data); Foto_videoSourcePlayer.BackgroundImage = Image.FromStream(stream); this.Invoke(imprimir, new Object_Checado() { nombre = fecha[0].nombre, valor = valor, fecha = Convert.ToDateTime(fecha[0].fecha_corte) }); id_usuario_anterior = id_usuario; tipo_persona_anterior = tipo_persona; timer1.Start(); } } else if (tipo_persona == "Instructor") { if (id_usuario == id_usuario_anterior && tipo_persona == tipo_persona_anterior) { } else { var estatus = contexto.sp_Buscar_Instructor_Id(id_usuario).First(); if (estatus.estatus == true) { contexto.sp_Registro_Ingreso(id_usuario, true, true, id_responsable); } else if (estatus.estatus == false) { contexto.sp_Registro_Ingreso(id_usuario, true, false, id_responsable); } var usuario = (from cliente in contexto.Catalogo_Instructores where cliente.id_instructor == id_usuario select cliente).First(); var data = (Byte[])usuario.foto; var stream = new MemoryStream(data); Foto_videoSourcePlayer.BackgroundImage = Image.FromStream(stream); valor = 2; this.Invoke(imprimir, new Object_Checado() { nombre = usuario.nombre, valor = valor }); id_usuario_anterior = id_usuario; tipo_persona_anterior = tipo_persona; timer1.Start(); } } return; } } this.Invoke(imprimir, new Object_Checado() { nombre = "Desconocido", valor = 0 }); color_pictureBox.BackColor = Color.White; Foto_videoSourcePlayer.BackgroundImage = Properties.Resources.Desconocido; } }