public static bool ProcessTalkPage(ref string articleText, IMyTraceListener trace, 
 DEFAULTSORT moveDEFAULTSORT, string pluginName)
 {
     Processor pr = new Processor();
     articleText = TalkHeaderTemplateRegex.Replace(articleText, 
         new MatchEvaluator(pr.TalkHeaderMatchEvaluator),
         1);
     articleText = SkipTOCTemplateRegex.Replace(articleText, new MatchEvaluator(pr.SkipTOCMatchEvaluator), 1);
     if (pr.FoundTalkHeader)
         WriteHeaderTemplate("talkheader", ref articleText, trace, pluginName);
     if (pr.FoundSkipTOC)
         WriteHeaderTemplate("skiptotoctalk", ref articleText, trace, pluginName);
     if (moveDEFAULTSORT != DEFAULTSORT.NoChange)
     {
         articleText = WikiRegexes.Defaultsort.Replace(articleText, 
             new MatchEvaluator(pr.DefaultSortMatchEvaluator), 1);
         if (pr.FoundDefaultSort)
         {
             if (string.IsNullOrEmpty(pr.DefaultSortKey))
             {
                 if (trace != null)
                     trace.WriteArticleActionLine("DEFAULTSORT has no key; removed", pluginName);
             }
             else
             {
                 articleText = SetDefaultSort(pr.DefaultSortKey, moveDEFAULTSORT, trace, pluginName, articleText);
             }
         }
     }
     return pr.FoundTalkHeader || pr.FoundSkipTOC || pr.FoundDefaultSort;
 }
 public static bool ProcessTalkPage(ref string ArticleText, IMyTraceListener Trace, 
 DEFAULTSORT MoveDEFAULTSORT, string PluginName)
 {
     FoundTalkheader = false; FoundSkipTOC = false; FoundDefaultSort = false;
     ArticleText = TalkheaderTemplateRegex.Replace(ArticleText, new MatchEvaluator(TalkheaderMatchEvaluator), 1);
     ArticleText = SkipTOCTemplateRegex.Replace(ArticleText, new MatchEvaluator(SkipTOCMatchEvaluator), 1);
     if (FoundTalkheader)
         WriteHeaderTemplate("talkheader", ref ArticleText, Trace, PluginName);
     if (FoundSkipTOC)
         WriteHeaderTemplate("skiptotoctalk", ref ArticleText, Trace, PluginName);
     if (MoveDEFAULTSORT != DEFAULTSORT.NoChange)
     {
         ArticleText = WikiRegexes.Defaultsort.Replace(ArticleText, 
             new MatchEvaluator(DefaultSortMatchEvaluator), 1);
         if (FoundDefaultSort)
         {
             if (string.IsNullOrEmpty(DefaultSortKey))
             {
                 if (Trace != null)
                     Trace.WriteArticleActionLine("DEFAULTSORT has no key; removed", PluginName);
             }
             else
             {
                 WriteDefaultSortMagicWord(MoveDEFAULTSORT, Trace, PluginName, ref ArticleText);
             }
         }
         DefaultSortKey = "";
     }
     return (FoundTalkheader || FoundSkipTOC) || FoundDefaultSort;
 }
Beispiel #3
0
 /// <summary>
 /// Override this if you want to programatically add an event handler
 /// </summary>
 /// <param name="key"></param>
 /// <param name="listener"></param>
 public virtual void AddListener(string key, IMyTraceListener listener)
 {
     if (!Listeners.ContainsKey(key))
     {
         Listeners.Add(key, listener);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Override this if you want to programatically add an event handler
 /// </summary>
 /// <param name="key"></param>
 /// <param name="listener"></param>
 public virtual void AddListener(string key, IMyTraceListener listener)
 {
     if (!Listeners.ContainsKey(key))
     {
         Listeners.Add(key, listener);
     }
 }
Beispiel #5
0
 private static void WriteHeaderTemplate(string name, ref string articleText, IMyTraceListener trace, string pluginName)
 {
     articleText = "{{" + name + "}}\r\n" + articleText;
     if (trace != null)
     {
         trace.WriteArticleActionLine("{{tl|" + name + "}} given top billing", pluginName, false);
     }
 }
 private static void WriteHeaderTemplate(string Name, ref string ArticleText, IMyTraceListener Trace, string PluginName)
 {
     ArticleText = "{{" + Name + "}}\r\n" + ArticleText;
     if (Trace != null)
     {
         Trace.WriteArticleActionLine("{{tl|" + Name + "}} given top billing", PluginName, false);
     }
 }
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
        }
Beispiel #8
0
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
        }
Beispiel #9
0
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload += TraceUploadEventHandler;
            }
        }
