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

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

?? optionconverter.cs

?? 詳細講述了數據庫編程
?? CS
?? 第 1 頁 / 共 2 頁
字號:
#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.Reflection;
using System.Text;

using log4net.Core;
using log4net.Util.TypeConverters;

namespace log4net.Util
{
	/// <summary>
	/// A convenience class to convert property values to specific types.
	/// </summary>
	/// <remarks>
	/// <para>
	/// Utility functions for converting types and parsing values.
	/// </para>
	/// </remarks>
	/// <author>Nicko Cadell</author>
	/// <author>Gert Driesen</author>
	public sealed class OptionConverter
	{
		#region Private Instance Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="OptionConverter" /> class. 
		/// </summary>
		/// <remarks>
		/// <para>
		/// Uses a private access modifier to prevent instantiation of this class.
		/// </para>
		/// </remarks>
		private OptionConverter()
		{
		}

		#endregion Private Instance Constructors

		#region Public Static Methods

//		/// <summary>
//		/// Concatenates two string arrays.
//		/// </summary>
//		/// <param name="l">Left array.</param>
//		/// <param name="r">Right array.</param>
//		/// <returns>Array containing both left and right arrays.</returns>
//		public static string[] ConcatenateArrays(string[] l, string[] r) 
//		{
//			return (string[])ConcatenateArrays(l, r);
//		}

//		/// <summary>
//		/// Concatenates two arrays.
//		/// </summary>
//		/// <param name="l">Left array</param>
//		/// <param name="r">Right array</param>
//		/// <returns>Array containing both left and right arrays.</returns>
//		public static Array ConcatenateArrays(Array l, Array r) 
//		{
//			if (l == null)
//			{
//				throw new ArgumentNullException("l");
//			}
//			if (r == null)
//			{
//				throw new ArgumentNullException("r");
//			}
//
//			int len = l.Length + r.Length;
//			Array a = Array.CreateInstance(l.GetType(), len);
//
//			Array.Copy(l, 0, a, 0, l.Length);
//			Array.Copy(r, 0, a, l.Length, r.Length);
//
//			return a;
//		}
  
//		/// <summary>
//		/// Converts string escape characters back to their correct values.
//		/// </summary>
//		/// <param name="s">String to convert.</param>
//		/// <returns>Converted result.</returns>
//		public static string ConvertSpecialChars(string s) 
//		{
//			if (s == null)
//			{
//				throw new ArgumentNullException("s");
//			}
//			char c;
//			int len = s.Length;
//			StringBuilder buf = new StringBuilder(len);
//	
//			int i = 0;
//			while(i < len) 
//			{
//				c = s[i++];
//				if (c == '\\') 
//				{
//					c =  s[i++];
//					if (c == 'n')	  c = '\n';
//					else if (c == 'r') c = '\r';
//					else if (c == 't') c = '\t';
//					else if (c == 'f') c = '\f';
//					else if (c == '\b') c = '\b';					
//					else if (c == '\"') c = '\"';				
//					else if (c == '\'') c = '\'';			
//					else if (c == '\\') c = '\\';			
//				}
//				buf.Append(c);	  
//			}
//			return buf.ToString();
//		}

