blob: 2b286be1361975f79d72331fe7aaab4b78c51701 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tango.WiFi.Win32.Interop
{
/// <summary>
/// Represents an error occuring during WLAN operations which indicate their failure via a <see cref="WlanReasonCode"/>.
/// </summary>
public class WlanException : Exception
{
private WlanReasonCode reasonCode;
WlanException(WlanReasonCode reasonCode)
{
this.reasonCode = reasonCode;
}
/// <summary>
/// Gets the WLAN reason code.
/// </summary>
/// <value>The WLAN reason code.</value>
public WlanReasonCode ReasonCode
{
get { return reasonCode; }
}
/// <summary>
/// Gets a message that describes the reason code.
/// </summary>
/// <value></value>
/// <returns>The error message that explains the reason for the exception, or an empty string("").</returns>
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;
}
}
}
}
|