コード例 #1
0
 // Token: 0x06000045 RID: 69 RVA: 0x00002978 File Offset: 0x00000B78
 public void ThrowIfFailed(string message)
 {
     if (this.Failed)
     {
         if (string.IsNullOrEmpty(message))
         {
             message = this.ToString();
         }
         Exception ex = SecurityHelper.GetExceptionForHR((int)this._value);
         if (ex.GetType() == typeof(COMException))
         {
             Facility facility = this.Facility;
             if (facility == Facility.Win32)
             {
                 ex = HRESULT.CreateWin32Exception(this.Code, message);
             }
             else
             {
                 ex = new COMException(message, (int)this._value);
             }
         }
         else
         {
             ConstructorInfo constructor = ex.GetType().GetConstructor(new Type[]
             {
                 typeof(string)
             });
             if (null != constructor)
             {
                 ex = (constructor.Invoke(new object[]
                 {
                     message
                 }) as Exception);
             }
         }
         throw ex;
     }
 }