		/// <summary>
		/// Converts a string to a <see cref="bool" /> value.
		/// </summary>
		/// <param name="argValue">String to convert.</param>
		/// <param name="defaultValue">The default value.</param>
		/// <returns>The <see cref="bool" /> value of <paramref name="argValue" />.</returns>
		/// <remarks>
		/// <para>
		/// If <paramref name="argValue"/> is "true", then <c>true</c> is returned. 
		/// If <paramref name="argValue"/> is "false", then <c>false</c> is returned. 
		/// Otherwise, <paramref name="defaultValue"/> is returned.
		/// </para>
		/// </remarks>
		public static bool ToBoolean(string argValue, bool defaultValue) 
		{
			if (argValue != null && argValue.Length > 0)
			{
				try
				{
					return bool.Parse(argValue);
				}
				catch(Exception e)
				{
					LogLog.Error("OptionConverter: [" + argValue + "] is not in proper bool form.", e);
				}
			}
			return defaultValue;
		}

//		/// <summary>
//		/// Converts a string to an integer.
//		/// </summary>
//		/// <param name="argValue">String to convert.</param>
//		/// <param name="defaultValue">The default value.</param>
//		/// <returns>The <see cref="int" /> value of <paramref name="argValue" />.</returns>
//		/// <remarks>
//		/// <para>
//		/// <paramref name="defaultValue"/> is returned when <paramref name="argValue"/>
//		/// cannot be converted to a <see cref="int" /> value.
//		/// </para>
//		/// </remarks>
//		public static int ToInt(string argValue, int defaultValue) 
//		{
//			if (argValue != null) 
//			{
//				string s = argValue.Trim();
//				try 
//				{
//					return int.Parse(s, NumberFormatInfo.InvariantInfo);
//				}
//				catch (Exception e) 
//				{
//					LogLog.Error("OptionConverter: [" + s + "] is not in proper int form.", e);
//				}
//			}
//			return defaultValue;
//		}

		/// <summary>
		/// Parses a file size into a number.
		/// </summary>
		/// <param name="argValue">String to parse.</param>
		/// <param name="defaultValue">The default value.</param>
		/// <returns>The <see cref="long" /> value of <paramref name="argValue" />.</returns>
		/// <remarks>
		/// <para>
		/// Parses a file size of the form: number[KB|MB|GB] into a
		/// long value. It is scaled with the appropriate multiplier.
		/// </para>
		/// <para>
		/// <paramref name="defaultValue"/> is returned when <paramref name="argValue"/>
		/// cannot be converted to a <see cref="long" /> value.
		/// </para>
		/// </remarks>
		public static long ToFileSize(string argValue, long defaultValue) 
		{
			if (argValue == null)
			{
				return defaultValue;
			}
	
			string s = argValue.Trim().ToUpper(CultureInfo.InvariantCulture);
			long multiplier = 1;
			int index;
	
			if ((index = s.IndexOf("KB")) != -1) 
			{	  
				multiplier = 1024;
				s = s.Substring(0, index);
			}
			else if ((index = s.IndexOf("MB")) != -1) 
			{
				multiplier = 1024 * 1024;
				s = s.Substring(0, index);
			}
			else if ((index = s.IndexOf("GB")) != -1) 
			{
				multiplier = 1024 * 1024 * 1024;
				s = s.Substring(0, index);
			}	
			if (s != null) 
			{
				// Try again to remove whitespace between the number and the size specifier
				s = s.Trim();
				
				long longVal;
				if (SystemInfo.TryParse(s, out longVal))
				{
					return longVal * multiplier;
				}
				else
				{
					LogLog.Error("OptionConverter: ["+ s +"] is not in the correct file size syntax.");
				}
			}
			return defaultValue;
		}

		/// <summary>
		/// Converts a string to an object.
		/// </summary>
		/// <param name="target">The target type to convert to.</param>
		/// <param name="txt">The string to convert to an object.</param>
		/// <returns>
		/// The object converted from a string or <c>null</c> when the 
		/// conversion failed.
		/// </returns>
		/// <remarks>
		/// <para>
		/// Converts a string to an object. Uses the converter registry to try
		/// to convert the string value into the specified target type.
		/// </para>
		/// </remarks>
		public static object ConvertStringTo(Type target, string txt)
		{
			if (target == null)
			{
				throw new ArgumentNullException("target");
			}

			// If we want a string we already have the correct type
			if (typeof(string) == target || typeof(object) == target)
			{
				return txt;
			}

