public static List<GedcomIndividualRecord> FindDuplicates(GedcomIndividualRecord indi, GedcomDatabase databaseB, float matchThreshold) { List<GedcomIndividualRecord> matches = new List<GedcomIndividualRecord>(); foreach (GedcomIndividualRecord matchIndi in databaseB.Individuals) { // can't match self, databaseB could be the same database as indi.Database // so we can check this //if (matchIndi != indi) { float match = indi.IsMatch(matchIndi); if (match > matchThreshold) { matches.Add(matchIndi); //System.Console.WriteLine(indi.Names[0].Name + " matches " + matchIndi.Names[0].Name + " at " + match + "%"); } } } return matches; }
protected virtual void OnDuplicateList_RecordChanged(object sender, EventArgs e) { _indi = (GedcomIndividualRecord)DuplicateList.Record; DetailsBox.Sensitive = (_indi != null); int matches = 0; _matches = null; _currentMatch = 0; float percent = 0; if (_indi != null) { _matches = (List<GedcomIndividualRecord>)_duplicates[_indi.XRefID]; matches = _matches.Count; _currentMatch = 1; PersonBDuplicateView.Record = _matches[0]; percent = _indi.IsMatch(_matches[0]); BackButton.Sensitive = false; ForwardButton.Sensitive = (matches > 1); } DuplicatesLabel.Text = string.Format("Potential Duplicate {0} of {1}: {2}%", _currentMatch, matches, percent); PersonADuplicateView.Record = _indi; }