Add wordfilter bypass search via database

regex matching takes a lot more time and is a cosmetic / easily fixable
issue (reset to no nickname / default OT).
Add a prompt to temp turn off those checks to drastically speed up
search (no regexes done).

Fix unsanitize for gen6 (should have been >= 6, aka starting with gen6)
This commit is contained in:
Kurt 2017-09-20 16:46:40 -07:00
parent 69e8c071f7
commit a938a1bd9c
2 changed files with 8 additions and 2 deletions

View File

@ -1931,7 +1931,7 @@ private static string SanitizeString(string str)
private static string UnSanitizeString(string str, int generation, int species = -1, bool nicknamed = true)
{
var s = str;
if (generation > 6)
if (generation >= 6)
s = str.Replace("\u0027", "\u2019"); // farfetch'd
if (generation == 5 || generation == 4)
@ -1943,7 +1943,7 @@ private static string UnSanitizeString(string str, int generation, int species =
bool foreign = true;
if ((species == 029 || species == 032) && !nicknamed)
foreign = str[0] != 'N';
foreign = str[0] != 'N'; // idoran
else if (nicknamed)
foreign = str.Select(c => c >> 12).Any(c => c != 0 && c != 0xE);

View File

@ -568,7 +568,13 @@ private async void B_Search_Click(object sender, EventArgs e)
{
B_Search.Enabled = false;
var search = SearchDatabase();
bool legalSearch = Menu_SearchLegal.Checked ^ Menu_SearchIllegal.Checked;
if (legalSearch && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Check wordfilter legality?") == DialogResult.No)
Legal.CheckWordFilter = false;
var results = await Task.Run(() => search.ToArray());
Legal.CheckWordFilter = true;
if (results.Length == 0)
{
if (!Menu_SearchBoxes.Checked && !Menu_SearchDatabase.Checked)