亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? patternparser.cs

?? 詳細講述了數據庫編程
?? CS
字號:
#region Copyright & License
//
// Copyright 2001-2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;

using log4net.Layout;
using log4net.Core;
using log4net.DateFormatter;
using log4net.Util;

namespace log4net.Util
{
	/// <summary>
	/// Most of the work of the <see cref="PatternLayout"/> class
	/// is delegated to the PatternParser class.
	/// </summary>
	/// <remarks>
	/// <para>
	/// The <c>PatternParser</c> processes a pattern string and
	/// returns a chain of <see cref="PatternConverter"/> objects.
	/// </para>
	/// </remarks>
	/// <author>Nicko Cadell</author>
	/// <author>Gert Driesen</author>
	public sealed class PatternParser
	{
		#region Public Instance Constructors

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="pattern">The pattern to parse.</param>
		/// <remarks>
		/// <para>
		/// Initializes a new instance of the <see cref="PatternParser" /> class 
		/// with the specified pattern string.
		/// </para>
		/// </remarks>
		public PatternParser(string pattern) 
		{
			m_pattern = pattern;
		}

		#endregion Public Instance Constructors

		#region Public Instance Methods

		/// <summary>
		/// Parses the pattern into a chain of pattern converters.
		/// </summary>
		/// <returns>The head of a chain of pattern converters.</returns>
		/// <remarks>
		/// <para>
		/// Parses the pattern into a chain of pattern converters.
		/// </para>
		/// </remarks>
		public PatternConverter Parse()
		{
			string[] converterNamesCache = BuildCache();

			ParseInternal(m_pattern, converterNamesCache);

			return m_head;
		}

		#endregion Public Instance Methods

		#region Public Instance Properties

		/// <summary>
		/// Get the converter registry used by this parser
		/// </summary>
		/// <value>
		/// The converter registry used by this parser
		/// </value>
		/// <remarks>
		/// <para>
		/// Get the converter registry used by this parser
		/// </para>
		/// </remarks>
		public Hashtable PatternConverters
		{
			get { return m_patternConverters; }
		}

		#endregion Public Instance Properties

		#region Protected Instance Methods

		/// <summary>
		/// Build the unified cache of converters from the static and instance maps
		/// </summary>
		/// <returns>the list of all the converter names</returns>
		/// <remarks>
		/// <para>
		/// Build the unified cache of converters from the static and instance maps
		/// </para>
		/// </remarks>
		private string[] BuildCache()
		{
			string[] converterNamesCache = new string[m_patternConverters.Keys.Count];
			m_patternConverters.Keys.CopyTo(converterNamesCache, 0);

			// sort array so that longer strings come first
			Array.Sort(converterNamesCache, 0, converterNamesCache.Length, StringLengthComparer.Instance);

			return converterNamesCache;
		}

		#region StringLengthComparer

		/// <summary>
		/// Sort strings by length
		/// </summary>
		/// <remarks>
		/// <para>
		/// <see cref="IComparer" /> that orders strings by string length.
		/// The longest strings are placed first
		/// </para>
		/// </remarks>
		private sealed class StringLengthComparer : IComparer
		{
			public static readonly StringLengthComparer Instance = new StringLengthComparer();

			private StringLengthComparer()
			{
			}

			#region Implementation of IComparer

			public int Compare(object x, object y)
			{
				string s1 = x as string;
				string s2 = y as string;

				if (s1 == null && s2 == null)
				{
					return 0;
				}
				if (s1 == null)
				{
					return 1;
				}
				if (s2 == null)
				{
					return -1;
				}

				return s2.Length.CompareTo(s1.Length);
			}
		
			#endregion
		}

		#endregion // StringLengthComparer

