From a938a1bd9c835d66cb50c9a31b62e3bca725605a Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 20 Sep 2017 16:46:40 -0700 Subject: [PATCH] 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) --- PKHeX.Core/PKM/StringConverter.cs | 4 ++-- PKHeX.WinForms/Subforms/SAV_Database.cs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/PKM/StringConverter.cs b/PKHeX.Core/PKM/StringConverter.cs index 85dae3dd1..a67103b32 100644 --- a/PKHeX.Core/PKM/StringConverter.cs +++ b/PKHeX.Core/PKM/StringConverter.cs @@ -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); diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs index 977ff5376..793560f55 100644 --- a/PKHeX.WinForms/Subforms/SAV_Database.cs +++ b/PKHeX.WinForms/Subforms/SAV_Database.cs @@ -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)