ReplaceImage() public static method

Replaces an image in the article.
public static ReplaceImage ( string oldImage, string newImage, string articleText ) : string
oldImage string The old image to replace.
newImage string The new image.
articleText string The wiki text of the article.
return string
Example #1
0
        public string ProcessArticle(IAutoWikiBrowser sender, ProcessArticleEventArgs eventargs)
        {
            //If menu item is not checked, then return
            if (!PluginEnabled || Settings.Images.Count == 0)
            {
                eventargs.Skip = false;
                return eventargs.ArticleText;
            }

            eventargs.EditSummary = "";
            string text = eventargs.ArticleText;

            Parsers parse = new Parsers();

            foreach (KeyValuePair<string, string> p in Settings.Images)
            {
                bool noChange;

                if (p.Value.Length == 0)
                {
                    text = parse.RemoveImage(p.Key, text, Settings.Comment, "", out noChange);
                    if (!noChange) eventargs.EditSummary += ", removed " + Variables.Namespaces[6] + p.Key;
                }
                else
                {
                    text = parse.ReplaceImage(p.Key, p.Value, text, out noChange);
                    if (!noChange) eventargs.EditSummary += ", replaced: " + Variables.Namespaces[6]
                         + p.Key + FindandReplace.Arrow + Variables.Namespaces[6] + p.Value;
                }
                if (!noChange) text = Regex.Replace(text, "<includeonly>[\\s\\r\\n]*\\</includeonly>", "");
            }

            eventargs.Skip = (text == eventargs.ArticleText) && Settings.Skip;

            return text;
        }