			// First lets try to find a type converter
			IConvertFrom typeConverter = ConverterRegistry.GetConvertFrom(target);
			if (typeConverter != null && typeConverter.CanConvertFrom(typeof(string)))
			{
				// Found appropriate converter
				return typeConverter.ConvertFrom(txt);
			}
			else
			{
				if (target.IsEnum)
				{
					// Target type is an enum.

					// Use the Enum.Parse(EnumType, string) method to get the enum value
					return ParseEnum(target, txt, true);
				}
				else
				{
					// We essentially make a guess that to convert from a string
					// to an arbitrary type T there will be a static method defined on type T called Parse
					// that will take an argument of type string. i.e. T.Parse(string)->T we call this
					// method to convert the string to the type required by the property.
					System.Reflection.MethodInfo meth = target.GetMethod("Parse", new Type[] {typeof(string)});
					if (meth != null)
					{
						// Call the Parse method
						return meth.Invoke(null, BindingFlags.InvokeMethod, null, new object[] {txt}, CultureInfo.InvariantCulture);
					}
					else
					{
						// No Parse() method found.
					}
				}
			}
			return null;
		}

//		/// <summary>
//		/// Looks up the <see cref="IConvertFrom"/> for the target type.
//		/// </summary>
//		/// <param name="target">The type to lookup the converter for.</param>
//		/// <returns>The converter for the specified type.</returns>
//		public static IConvertFrom GetTypeConverter(Type target)
//		{
//			IConvertFrom converter = ConverterRegistry.GetConverter(target);
//			if (converter == null)
//			{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频在线观看国产精品| 日本午夜一区二区| 中文字幕一区二区在线播放 | 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 91精品国产综合久久福利软件| 欧美日韩精品一区二区三区四区| 欧美日韩国产小视频在线观看| 欧美一区日本一区韩国一区| 欧美电影免费观看高清完整版在线 | 欧美一级淫片007| 久久精品人人做人人爽97| 亚洲免费毛片网站| 国产一区视频网站| 欧美午夜精品一区| 国产欧美日韩综合| 日韩av在线发布| 国产91对白在线观看九色| jlzzjlzz亚洲女人18| 91精品国产黑色紧身裤美女| 欧美国产国产综合| 免费在线成人网| 欧美色图在线观看| 欧美国产一区二区| 国产乱色国产精品免费视频| 日本精品一级二级| 久久精品人人爽人人爽| 丝袜诱惑亚洲看片| 欧美日韩精品电影| 一级精品视频在线观看宜春院| 久久精工是国产品牌吗| 欧美日本在线看| 亚洲18女电影在线观看| 日本精品视频一区二区三区| 国产精品成人免费| av成人免费在线观看| 欧美国产日韩亚洲一区| 国产麻豆精品久久一二三| 久久亚洲综合av| 久久99深爱久久99精品| 久久精品无码一区二区三区| 国产精品996| 久久久.com| 99视频一区二区三区| 国产精品伦理一区二区| 日本二三区不卡| 日本不卡在线视频| 国产亚洲精品资源在线26u| 夜夜嗨av一区二区三区中文字幕| av不卡一区二区三区| 亚洲一区二区三区美女| 日韩视频在线一区二区| 成人激情校园春色| 一区二区三区日韩精品视频| 欧美精品三级在线观看| 国产91高潮流白浆在线麻豆| 国产成人夜色高潮福利影视| 在线观看亚洲专区| 蜜臀久久久久久久| 欧美高清视频www夜色资源网| 欧美一级片在线| 亚洲欧美日韩在线不卡| 久久精品国产精品亚洲红杏| av在线播放一区二区三区| 亚洲人xxxx| 色香蕉久久蜜桃| 91精品国产色综合久久不卡电影| 国产欧美日韩中文久久| 五月婷婷激情综合网| 99re视频这里只有精品| 国产欧美日韩不卡免费| 亚洲一二三区在线观看| 日本一区二区成人| 精品中文字幕一区二区| 666欧美在线视频| 国产精品18久久久久久久久久久久| 日韩欧美一级二级三级久久久| 国产福利一区在线| 毛片基地黄久久久久久天堂| 久久在线免费观看| 欧洲国产伦久久久久久久| 老司机精品视频导航| 亚洲欧美日韩国产综合| 欧美成人乱码一区二区三区| 欧洲生活片亚洲生活在线观看| 成人精品视频网站| 天天操天天色综合| 日韩一区中文字幕| 国产欧美精品区一区二区三区| 精品视频资源站| 久久男人中文字幕资源站| 日韩一区二区在线观看| 久久色在线视频| 日韩美女视频在线| 久久久不卡影院| 中文字幕中文字幕在线一区| 亚洲人xxxx| 日韩精品福利网| 亚洲色图色小说| 日韩电影在线看| 国产资源在线一区| 99精品欧美一区二区三区综合在线| 丁香婷婷深情五月亚洲| 欧美日韩情趣电影| 国产日韩欧美一区二区三区乱码 | 中文字幕av一区 二区| 99久久精品国产一区| 日韩精品色哟哟| 日本一不卡视频| 国产剧情在线观看一区二区 | 在线视频中文字幕一区二区| 欧美剧情片在线观看| 亚洲国产精品v| 国产一区二区主播在线| 欧美日韩高清一区二区不卡| 国产婷婷一区二区| 亚洲精品视频在线看| 一区二区三区在线不卡| 成人av资源在线观看| 一区二区日韩av| 9191久久久久久久久久久| 中文字幕av一区二区三区高 | 欧美成人一区二区| 国产在线日韩欧美| 国产精品日日摸夜夜摸av| av电影天堂一区二区在线观看| 亚洲精品国产第一综合99久久| 欧美亚洲禁片免费| 91精品一区二区三区久久久久久| 国产丝袜在线精品| 国产在线精品国自产拍免费| 欧美成人猛片aaaaaaa| 热久久免费视频| 日韩一区二区免费电影| 免费高清成人在线| 欧美一区二区视频观看视频| 欧美a级一区二区| 久久人人97超碰com| 93久久精品日日躁夜夜躁欧美| 国产精品欧美一级免费| 99精品在线免费| 亚洲综合一二三区| 日韩三级av在线播放| 国产真实乱偷精品视频免| 国产精品视频第一区| 欧美在线不卡一区| 韩国女主播一区二区三区| 国产精品麻豆网站| 欧美日韩免费在线视频| 国内不卡的二区三区中文字幕| 国产精品三级av| 日韩精品最新网址| 91网上在线视频| 国产精品性做久久久久久| 一卡二卡欧美日韩| 中文字幕一区二区三区乱码在线| 在线播放一区二区三区| 粉嫩av一区二区三区| 日本不卡一二三| 亚洲精品欧美激情| 亚洲精品乱码久久久久久久久| 91麻豆精品91久久久久久清纯| 成人免费毛片片v| 国精产品一区一区三区mba桃花 | 粉嫩av一区二区三区粉嫩| 亚洲国产日韩a在线播放性色| 国产免费成人在线视频| 欧美一区二区视频免费观看| 在线观看成人小视频| 在线观看免费视频综合| 99re8在线精品视频免费播放| 国产乱淫av一区二区三区| 久热成人在线视频| 精东粉嫩av免费一区二区三区| 日韩av高清在线观看| 亚洲一区二区3| 亚洲一区中文在线| 亚洲午夜精品网| 免费成人av资源网| 国产一区二区三区免费在线观看 | 欧美午夜一区二区三区| 成人av资源站| 在线免费av一区| 欧美另类videos死尸| 91麻豆精品国产91久久久| 日韩精品中文字幕在线不卡尤物| 欧美变态tickling挠脚心| 欧美精品一区二区三区蜜桃视频 | 国产一区二区中文字幕| 国产成人亚洲综合a∨婷婷图片| 成人国产精品免费| 欧美日韩精品一区二区三区 | 久久99久国产精品黄毛片色诱| 国产在线播放一区| 在线观看视频欧美| 亚洲精品一区二区三区蜜桃下载 | 国产性色一区二区| 一个色综合av| 国产v综合v亚洲欧| 日韩视频在线一区二区| 一区二区三区波多野结衣在线观看 |