		/// <summary>
		/// Internal method to parse the specified pattern to find specified matches
		/// </summary>
		/// <param name="pattern">the pattern to parse</param>
		/// <param name="matches">the converter names to match in the pattern</param>
		/// <remarks>
		/// <para>
		/// The matches param must be sorted such that longer strings come before shorter ones.
		/// </para>
		/// </remarks>
		private void ParseInternal(string pattern, string[] matches)
		{
			int offset = 0;
			while(offset < pattern.Length)
			{
				int i = pattern.IndexOf('%', offset);
				if (i < 0 || i == pattern.Length - 1)
				{
					ProcessLiteral(pattern.Substring(offset));
					offset = pattern.Length;
				}
				else
				{
					if (pattern[i+1] == '%')
					{
						// Escaped
						ProcessLiteral(pattern.Substring(offset, i - offset + 1));
						offset = i + 2;
					}
					else
					{
						ProcessLiteral(pattern.Substring(offset, i - offset));
						offset = i + 1;

						FormattingInfo formattingInfo = new FormattingInfo();

						// Process formatting options

						// Look for the align flag
						if (offset < pattern.Length)
						{
							if (pattern[offset] == '-')
							{
								// Seen align flag
								formattingInfo.LeftAlign = true;
								offset++;
							}
						}
						// Look for the minimum length
						while (offset < pattern.Length && char.IsDigit(pattern[offset]))
						{
							// Seen digit
							if (formattingInfo.Min < 0)
							{
								formattingInfo.Min = 0;
							}
							formattingInfo.Min = (formattingInfo.Min * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo);
							offset++;
						}
						// Look for the separator between min and max
						if (offset < pattern.Length)
						{
							if (pattern[offset] == '.')
							{
								// Seen separator
								offset++;
							}
						}
						// Look for the maximum length
						while (offset < pattern.Length && char.IsDigit(pattern[offset]))
						{
							// Seen digit
							if (formattingInfo.Max == int.MaxValue)
							{
								formattingInfo.Max = 0;
							}
							formattingInfo.Max = (formattingInfo.Max * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo);
							offset++;
						}

						int remainingStringLength = pattern.Length - offset;

						// Look for pattern
						for(int m=0; m<matches.Length; m++)
						{
							if (matches[m].Length <= remainingStringLength)
							{
								if (String.Compare(pattern, offset, matches[m], 0, matches[m].Length, false, System.Globalization.CultureInfo.InvariantCulture) == 0)
								{
									// Found match
									offset = offset + matches[m].Length;

									string option = null;

									// Look for option
									if (offset < pattern.Length)
									{
										if (pattern[offset] == '{')
										{
											// Seen option start
											offset++;
											
											int optEnd = pattern.IndexOf('}', offset);
											if (optEnd < 0)
											{
												// error
											}
											else
											{
												option = pattern.Substring(offset, optEnd - offset);
												offset = optEnd + 1;
											}
										}
									}

									ProcessConverter(matches[m], option, formattingInfo);
									break;
								}
							}
						}
					}
				}
			}
		}

		/// <summary>
		/// Process a parsed literal
		/// </summary>
		/// <param name="text">the literal text</param>
		private void ProcessLiteral(string text)
		{
			if (text.Length > 0)
			{
				// Convert into a pattern
				ProcessConverter("literal", text, new FormattingInfo());
			}
		}

		/// <summary>
		/// Process a parsed converter pattern
		/// </summary>
		/// <param name="converterName">the name of the converter</param>
		/// <param name="option">the optional option for the converter</param>
		/// <param name="formattingInfo">the formatting info for the converter</param>
		private void ProcessConverter(string converterName, string option, FormattingInfo formattingInfo)
		{
			LogLog.Debug("PatternParser: Converter ["+converterName+"] Option ["+option+"] Format [min="+formattingInfo.Min+",max="+formattingInfo.Max+",leftAlign="+formattingInfo.LeftAlign+"]");

			// Lookup the converter type
			Type converterType = (Type)m_patternConverters[converterName];
			if (converterType == null)
			{
				LogLog.Error("PatternParser: Unknown converter name ["+converterName+"] in conversion pattern.");
			}
			else
			{
				// Create the pattern converter
				PatternConverter pc = null;
				try
				{
					pc = (PatternConverter)Activator.CreateInstance(converterType);
				}
				catch(Exception createInstanceEx)
				{
					LogLog.Error("PatternParser: Failed to create instance of Type ["+converterType.FullName+"] using default constructor. Exception: "+createInstanceEx.ToString());
				}

				// formattingInfo variable is an instance variable, occasionally reset 
				// and used over and over again
				pc.FormattingInfo = formattingInfo;
				pc.Option = option;

				IOptionHandler optionHandler = pc as IOptionHandler;
				if (optionHandler != null)
				{
					optionHandler.ActivateOptions();
				}

				AddConverter(pc);
			}
		}

