/// <summary> /// Initializes a new instance of the <see cref="T:Blueberry.XInput.XInputException"/> class. /// /// </summary> /// <param name="result">The error result code.</param><param name="message">The message describing the exception.</param><param name="args">formatting arguments</param> public XInputException(Result result, string message, params object[] args) : base(string.Format((IFormatProvider)CultureInfo.InvariantCulture, message, args)) { this.descriptor = ResultDescriptor.Find(result); this.HResult = (int)result; }
/// <summary> /// Initializes a new instance of the <see cref="T:Blueberry.XInput.XInputException"/> class. /// /// </summary> /// <param name="message">The message describing the exception.</param><param name="innerException">The exception that caused this exception.</param><param name="args">formatting arguments</param> public XInputException(string message, Exception innerException, params object[] args) : base(string.Format((IFormatProvider)CultureInfo.InvariantCulture, message, args), innerException) { this.descriptor = ResultDescriptor.Find(Result.Fail); this.HResult = (int)Result.Fail; }
/// <summary> /// Initializes a new instance of the <see cref="T:Blueberry.XInput.XInputException"/> class. /// /// </summary> /// <param name="result">The error result code.</param><param name="message">The message describing the exception.</param> public XInputException(Result result, string message) : base(message) { this.descriptor = ResultDescriptor.Find(result); this.HResult = (int)result; }
/// <summary> /// Initializes a new instance of the <see cref="T:Blueberry.XInput.XInputException"/> class. /// /// </summary> /// <param name="descriptor">The result descriptor.</param> public XInputException(ResultDescriptor descriptor) : base(descriptor.ToString()) { this.descriptor = descriptor; this.HResult = (int)descriptor.Result; }
/// <summary> /// Initializes a new instance of the <see cref="T:Blueberry.XInput.XInputException"/> class. /// /// </summary> public XInputException() : base("A XInput exception occurred.") { this.descriptor = ResultDescriptor.Find(Result.Fail); this.HResult = (int)Result.Fail; }
/// <summary> /// Determines whether the specified <see cref="T:Blueberry.ResultDescriptor"/> is equal to this instance. /// /// </summary> /// <param name="other">The <see cref="T:Blueberry.ResultDescriptor"/> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="T:Blueberry.ResultDescriptor"/> is equal to this instance; otherwise, <c>false</c>. /// /// </returns> public bool Equals(ResultDescriptor other) { if (object.ReferenceEquals((object)null, (object)other)) return false; if (object.ReferenceEquals((object)this, (object)other)) return true; else return other.Result.Equals(this.Result); }
/// <summary> /// Finds the specified result descriptor. /// /// </summary> /// <param name="result">The result code.</param> /// <returns> /// A descriptor for the specified result /// </returns> public static ResultDescriptor Find(Result result) { ResultDescriptor resultDescriptor; lock (ResultDescriptor.LockDescriptor) { if (ResultDescriptor.RegisteredDescriptorProvider.Count > 0) { foreach (Type item_0 in ResultDescriptor.RegisteredDescriptorProvider) ResultDescriptor.AddDescriptorsFromType(item_0); ResultDescriptor.RegisteredDescriptorProvider.Clear(); } if (!ResultDescriptor.Descriptors.TryGetValue(result, out resultDescriptor)) resultDescriptor = new ResultDescriptor(result, "Unknown", "Unknown", "Unknown", (string)null); if (resultDescriptor.Description == null) { string local_2 = ResultDescriptor.GetDescriptionFromResultCode(result.Code); resultDescriptor.Description = local_2 ?? "Unknown"; } } return resultDescriptor; }