using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Tango.WiFi.Win32.Interop { /// /// Represents an error occuring during WLAN operations which indicate their failure via a . /// public class WlanException : Exception { private WlanReasonCode reasonCode; WlanException(WlanReasonCode reasonCode) { this.reasonCode = reasonCode; } /// /// Gets the WLAN reason code. /// /// The WLAN reason code. public WlanReasonCode ReasonCode { get { return reasonCode; } } /// /// Gets a message that describes the reason code. /// /// /// The error message that explains the reason for the exception, or an empty string(""). public override string Message { get { StringBuilder sb = new StringBuilder(1024); if (WlanInterop.WlanReasonCodeToString(reasonCode, sb.Capacity, sb, IntPtr.Zero) == 0) return sb.ToString(); else return string.Empty; } } } }