User:KitanBot/Completed Tasks/Elinks-Quest

Task
There was a Bot Request to deprecate for elinks-quest. After some discussion on IRC it was determined that would not be used but that == External links ==  would be used.

Issues

 * Bot Connection Issue -- The first run the bot had a connection issue after 80 updates. Changed the connection limit and restarted the bot.
 * Data Issue -- After checking ~50 updates the only issue was in the case that someone had put which the bot replaced with,

Algorithm
namespace WikiUpdateAlgorithmElinksQuest {   public class WikiUpdateAlgorithmElinksQuest : IWikiUpdaterAlgorithm {       public string UpdateWiki(string CurrentWiki) {           //Objects Required string SearchWiki = CurrentWiki.ToLower; StringBuilder Current = new StringBuilder(CurrentWiki); Dictionary Replacements = new Dictionary;

//Primatives string Template = "{{elinksquest"; int Position; int EndPosition; bool Continue; int StartQuestNumPos; int EndQuestNumPos; string QuestNum;

Position = 0; Continue = true;

while (Continue) {               Position = SearchWiki.IndexOf(Template, Position); EndPosition = 0; if (Position >= 0) {                   EndPosition = SearchWiki.IndexOf("}}", Position);

if (EndPosition > 0) {                       StartQuestNumPos = SearchWiki.IndexOf("|", Position);

if (SearchWiki.IndexOf("|", StartQuestNumPos + 1) < SearchWiki.IndexOf("}}", StartQuestNumPos)) {                           QuestNum = SearchWiki.Substring(StartQuestNumPos + 1, SearchWiki.IndexOf("|", StartQuestNumPos + 1) - StartQuestNumPos - 1); }                       else {                           QuestNum = SearchWiki.Substring(StartQuestNumPos + 1, SearchWiki.IndexOf("}}", StartQuestNumPos) - StartQuestNumPos - 1); }

Replacements.Add(CurrentWiki.Substring(Position, EndPosition + 2 - Position), "== External links ==\n");

}                   Position = EndPosition; }               else {                   Continue = false; }           }

foreach (KeyValuePair Replacement in Replacements) {               Current.Replace(Replacement.Key, Replacement.Value); }

return Current.ToString; }       ///         /// Summary of the update ///        /// String public string UpdateSummary {           return "Updates pages from  to ."; }   } }