EditInBrowser() private method

private EditInBrowser ( ) : void
return void
	    private static string FinaliseArticleProcessing(Article TheArticle, ref bool Skip, ref string Summary, string ArticleText, bool ReqPhoto)
		{

			SkipReason SkipReason = SkipReason.Other;

			if (TheArticle.PluginManagerGetSkipResults == SkipResults.NotSet) {
				PluginSettings.PluginStats.Tagged += 1;
			} else {
				var _with6 = PluginSettings.PluginStats;
				switch (TheArticle.PluginManagerGetSkipResults) {
					case SkipResults.SkipBadTag:
						// always skip
						if (PluginSettings.SkipBadTags) {
							_with6.SkippedBadTagIncrement();
							if (PluginSettings.OpenBadInBrowser)
								TheArticle.EditInBrowser();
							Skip = true;
							// always skip
							SkipReason = SkipReason.BadTag;
						} else {
							// the plugin manager stops processing when it gets a bad tag. We know however
							// that one plugin found a bad template and possibly replaced it with
							// conTemplatePlaceholder. We're also not skipping, so we need to remove the placeholder
                            TheArticle.AlteredArticleText = TheArticle.AlteredArticleText.Replace(Constants.conTemplatePlaceholder, "");
							MessageBox.Show("Bad tag. Please fix it manually or click ignore.", "Bad tag", MessageBoxButtons.OK, MessageBoxIcon.Warning);
							PluginSettings.PluginStats.Tagged += 1;
						}
						break;
					case SkipResults.SkipRegex:
					case SkipResults.SkipNoChange:
						if (TheArticle.ProcessIt) {
							PluginSettings.PluginStats.Tagged += 1;
						} else {
							if (TheArticle.PluginManagerGetSkipResults == SkipResults.SkipRegex) {
								_with6.SkippedMiscellaneousIncrement();
								Skip = true;
								SkipReason = SkipReason.Regex;
							// No change:
							} else {
								if (PluginSettings.SkipWhenNoChange) {
									_with6.SkippedNoChangeIncrement();
									SkipReason = SkipReason.NoChange;
									Skip = true;
								} else {
									PluginSettings.PluginStats.Tagged += 1;
									Skip = false;
								}
							}
						}
						break;
				}
			}

			if (Skip) {
				return Skipping(ref Summary, TheArticle.EditSummary, SkipReason, ArticleText, ref Skip);
			}
		    var _with7 = TheArticle;
		    if (ReqPhoto) {
		        _with7.AlteredArticleText = ReqPhotoNoParamsRegex.Replace(_with7.AlteredArticleText, "");
		        _with7.DoneReplacement("{{[[template:reqphoto|reqphoto]]}}", "template param(s)", true, PluginName);
		        _with7.ArticleHasAMajorChange();
		    }

		    _with7.FinaliseEditSummary();
		    Summary = _with7.EditSummary;
		    return _with7.AlteredArticleText;
		}
        private static string FinaliseArticleProcessing(Article TheArticle, ref bool Skip, ref string Summary, string ArticleText, bool ReqPhoto)
        {
            SkipReason SkipReason = SkipReason.Other;

            if (TheArticle.PluginManagerGetSkipResults == SkipResults.NotSet)
            {
                PluginSettings.PluginStats.Tagged += 1;
            }
            else
            {
                var _with6 = PluginSettings.PluginStats;
                switch (TheArticle.PluginManagerGetSkipResults)
                {
                case SkipResults.SkipBadTag:
                    // always skip
                    if (PluginSettings.SkipBadTags)
                    {
                        _with6.SkippedBadTagIncrement();
                        if (PluginSettings.OpenBadInBrowser)
                        {
                            TheArticle.EditInBrowser();
                        }
                        Skip = true;
                        // always skip
                        SkipReason = SkipReason.BadTag;
                    }
                    else
                    {
                        // the plugin manager stops processing when it gets a bad tag. We know however
                        // that one plugin found a bad template and possibly replaced it with
                        // conTemplatePlaceholder. We're also not skipping, so we need to remove the placeholder
                        TheArticle.AlteredArticleText = TheArticle.AlteredArticleText.Replace(Constants.conTemplatePlaceholder, "");
                        MessageBox.Show("Bad tag. Please fix it manually or click ignore.", "Bad tag", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        PluginSettings.PluginStats.Tagged += 1;
                    }
                    break;

                case SkipResults.SkipRegex:
                case SkipResults.SkipNoChange:
                    if (TheArticle.ProcessIt)
                    {
                        PluginSettings.PluginStats.Tagged += 1;
                    }
                    else
                    {
                        if (TheArticle.PluginManagerGetSkipResults == SkipResults.SkipRegex)
                        {
                            _with6.SkippedMiscellaneousIncrement();
                            Skip       = true;
                            SkipReason = SkipReason.Regex;
                            // No change:
                        }
                        else
                        {
                            if (PluginSettings.SkipWhenNoChange)
                            {
                                _with6.SkippedNoChangeIncrement();
                                SkipReason = SkipReason.NoChange;
                                Skip       = true;
                            }
                            else
                            {
                                PluginSettings.PluginStats.Tagged += 1;
                                Skip = false;
                            }
                        }
                    }
                    break;
                }
            }

            if (Skip)
            {
                return(Skipping(ref Summary, TheArticle.EditSummary, SkipReason, ArticleText, ref Skip));
            }
            var _with7 = TheArticle;

            if (ReqPhoto)
            {
                _with7.AlteredArticleText = ReqPhotoNoParamsRegex.Replace(_with7.AlteredArticleText, "");
                _with7.DoneReplacement("{{[[template:reqphoto|reqphoto]]}}", "template param(s)", true, PluginName);
                _with7.ArticleHasAMajorChange();
            }

            _with7.FinaliseEditSummary();
            Summary = _with7.EditSummary;
            return(_with7.AlteredArticleText);
        }
Example #3
0
        private static string FinaliseArticleProcessing(Article theArticle, ref bool skip, ref string summary,
                                                        string articleText, bool reqPhoto)
        {
            SkipReason skipReason = SkipReason.Other;

            if (theArticle.PluginManagerGetSkipResults == SkipResults.NotSet)
            {
                _pluginSettings.PluginStats.Tagged += 1;
            }
            else
            {
                switch (theArticle.PluginManagerGetSkipResults)
                {
                case SkipResults.SkipBadTag:
                    // always skip
                    if (_pluginSettings.SkipBadTags)
                    {
                        _pluginSettings.PluginStats.SkippedBadTagIncrement();
                        if (_pluginSettings.OpenBadInBrowser)
                        {
                            theArticle.EditInBrowser();
                        }
                        skip = true;
                        // always skip
                        skipReason = SkipReason.BadTag;
                    }
                    else
                    {
                        // the plugin manager stops processing when it gets a bad tag. We know however
                        // that one plugin found a bad template and possibly replaced it with
                        // conTemplatePlaceholder. We're also not skipping, so we need to remove the placeholder
                        theArticle.AlteredArticleText =
                            theArticle.AlteredArticleText.Replace(Constants.TemplaterPlaceholder, "");
                        MessageBox.Show("Bad tag. Please fix it manually or click ignore.", "Bad tag",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        _pluginSettings.PluginStats.Tagged += 1;
                    }
                    break;

                case SkipResults.SkipRegex:
                case SkipResults.SkipNoChange:
                    if (theArticle.ProcessIt)
                    {
                        _pluginSettings.PluginStats.Tagged += 1;
                    }
                    else
                    {
                        if (theArticle.PluginManagerGetSkipResults == SkipResults.SkipRegex)
                        {
                            _pluginSettings.PluginStats.SkippedMiscellaneousIncrement();
                            skip       = true;
                            skipReason = SkipReason.Regex;
                            // No change:
                        }
                        else
                        {
                            if (_pluginSettings.SkipWhenNoChange)
                            {
                                _pluginSettings.PluginStats.SkippedNoChangeIncrement();
                                skipReason = SkipReason.NoChange;
                                skip       = true;
                            }
                            else
                            {
                                _pluginSettings.PluginStats.Tagged += 1;
                                skip = false;
                            }
                        }
                    }
                    break;
                }
            }

            if (skip)
            {
                return(Skipping(ref summary, theArticle.EditSummary, skipReason, articleText, ref skip));
            }

            if (reqPhoto)
            {
                theArticle.AlteredArticleText = ReqPhotoNoParamsRegex.Replace(theArticle.AlteredArticleText, "");
                theArticle.DoneReplacement("{{reqphoto}}", "template param(s)");
                theArticle.ArticleHasAMajorChange();
            }

            theArticle.FinaliseEditSummary();
            summary = theArticle.EditSummary;
            return(theArticle.AlteredArticleText);
        }
Example #4
0
        private static string FinaliseArticleProcessing(Article theArticle, ref bool skip, ref string summary,
            string articleText, bool reqPhoto)
        {
            SkipReason skipReason = SkipReason.Other;

            if (theArticle.PluginManagerGetSkipResults == SkipResults.NotSet)
            {
                _pluginSettings.PluginStats.Tagged += 1;
            }
            else
            {
                switch (theArticle.PluginManagerGetSkipResults)
                {
                    case SkipResults.SkipBadTag:
                        // always skip
                        if (_pluginSettings.SkipBadTags)
                        {
                            _pluginSettings.PluginStats.SkippedBadTagIncrement();
                            if (_pluginSettings.OpenBadInBrowser)
                                theArticle.EditInBrowser();
                            skip = true;
                            // always skip
                            skipReason = SkipReason.BadTag;
                        }
                        else
                        {
                            // the plugin manager stops processing when it gets a bad tag. We know however
                            // that one plugin found a bad template and possibly replaced it with
                            // conTemplatePlaceholder. We're also not skipping, so we need to remove the placeholder
                            theArticle.AlteredArticleText =
                                theArticle.AlteredArticleText.Replace(Constants.TemplaterPlaceholder, "");
                            MessageBox.Show("Bad tag. Please fix it manually or click ignore.", "Bad tag",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            _pluginSettings.PluginStats.Tagged += 1;
                        }
                        break;
                    case SkipResults.SkipRegex:
                    case SkipResults.SkipNoChange:
                        if (theArticle.ProcessIt)
                        {
                            _pluginSettings.PluginStats.Tagged += 1;
                        }
                        else
                        {
                            if (theArticle.PluginManagerGetSkipResults == SkipResults.SkipRegex)
                            {
                                _pluginSettings.PluginStats.SkippedMiscellaneousIncrement();
                                skip = true;
                                skipReason = SkipReason.Regex;
                                // No change:
                            }
                            else
                            {
                                if (_pluginSettings.SkipWhenNoChange)
                                {
                                    _pluginSettings.PluginStats.SkippedNoChangeIncrement();
                                    skipReason = SkipReason.NoChange;
                                    skip = true;
                                }
                                else
                                {
                                    _pluginSettings.PluginStats.Tagged += 1;
                                    skip = false;
                                }
                            }
                        }
                        break;
                }
            }

            if (skip)
            {
                return Skipping(ref summary, theArticle.EditSummary, skipReason, articleText, ref skip);
            }

            if (reqPhoto)
            {
                theArticle.AlteredArticleText = ReqPhotoNoParamsRegex.Replace(theArticle.AlteredArticleText, "");
                theArticle.DoneReplacement("{{reqphoto}}", "template param(s)");
                theArticle.ArticleHasAMajorChange();
            }

            theArticle.FinaliseEditSummary();
            summary = theArticle.EditSummary;
            return theArticle.AlteredArticleText;
        }