WikiFunctions.Parse.TyposDownloader.GetTypos C# (CSharp) Метод

GetTypos() публичный Метод

Loads the typos from the rules page e.g. https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos Throws errors if any rules invalid or duplicate rules exist
public GetTypos ( ) : string>.Dictionary
Результат string>.Dictionary
        public Dictionary<string, string> GetTypos()
        {
            Dictionary<string, string> typoStrings = new Dictionary<string, string>();

            try
            {
                string text = "";
                try
                {
                    text = Tools.GetHTML(Url, Encoding.UTF8);
                }
                catch
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        if (
                            MessageBox.Show(
                                "No list of typos was found. Would you like to use the list of typos from the English Wikipedia?\r\nOnly choose 'Yes' if this is an English wiki.",
                                "Load from English Wikipedia?", MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            return typoStrings;
                        }
                        try
                        {
                            text =
                                Tools.GetHTML(
                                    "https://en.wikipedia.org/w/index.php?title=Wikipedia:AutoWikiBrowser/Typos&action=raw",
                                    Encoding.UTF8);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("There was a problem loading the list of typos: " + ex.Message);
                        }
                    }
                }

                if (string.IsNullOrEmpty(text))
                    return typoStrings; // Currently an empty dictionary

                foreach (Match m in TypoRegex.Matches(text))
                {
                    try
                    {
                        typoStrings.Add(m.Groups[2].Value, m.Groups[3].Value);
                    }
                    catch (ArgumentException)
                    {
                        RegExTypoFix.TypoError("Duplicate typo rule '" + m.Groups[2].Value + "' found.");
                        return new Dictionary<string, string>();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
                // refuse to accept malformed typo lists to encourage people to correct errors
                return new Dictionary<string, string>();
            }

            return typoStrings;
        }
TyposDownloader