Beispiel #1
0
        /// <summary>
        /// Fill the object with settings from UI
        /// </summary>
        public FaRPrefs(bool mEnabled, WikiFunctions.Parse.FindandReplace findAndReplace,
                        WikiFunctions.MWB.ReplaceSpecial replaceSpecial, string[] mSubstTemplates,
                        bool mIncludeComments, bool mExpandRecursively, bool mIgnoreUnformatted)
        {
            Enabled         = mEnabled;
            IgnoreSomeText  = findAndReplace.ignoreLinks;
            IgnoreMoreText  = findAndReplace.ignoreMore;
            AppendSummary   = findAndReplace.AppendToSummary;
            AfterOtherFixes = findAndReplace.AfterOtherFixes;
            Replacements    = findAndReplace.GetList();
            AdvancedReps    = replaceSpecial.GetRules();

            SubstTemplates    = mSubstTemplates;
            IncludeComments   = mIncludeComments;
            ExpandRecursively = mExpandRecursively;
            IgnoreUnformatted = mIgnoreUnformatted;
        }
Beispiel #2
0
        /// <summary>
        /// Process a "find and replace"
        /// </summary>
        /// <param name="findAndReplace">A FindandReplace object</param>
        /// <param name="substTemplates">A SubstTemplates object</param>
        /// <param name="replaceSpecial">An MWB ReplaceSpecial object</param>
        /// <param name="SkipIfNoChange">True if the article should be skipped if no changes are made</param>
        public void PerformFindAndReplace(FindandReplace findAndReplace, SubstTemplates substTemplates,
                                          WikiFunctions.MWB.ReplaceSpecial replaceSpecial, bool SkipIfNoChange)
        {
            string strTemp = mArticleText.Replace("\r\n", "\n"),
                   testText = strTemp, tmpEditSummary = "";

            strTemp = findAndReplace.MultipleFindAndReplace(strTemp, mName, ref tmpEditSummary);
            strTemp = replaceSpecial.ApplyRules(strTemp, mName);
            strTemp = substTemplates.SubstituteTemplates(strTemp, mName); // TODO: Possible bug, this was "articleTitle" not "Name"

            if (SkipIfNoChange && (testText == strTemp))                  // NoChange
            {
                Trace.AWBSkipped("No Find And Replace Changes");
            }
            else
            {
                this.AWBChangeArticleText("Find and replace applied" + tmpEditSummary,
                                          strTemp.Replace("\n", "\r\n"), false);
                EditSummary += tmpEditSummary;
            }
        }