		/// <summary>
		/// Resets the internal state of the parser and adds the specified pattern converter 
		/// to the chain.
		/// </summary>
		/// <param name="pc">The pattern converter to add.</param>
		private void AddConverter(PatternConverter pc) 
		{
			// Add the pattern converter to the list.

			if (m_head == null) 
			{
				m_head = m_tail = pc;
			}
			else 
			{
				// Set the next converter on the tail
				// Update the tail reference
				// note that a converter may combine the 'next' into itself
				// and therefore the tail would not change!
				m_tail = m_tail.SetNext(pc);
			}
		}

		#endregion Protected Instance Methods

		#region Private Constants

		private const char ESCAPE_CHAR = '%';
  
		#endregion Private Constants

		#region Private Instance Fields

		/// <summary>
		/// The first pattern converter in the chain
		/// </summary>
		private PatternConverter m_head;

		/// <summary>
		///  the last pattern converter in the chain
		/// </summary>
		private PatternConverter m_tail;

		/// <summary>
		/// The pattern
		/// </summary>
		private string m_pattern;

		/// <summary>
		/// Internal map of converter identifiers to converter types
		/// </summary>
		/// <remarks>
		/// <para>
		/// This map overrides the static s_globalRulesRegistry map.
		/// </para>
		/// </remarks>
		private Hashtable m_patternConverters = new Hashtable();

