public void LoadTypos(bool reload)
{
// during change of user settings to settings with typos enabled, LoadTypos will be called more than once
// from LoadPrefs...SetProject with RETF to say reload is needed when RETF next used, and then again from LoadPrefs with RETF enabled
// so set RegexTypos to null if reload, even if RETF not enabled at the time
// This logic is needed to support use of SetProject in other scenarios
if (reload)
RegexTypos = null;
if (chkRegExTypo.Checked && RegexTypos == null)
{
_loadingTypos = true;
chkRegExTypo.Checked = false;
StatusLabelText = "Loading typos";
// if not logged in will be using default Typos page location so look up any custom page from CheckPage info
// if no checkpage then fall back to using default ReftPath
if (!TheSession.User.IsLoggedIn && !Variables.IsWikipediaEN && Variables.RetfPath.EndsWith("AutoWikiBrowser/Typos"))
{
string checkPageText;
try
{
string url = Variables.URLIndex + "?title=Project:AutoWikiBrowser/CheckPage&action=raw";
checkPageText = Tools.GetHTML(url);
}
catch
{
checkPageText = "";
}
Session.HasTypoLink(checkPageText);
}
#if !DEBUG
string message = @"Check each edit before you make it. Although this has been built to be very accurate there will be errors.";
if (RegexTypos == null)
{
string s = Variables.RetfPath;
if (!s.StartsWith("http"))
s = Variables.URL + "/wiki/" + s;
message += "\r\n\r\nThe newest typos will now be downloaded from " + s + " when you press OK.";
}
MessageBox.Show(message, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
#endif
RegexTypos = new RegExTypoFix();
RegexTypos.Complete += RegexTyposComplete;
}
}