/// <summary> /// Add or remove a specified category /// </summary> /// <param name="option">The action to take</param> /// <param name="parsers">An initialised Parsers object</param> /// <param name="SkipIfNoChange">True if the article should be skipped if no changes are made</param> /// <param name="NewCategoryText">The category to add or remove</param> public void Categorisation(CategorisationOptions option, Parsers parsers, bool SkipIfNoChange, string NewCategoryText) { if (option == CategorisationOptions.ReCat) { throw new ArgumentException("This overload has no CategoryText2 argument"); } Categorisation(option, parsers, SkipIfNoChange, NewCategoryText, ""); }
/// <summary> /// Add, remove or replace a specified category /// </summary> /// <param name="option">The action to take</param> /// <param name="parsers">An initialised Parsers object</param> /// <param name="SkipIfNoChange">True if the article should be skipped if no changes are made</param> /// <param name="CategoryText">The category to add or remove; or, when replacing, the name of the old category</param> /// <param name="CategoryText2">The name of the replacement category (recat mode only)</param> public void Categorisation(CategorisationOptions option, Parsers parsers, bool SkipIfNoChange, string CategoryText, string CategoryText2) { bool noChange = false; string strTemp, action = ""; switch (option) { case CategorisationOptions.NoAction: return; case CategorisationOptions.AddCat: if (CategoryText.Length < 1) { return; } strTemp = parsers.AddCategory(CategoryText, mArticleText, mName); action = "Added " + CategoryText; break; case CategorisationOptions.ReCat: if (CategoryText.Length < 1 || CategoryText2.Length < 1) { return; } strTemp = parsers.ReCategoriser(CategoryText, CategoryText2, mArticleText, out noChange); break; case CategorisationOptions.RemoveCat: if (CategoryText.Length < 1) { return; } strTemp = parsers.RemoveCategory(CategoryText, mArticleText, out noChange); action = "Removed " + CategoryText; break; default: throw new ArgumentOutOfRangeException("option"); } if (noChange && SkipIfNoChange) { Trace.AWBSkipped("No Category Changed"); } else if (!noChange) { AWBChangeArticleText(action, strTemp, false); } }