WikiFunctions.Parse.RegExTypoFix.TypoError C# (CSharp) Метод

TypoError() статический приватный Метод

static private TypoError ( string error ) : void
error string
Результат void
        internal static void TypoError(string error)
        {
            MessageBox.Show(error + "\r\n\r\nPlease visit the typo page at " + Variables.RetfPath +
                " and fix this error, then click 'File → Refresh status/typos' menu item to reload typos.",
                "RegexTypoFix error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

Usage Example

Пример #1
0
        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)
                        {
                            try
                            {
                                text = Tools.GetHTML("http://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);
                            }
                        }
                        else
                        {
                            text = "";
                        }
                    }
                }

                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.Handle(ex);
                // refuse to accept malformed typo lists to encourage people to correct errors
                return(new Dictionary <string, string>());
            }

            return(typoStrings);
        }
All Usage Examples Of WikiFunctions.Parse.RegExTypoFix::TypoError