예제 #1
0
 /// <summary>
 /// 返回资源访问对象。
 /// </summary>
 private static ExceptionResources GetLoader()
 {
     if (resLoader == null)
     {
         lock (SyncObject)
         {
             if (resLoader == null)
             {
                 resLoader = new ExceptionResources();
             }
         }
     }
     return(resLoader);
 }
		/// <summary>
		/// 返回资源访问对象。
		/// </summary>
		private static ExceptionResources GetLoader()
		{
			if (resLoader == null)
			{
				lock (SyncObject)
				{
					if (resLoader == null)
					{
						resLoader = new ExceptionResources();
					}
				}
			}
			return resLoader;
		}
 /// <summary>
 /// 返回方法调用异常。
 /// </summary>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <returns><see cref="System.InvalidOperationException"/> 对象。</returns>
 private static InvalidOperationException GetInvalidOperationException(string resName)
 {
     return(new InvalidOperationException(ExceptionResources.GetString(resName)));
 }
        /// <summary>
        /// 返回参数异常。
        /// </summary>
        /// <param name="paramName">产生异常的参数名称。</param>
        /// <param name="resName">异常信息的资源名称。</param>
        /// <param name="args">格式化信息的参数。</param>
        /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
        private static ArgumentException GetArgumentException(string paramName, string resName, params object[] args)
        {
            string message = ExceptionResources.GetString(resName, args);

            return(new ArgumentException(message, paramName));
        }
 /// <summary>
 /// 返回参数异常。
 /// </summary>
 /// <param name="paramName">产生异常的参数名称。</param>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
 private static ArgumentException GetArgumentException(string paramName, string resName)
 {
     return(new ArgumentException(ExceptionResources.GetString(resName), paramName));
 }
 /// <summary>
 /// 返回分析异常。
 /// </summary>
 /// <param name="pattern">正在分析的模式字符串。</param>
 /// <param name="message">分析的异常信息。</param>
 /// <param name="start">分析异常的起始位置。</param>
 /// <param name="end">分析异常的结束位置。</param>
 /// <returns><see cref="Cyjb.IO.SourceException"/> 对象。</returns>
 internal static SourceException ParsingException(string pattern, string message,
                                                  SourcePosition start, SourcePosition end)
 {
     return(new SourceException(ExceptionResources.GetString("ParsingException", pattern, message), new SourceRange(start, end)));
 }