Example #1
0
 /*
  * public void RemoveLogAdjuster(LogAdjuster logAdjuster)
  * {
  *  string fileName = logAdjuster.LogFileName.ToUpperInvariant();
  *  if (!this.logAdjusters.ContainsKey(fileName))
  *      throw new ArgumentException(string.Format("LogAdjuster for Log File: '{0}' is not in this collection.", fileName));
  *
  *  this.logAdjusters.Remove(fileName);
  * }
  */
 protected override void LoadData(XElement xmlElement)
 {
     this.logAdjusters = GetDictionary <string, LogAdjuster>(delegate(XElement element)
     {
         LogAdjuster adjuster = LogAdjuster.GetInstance(element);
         return(new KeyValuePair <string, LogAdjuster>(adjuster.LogFileName.ToUpperInvariant(), adjuster));
     },
                                                             xmlElement, "LogAdjusters");
 }
Example #2
0
        public void AddLogAdjuster(LogAdjuster logAdjuster)
        {
            if (String.IsNullOrEmpty(logAdjuster.LogFileName))
            {
                throw new InvalidOperationException("LogFileName in logAdjuster can't be null or empty.");
            }

            string fileName = logAdjuster.LogFileName.ToUpperInvariant();

            if (this.logAdjusters.ContainsKey(fileName))
            {
                throw new ArgumentException(string.Format("LogAdjuster for Log File: '{0}' is already in this collection.", fileName));
            }

            this.logAdjusters.Add(fileName, logAdjuster);
        }