Beispiel #10
0
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (base.ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload +=
                    new WikiFunctions.Logging.TraceListenerUploadableBase.UploadEventHandler(
                        this.TraceUploadEventHandler);
            }
        }
Beispiel #11
0
        public override void RemoveListener(string key)
        {
            if (!Listeners.ContainsKey(key))
            {
                return;
            }
            IMyTraceListener listener = Listeners[key];

            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload -= TraceUploadEventHandler;
            }

            base.RemoveListener(key);
        }
Beispiel #12
0
        public override void RemoveListener(string key)
        {
            if (!Listeners.ContainsKey(key))
            {
                return;
            }
            IMyTraceListener listener = Listeners[key];

            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload -=
                    new WikiFunctions.Logging.TraceListenerUploadableBase.UploadEventHandler(
                        this.TraceUploadEventHandler);
            }

            base.RemoveListener(key);
        }
        // Helper routines:
        private static void WriteDefaultSortMagicWord(DEFAULTSORT Location, IMyTraceListener Trace, string PluginName, ref string ArticleText)
        {
            string strMovedTo;

            if (Location == DEFAULTSORT.MoveToTop)
            {
                ArticleText = "{{DEFAULTSORT:" + DefaultSortKey + "}}\r\n" + ArticleText;
                strMovedTo  = " given top billing";
            }
            else
            {
                ArticleText = ArticleText + "\r\n{{DEFAULTSORT:" + DefaultSortKey + "}}";
                strMovedTo  = " sent to the bottom";
            }
            if (Trace != null)
            {
                Trace.WriteArticleActionLine("DEFAULTSORT" + strMovedTo, PluginName, false);
            }
        }
Beispiel #14
0
        // Helper routines:
        private static string SetDefaultSort(string key, DEFAULTSORT location, IMyTraceListener trace, string pluginName, string articleText)
        {
            string strMovedTo;

            if (location == DEFAULTSORT.MoveToTop)
            {
                articleText = "{{DEFAULTSORT:" + key + "}}\r\n" + articleText;
                strMovedTo  = " given top billing";
            }
            else
            {
                articleText = articleText + "\r\n{{DEFAULTSORT:" + key + "}}";
                strMovedTo  = " sent to the bottom";
            }
            if (trace != null)
            {
                trace.WriteArticleActionLine("DEFAULTSORT" + strMovedTo, pluginName, false);
            }

            return(articleText);
        }
 public static bool ProcessTalkPage(ref string ArticleText, IMyTraceListener Trace,
                                    DEFAULTSORT MoveDEFAULTSORT, string PluginName)
 {
     FoundTalkheader = false; FoundSkipTOC = false; FoundDefaultSort = false;
     ArticleText     = TalkheaderTemplateRegex.Replace(ArticleText, new MatchEvaluator(TalkheaderMatchEvaluator), 1);
     ArticleText     = SkipTOCTemplateRegex.Replace(ArticleText, new MatchEvaluator(SkipTOCMatchEvaluator), 1);
     if (FoundTalkheader)
     {
         WriteHeaderTemplate("talkheader", ref ArticleText, Trace, PluginName);
     }
     if (FoundSkipTOC)
     {
         WriteHeaderTemplate("skiptotoctalk", ref ArticleText, Trace, PluginName);
     }
     if (MoveDEFAULTSORT != DEFAULTSORT.NoChange)
     {
         ArticleText = WikiRegexes.Defaultsort.Replace(ArticleText,
                                                       new MatchEvaluator(DefaultSortMatchEvaluator), 1);
         if (FoundDefaultSort)
         {
             if (string.IsNullOrEmpty(DefaultSortKey))
             {
                 if (Trace != null)
                 {
                     Trace.WriteArticleActionLine("DEFAULTSORT has no key; removed", PluginName);
                 }
             }
             else
             {
                 WriteDefaultSortMagicWord(MoveDEFAULTSORT, Trace, PluginName, ref ArticleText);
             }
         }
         DefaultSortKey = "";
     }
     if ((!FoundTalkheader && !FoundSkipTOC) && !FoundDefaultSort)
     {
         return(false);
     }
     return(true);
 }