		#endregion Private Instance Fields
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲毛片av在线| 欧美不卡在线视频| 国产激情视频一区二区在线观看 | 日日噜噜夜夜狠狠视频欧美人| 国产色综合久久| 久久久久久综合| 精品对白一区国产伦| 久久精品亚洲精品国产欧美kt∨| 日韩一区二区三区免费看| 日韩一区二区免费高清| 欧美tickle裸体挠脚心vk| 久久在线免费观看| 欧美国产禁国产网站cc| 亚洲区小说区图片区qvod| 亚洲福利视频一区二区| 裸体一区二区三区| 成人午夜免费av| 日本丶国产丶欧美色综合| 欧美美女一区二区三区| 日韩免费成人网| 国产精品免费人成网站| 一区二区三区中文字幕| 免费在线一区观看| 国产成人精品在线看| 91视频精品在这里| 91精品国产麻豆| 国产日韩欧美在线一区| 一区二区在线看| 久久99精品久久久| 99视频在线观看一区三区| 欧美日韩一区三区四区| 久久久久久夜精品精品免费| 日韩美女视频一区二区| 免费看黄色91| 99re这里都是精品| 精品久久久久99| 一区二区在线观看视频在线观看| 蜜桃视频一区二区三区| www.欧美日韩| 日韩免费看的电影| 一区二区三区不卡视频| 国产乱码字幕精品高清av| 欧美日韩精品福利| 国产欧美一区二区精品婷婷| 午夜影院在线观看欧美| www.亚洲在线| 久久蜜桃一区二区| 日本91福利区| 色婷婷国产精品久久包臀| 久久免费精品国产久精品久久久久| 亚洲国产精品精华液网站| 成人手机在线视频| 精品国一区二区三区| 亚洲chinese男男1069| av不卡免费在线观看| 精品卡一卡二卡三卡四在线| 亚洲一区二区三区影院| 成人黄色在线网站| 国产性色一区二区| 九九久久精品视频| 91精品国产综合久久久久久漫画| 亚洲一区二区三区四区不卡| 成人久久18免费网站麻豆| 26uuu亚洲综合色欧美| 六月丁香婷婷久久| 91精品在线免费观看| 一区二区三区欧美视频| 色吊一区二区三区| 亚洲免费观看高清| 91影视在线播放| 国产精品久久久久久久久免费桃花| 精品一区二区综合| www激情久久| 国产一区不卡在线| 国产欧美日韩激情| 成人午夜视频福利| 国产精品麻豆欧美日韩ww| 国产不卡高清在线观看视频| 国产日韩欧美综合一区| 丁香桃色午夜亚洲一区二区三区| 国产亚洲综合性久久久影院| 国产成人午夜视频| 国产精品伦理在线| 色婷婷av久久久久久久| 亚洲一二三级电影| 欧美精选一区二区| 久久av老司机精品网站导航| xnxx国产精品| 成人综合婷婷国产精品久久蜜臀| 中文字幕在线观看一区二区| 91麻豆123| 日韩国产精品久久久| 精品成人佐山爱一区二区| 国产成人精品三级| 亚洲欧美一区二区三区国产精品| 在线观看亚洲a| 午夜欧美视频在线观看| 久久综合久久综合亚洲| 99re这里只有精品6| 视频在线观看91| 国产亚洲欧洲一区高清在线观看| www.爱久久.com| 亚洲成年人影院| 精品女同一区二区| 91免费观看在线| 麻豆精品一区二区av白丝在线| 国产亚洲视频系列| 欧美无乱码久久久免费午夜一区| 麻豆精品视频在线观看视频| 国产精品女同一区二区三区| 欧美色图免费看| 国产精品一区二区久久精品爱涩| 亚洲女同女同女同女同女同69| 91超碰这里只有精品国产| 国产99久久久久久免费看农村| 亚洲欧美日韩一区二区 | 3d动漫精品啪啪1区2区免费| 国产福利一区二区三区在线视频| 一区二区三区精品在线观看| 久久久久99精品一区| 欧美在线观看你懂的| 国产成人鲁色资源国产91色综| 亚洲国产美女搞黄色| 国产精品沙发午睡系列990531| 91精品国产综合久久精品性色| 97精品国产97久久久久久久久久久久| 日韩国产精品91| 亚洲精品你懂的| 亚洲国产高清在线观看视频| 日韩亚洲欧美中文三级| 欧美在线|欧美| av激情综合网| 国产成人免费视| 极品瑜伽女神91| 婷婷亚洲久悠悠色悠在线播放 | 日韩一区二区三区免费看| 欧美性猛交xxxx黑人交| 91蜜桃免费观看视频| 成人免费视频视频| 国产91精品精华液一区二区三区| 日本vs亚洲vs韩国一区三区 | 国产一区二区影院| 日韩在线观看一区二区| 亚洲成人www| 亚洲va韩国va欧美va| 亚洲午夜在线观看视频在线| 亚洲精品大片www| 一区二区成人在线| 亚洲精品一卡二卡| 亚洲欧美韩国综合色| 亚洲精品日韩专区silk| 亚洲免费在线看| 亚洲免费观看高清完整版在线观看 | 91丝袜国产在线播放| 国产盗摄一区二区| 国产成人精品一区二区三区网站观看| 激情久久五月天| 国产在线精品一区二区| 国产一区二区视频在线| 国产精品91一区二区| 从欧美一区二区三区| 99久久久国产精品| 91福利在线导航| 欧美精品久久99| 欧美白人最猛性xxxxx69交| 亚洲精品在线免费播放| 国产婷婷色一区二区三区在线| 国产欧美日韩麻豆91| 美国十次综合导航| 另类欧美日韩国产在线| 国产精品综合在线视频| 99在线精品视频| 在线不卡免费av| 久久蜜桃一区二区| 亚洲色图.com| 午夜视黄欧洲亚洲| 精品一区二区在线看| 99热99精品| 在线播放亚洲一区| 国产亚洲一本大道中文在线| 综合在线观看色| 捆绑变态av一区二区三区| 成人免费毛片aaaaa**| 欧美图区在线视频| 久久人人超碰精品| 亚洲小说春色综合另类电影| 久久99精品久久久| 色天天综合色天天久久| 欧美不卡一区二区| 一区二区在线观看视频| 久草热8精品视频在线观看| 99久久精品99国产精品| 制服丝袜亚洲精品中文字幕| 欧美激情一区二区三区在线| 亚洲成国产人片在线观看| 国产盗摄视频一区二区三区| 欧美日韩免费电影| |精品福利一区二区三区| 久久99精品久久久久| 91久久奴性调教|