예제 #1
0
        /// <summary>
        /// Create the <see cref="PatternParser"/> used to parse the pattern
        /// </summary>
        /// <param name="pattern">the pattern to parse</param>
        /// <returns>The <see cref="PatternParser"/></returns>
        /// <remarks>
        /// <para>
        /// Returns PatternParser used to parse the conversion string. Subclasses
        /// may override this to return a subclass of PatternParser which recognize
        /// custom conversion pattern name.
        /// </para>
        /// </remarks>
        private PatternParser CreatePatternParser(string pattern)
        {
            PatternParser patternParser = new PatternParser(pattern);

            // Add all the builtin patterns
            foreach (DictionaryEntry entry in s_globalRulesRegistry)
            {
                patternParser.PatternConverters.Add(entry.Key, entry.Value);
            }
            // Add the instance patterns
            foreach (DictionaryEntry entry in m_instanceRulesRegistry)
            {
                patternParser.PatternConverters[entry.Key] = entry.Value;
            }

            return(patternParser);
        }
예제 #2
0
        /// <summary>
        /// Create the <see cref="T:log4net.Util.PatternParser" /> used to parse the pattern
        /// </summary>
        /// <param name="pattern">the pattern to parse</param>
        /// <returns>The <see cref="T:log4net.Util.PatternParser" /></returns>
        /// <remarks>
        /// <para>
        /// Returns PatternParser used to parse the conversion string. Subclasses
        /// may override this to return a subclass of PatternParser which recognize
        /// custom conversion pattern name.
        /// </para>
        /// </remarks>
        private PatternParser CreatePatternParser(string pattern)
        {
            PatternParser patternParser = new PatternParser(pattern);

            foreach (DictionaryEntry item in s_globalRulesRegistry)
            {
                ConverterInfo converterInfo = new ConverterInfo();
                converterInfo.Name = (string)item.Key;
                converterInfo.Type = (Type)item.Value;
                patternParser.PatternConverters.Add(item.Key, converterInfo);
            }
            foreach (DictionaryEntry item2 in m_instanceRulesRegistry)
            {
                patternParser.PatternConverters[item2.Key] = item2.Value;
            }
            return(patternParser);
        }
예제 #3
0
        private PatternParser CreatePatternParser(string pattern)
        {
            PatternParser         parser     = new PatternParser(pattern);
            IDictionaryEnumerator enumerator = s_globalRulesRegistry.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    DictionaryEntry current = (DictionaryEntry)enumerator.Current;
                    ConverterInfo   info    = new ConverterInfo {
                        Name = (string)current.Key,
                        Type = (Type)current.Value
                    };
                    parser.PatternConverters.Add(current.Key, info);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            IDictionaryEnumerator enumerator2 = this.m_instanceRulesRegistry.GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    DictionaryEntry current = (DictionaryEntry)enumerator2.Current;
                    parser.PatternConverters[current.Key] = current.Value;
                }
            }
            finally
            {
                IDisposable disposable2 = enumerator2 as IDisposable;
                if (disposable2 != null)
                {
                    disposable2.Dispose();
                }
            }
            return(parser);
        }
예제 #4
0
        /// <summary>
        /// Create the <see cref="PatternParser"/> used to parse the pattern
        /// </summary>
        /// <param name="pattern">the pattern to parse</param>
        /// <returns>The <see cref="PatternParser"/></returns>
        /// <remarks>
        /// <para>
        /// Returns PatternParser used to parse the conversion string. Subclasses
        /// may override this to return a subclass of PatternParser which recognize
        /// custom conversion pattern name.
        /// </para>
        /// </remarks>
        private PatternParser CreatePatternParser(string pattern)
        {
            PatternParser patternParser = new PatternParser(pattern);

            // Add all the builtin patterns
            foreach (DictionaryEntry entry in s_globalRulesRegistry)
            {
                ConverterInfo converterInfo = new ConverterInfo();
                converterInfo.Name = (string)entry.Key;
                converterInfo.Type = (Type)entry.Value;
                patternParser.PatternConverters.Add(entry.Key, converterInfo);
            }
            // Add the instance patterns
            foreach (DictionaryEntry entry in m_instanceRulesRegistry)
            {
                patternParser.PatternConverters[entry.Key] = entry.Value;
            }

            return(patternParser);
        }
예제 #5
0
        /// <summary>
        /// Create the pattern parser instance
        /// </summary>
        /// <param name="pattern">the pattern to parse</param>
        /// <returns>The <see cref="PatternParser"/> that will format the event</returns>
        /// <remarks>
        /// <para>
        /// Creates the <see cref="PatternParser"/> used to parse the conversion string. Sets the
        /// global and instance rules on the <see cref="PatternParser"/>.
        /// </para>
        /// </remarks>
        protected virtual PatternParser CreatePatternParser(string pattern)
        {
            var patternParser = new PatternParser(pattern);

            // Add all the builtin patterns
            foreach (DictionaryEntry entry in s_globalRulesRegistry)
            {
                patternParser.PatternConverters[entry.Key] = entry.Value;
            }
            // Add the instance patterns
            foreach (DictionaryEntry entry in m_instanceRulesRegistry)
            {
                patternParser.PatternConverters[entry.Key] = entry.Value;
            }

            return patternParser;
        }
예제 #6
0
		/// <summary>
		/// Create the pattern parser instance
		/// </summary>
		/// <param name="pattern">the pattern to parse</param>
		/// <returns>The <see cref="PatternParser"/> that will format the event</returns>
		/// <remarks>
		/// <para>
		/// Creates the <see cref="PatternParser"/> used to parse the conversion string. Sets the
		/// global and instance rules on the <see cref="PatternParser"/>.
		/// </para>
		/// </remarks>
		virtual protected PatternParser CreatePatternParser(string pattern) 
		{
			PatternParser patternParser = new PatternParser(pattern);

			// Add all the builtin patterns
			foreach(DictionaryEntry entry in s_globalRulesRegistry)
			{
                ConverterInfo converterInfo = new ConverterInfo();
                converterInfo.Name = (string)entry.Key;
                converterInfo.Type = (Type)entry.Value;
                patternParser.PatternConverters[entry.Key] = converterInfo;
			}
			// Add the instance patterns
			foreach(DictionaryEntry entry in m_instanceRulesRegistry)
			{
				patternParser.PatternConverters[entry.Key] = entry.Value;
			}

			return patternParser;
		}
예제 #7
0
 /// <summary>   
 /// ��Hashtable�е�ֵ����ת��   
 /// </summary>   
 /// <param name="pattern"></param>   
 /// <returns></returns>   
 protected virtual PatternParser CreatePatternParser(string pattern)
 {
     PatternParser patternParser = new PatternParser(pattern);
     foreach (DictionaryEntry entry in s_globalRulesRegistry)
     {
         patternParser.PatternConverters[entry.Key] = entry.Value;
     }
     foreach (DictionaryEntry entry in m_instanceRulesRegistry)
     {
         patternParser.PatternConverters[entry.Key] = entry.Value;
     }
     return patternParser;
 }