bool CountryAutoComplete_FilterItemChanged(object sender, FilterItemEventArgs e) { object value1 = e.Text; object value2 = e.Item; var string1 = value1.ToString().ToLower(); var string2 = value2.ToString().ToLower(); if (string1.Length > 0 && string2.Length > 0) { if (string1[0] != string2[0]) { return(false); } } var originalString1 = string.Empty; var originalString2 = string.Empty; if (string1.Length < string2.Length) { originalString2 = string2.Remove(string1.Length); originalString1 = string1; } if (string2.Length < string1.Length) { return(false); } if (string2.Length == string1.Length) { originalString1 = string1; originalString2 = string2; } bool IsMatchSoundex = helper.ProcessOnSoundexAlgorithmn(originalString1) == helper.ProcessOnSoundexAlgorithmn(originalString2); int Distance = helper.GetDamerauLevenshteinDistance(originalString1, originalString2); if (IsMatchSoundex || Distance <= 4) { return(true); } else { return(false); } }
bool CountryAutoComplete_FilterItemChanged(object sender, FilterItemEventArgs e) { object value1 = e.Text; object value2 = e.Item; var string1 = value1.ToString().ToLower(); var string2 = value2.ToString().ToLower(); if (string1.Length > 0 && string2.Length > 0) { if (string1[0] != string2[0]) { return(false); } } var originalString1 = string.Empty; var originalString2 = string.Empty; if (string1.Length < string2.Length) { originalString2 = string2.Remove(string1.Length); originalString1 = string1; } if (string2.Length < string1.Length) { return(false); } if (string2.Length == string1.Length) { originalString1 = string1; originalString2 = string2; } bool IsMatchSoundex = helper.ProcessOnSoundexAlgorithmn(originalString1) == helper.ProcessOnSoundexAlgorithmn(originalString2); int Distance = helper.GetDamerauLevenshteinDistance(originalString1, originalString2); if (IsMatchSoundex || Distance <= 4) { return(true); } else { return(false); } int matchValue = 0; var allWords = value2.ToString().ToLower().Split(' '); var keys = value1.ToString().ToLower().Split(' '); foreach (var item in allWords) { foreach (var key in keys) { var itemValue = item; if (item.Length > key.Length) { itemValue = item.Remove(key.Length); } if (key == "" || item == "") { continue; } if ((helper.ProcessOnSoundexAlgorithmn(key) == helper.ProcessOnSoundexAlgorithmn(itemValue))) { matchValue++; } if ((helper.ProcessOnSoundexAlgorithmn(key) == helper.ProcessOnSoundexAlgorithmn(item))) { matchValue++; } } } int keysCount = 0; if (matchValue >= keysCount) { return(true); } return(false); }
void shellView_FilterItem(object sender, FilterItemEventArgs e) { e.Include = ((e.Item.FileSystemPath.ToLowerInvariant().EndsWith(".dll") || e.Item.FileSystemPath.ToLowerInvariant().EndsWith("*.exe")) && !e.Item.IsFolder) || e.Item.IsFolder; }