Beispiel #16
0
        public static bool ProcessTalkPage(ref string articleText, IMyTraceListener trace,
                                           DEFAULTSORT moveDEFAULTSORT, string pluginName)
        {
            Processor pr = new Processor();

            articleText = TalkHeaderTemplateRegex.Replace(articleText,
                                                          new MatchEvaluator(pr.TalkHeaderMatchEvaluator),
                                                          1);
            articleText = SkipTOCTemplateRegex.Replace(articleText, new MatchEvaluator(pr.SkipTOCMatchEvaluator), 1);
            if (pr.FoundTalkHeader)
            {
                WriteHeaderTemplate("talkheader", ref articleText, trace, pluginName);
            }
            if (pr.FoundSkipTOC)
            {
                WriteHeaderTemplate("skiptotoctalk", ref articleText, trace, pluginName);
            }
            if (moveDEFAULTSORT != DEFAULTSORT.NoChange)
            {
                articleText = WikiRegexes.Defaultsort.Replace(articleText,
                                                              new MatchEvaluator(pr.DefaultSortMatchEvaluator), 1);
                if (pr.FoundDefaultSort)
                {
                    if (string.IsNullOrEmpty(pr.DefaultSortKey))
                    {
                        if (trace != null)
                        {
                            trace.WriteArticleActionLine("DEFAULTSORT has no key; removed", pluginName);
                        }
                    }
                    else
                    {
                        articleText = SetDefaultSort(pr.DefaultSortKey, moveDEFAULTSORT, trace, pluginName, articleText);
                    }
                }
            }
            return(pr.FoundTalkHeader || pr.FoundSkipTOC || pr.FoundDefaultSort);
        }
Beispiel #17
0
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (base.ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload += 
                    new WikiFunctions.Logging.TraceListenerUploadableBase.UploadEventHandler(
                    this.TraceUploadEventHandler);
            }
        }
Beispiel #18
0
 protected bool TryGetValue(string key, out IMyTraceListener listener)
 {
     return(Listeners.TryGetValue(key, out listener));
 }
Beispiel #19
0
        // Overrides:
        public override void AddListener(string key, IMyTraceListener listener)
        {
            if (ContainsKey(key))
            {
                base.RemoveListener(key);
            }

            base.AddListener(key, listener);
            if (listener.Uploadable)
            {
                ((TraceListenerUploadableBase)listener).Upload += TraceUploadEventHandler;
            }
        }
		public bool ContainsValue(IMyTraceListener listener)
		{
			return Listeners.ContainsValue(listener);
		}
	    protected bool TryGetValue(string key, out IMyTraceListener listener)
		{
			return Listeners.TryGetValue(key, out listener);
		}
        /// <summary>
        /// Override this if you want to programatically add an event handler
        /// </summary>
        /// <param name="key"></param>
        /// <param name="listener"></param>
		public virtual void AddListener(string key, IMyTraceListener listener)
		{
			Listeners.Add(key, listener);
		}
Beispiel #23
0
 public bool ContainsValue(IMyTraceListener listener)
 {
     return(Listeners.ContainsValue(listener));
 }
		public virtual void AddListener(string Key, IMyTraceListener Listener)
		{
			// Override this if you want to programatically add an event handler
			Listeners.Add(Key, Listener);
		}
 private static void WriteHeaderTemplate(string Name, ref string ArticleText, IMyTraceListener Trace, string PluginName)
 {
     ArticleText = "{{" + Name + "}}\r\n" + ArticleText;
     if (Trace != null)
         Trace.WriteArticleActionLine("{{tl|" + Name + "}} given top billing", PluginName, false);
 }
        // Helper routines:
        private static string SetDefaultSort(string key, DEFAULTSORT Location, IMyTraceListener Trace, string PluginName, string ArticleText)
        {
            string strMovedTo;
            if (Location == DEFAULTSORT.MoveToTop)
            {
                ArticleText = "{{DEFAULTSORT:" + key + "}}\r\n" + ArticleText;
                strMovedTo = " given top billing";
            }
            else
            {
                ArticleText = ArticleText + "\r\n{{DEFAULTSORT:" + key + "}}";
                strMovedTo = " sent to the bottom";
            }
            if (Trace != null)
                Trace.WriteArticleActionLine("DEFAULTSORT" + strMovedTo, PluginName, false);

            return ArticleText;
        }
 private static void WriteHeaderTemplate(string name, ref string articleText, IMyTraceListener trace, string pluginName)
 {
     articleText = "{{" + name + "}}\r\n" + articleText;
     if (trace != null)
         trace.WriteArticleActionLine("{{tl|" + name + "}} given top billing", pluginName, false);
 }
Beispiel #28
0
 public virtual void AddListener(string Key, IMyTraceListener Listener)
 {
     // Override this if you want to programatically add an event handler
     Listeners.Add(Key, Listener);
 }
 /// <summary>
 /// Override this if you want to programatically add an event handler
 /// </summary>
 /// <param name="key"></param>
 /// <param name="listener"></param>
 public virtual void AddListener(string key, IMyTraceListener listener)
 {
     Listeners.Add(key, listener);
 }