diff options
Diffstat (limited to 'Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs')
| -rw-r--r-- | Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs | 285 |
1 files changed, 143 insertions, 142 deletions
diff --git a/Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs b/Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs index e785c9943..9ade0e67c 100644 --- a/Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs +++ b/Emby.Common.Implementations/IO/SharpCifs/Netbios/NbtException.cs @@ -19,146 +19,147 @@ using System.IO; namespace SharpCifs.Netbios { - public class NbtException : IOException - { - public const int Success = 0; - - public const int ErrNamSrvc = unchecked(0x01); - - public const int ErrSsnSrvc = unchecked(0x02); - - public const int FmtErr = unchecked(0x1); - - public const int SrvErr = unchecked(0x2); - - public const int ImpErr = unchecked(0x4); - - public const int RfsErr = unchecked(0x5); - - public const int ActErr = unchecked(0x6); - - public const int CftErr = unchecked(0x7); - - public const int ConnectionRefused = -1; - - public const int NotListeningCalled = unchecked(0x80); - - public const int NotListeningCalling = unchecked(0x81); - - public const int CalledNotPresent = unchecked(0x82); - - public const int NoResources = unchecked(0x83); - - public const int Unspecified = unchecked(0x8F); - - public int ErrorClass; - - public int ErrorCode; - - // error classes - // name service error codes - // session service error codes - public static string GetErrorString(int errorClass, int errorCode) - { - string result = string.Empty; - switch (errorClass) - { - case Success: - { - result += "SUCCESS"; - break; - } - - case ErrNamSrvc: - { - result += "ERR_NAM_SRVC/"; - switch (errorCode) - { - case FmtErr: - { - result += "FMT_ERR: Format Error"; - goto default; - } - - default: - { - result += "Unknown error code: " + errorCode; - break; - } - } - break; - } - - case ErrSsnSrvc: - { - result += "ERR_SSN_SRVC/"; - switch (errorCode) - { - case ConnectionRefused: - { - result += "Connection refused"; - break; - } - - case NotListeningCalled: - { - result += "Not listening on called name"; - break; - } - - case NotListeningCalling: - { - result += "Not listening for calling name"; - break; - } - - case CalledNotPresent: - { - result += "Called name not present"; - break; - } - - case NoResources: - { - result += "Called name present, but insufficient resources"; - break; - } - - case Unspecified: - { - result += "Unspecified error"; - break; - } - - default: - { - result += "Unknown error code: " + errorCode; - break; - } - } - break; - } - - default: - { - result += "unknown error class: " + errorClass; - break; - } - } - return result; - } - - public NbtException(int errorClass, int errorCode) : base(GetErrorString(errorClass - , errorCode)) - { - this.ErrorClass = errorClass; - this.ErrorCode = errorCode; - } - - public override string ToString() - { - return "errorClass=" + ErrorClass + ",errorCode=" + ErrorCode + ",errorString=" - + GetErrorString(ErrorClass, ErrorCode); - } - } + public class NbtException : IOException + { + public const int Success = 0; + + public const int ErrNamSrvc = unchecked(0x01); + + public const int ErrSsnSrvc = unchecked(0x02); + + public const int FmtErr = unchecked(0x1); + + public const int SrvErr = unchecked(0x2); + + public const int ImpErr = unchecked(0x4); + + public const int RfsErr = unchecked(0x5); + + public const int ActErr = unchecked(0x6); + + public const int CftErr = unchecked(0x7); + + public const int ConnectionRefused = -1; + + public const int NotListeningCalled = unchecked(0x80); + + public const int NotListeningCalling = unchecked(0x81); + + public const int CalledNotPresent = unchecked(0x82); + + public const int NoResources = unchecked(0x83); + + public const int Unspecified = unchecked(0x8F); + + public int ErrorClass; + + public int ErrorCode; + + // error classes + // name service error codes + // session service error codes + public static string GetErrorString(int errorClass, int errorCode) + { + string result = string.Empty; + switch (errorClass) + { + case Success: + { + result += "SUCCESS"; + break; + } + + case ErrNamSrvc: + { + result += "ERR_NAM_SRVC/"; + switch (errorCode) + { + case FmtErr: + { + result += "FMT_ERR: Format Error"; + goto default; + } + + default: + { + result += "Unknown error code: " + errorCode; + break; + } + } + break; + } + + case ErrSsnSrvc: + { + result += "ERR_SSN_SRVC/"; + switch (errorCode) + { + case ConnectionRefused: + { + result += "Connection refused"; + break; + } + + case NotListeningCalled: + { + result += "Not listening on called name"; + break; + } + + case NotListeningCalling: + { + result += "Not listening for calling name"; + break; + } + + case CalledNotPresent: + { + result += "Called name not present"; + break; + } + + case NoResources: + { + result += "Called name present, but insufficient resources"; + break; + } + + case Unspecified: + { + result += "Unspecified error"; + break; + } + + default: + { + result += "Unknown error code: " + errorCode; + break; + } + } + break; + } + + default: + { + result += "unknown error class: " + errorClass; + break; + } + } + return result; + } + + public NbtException(int errorClass, int errorCode) : base(GetErrorString(errorClass + , errorCode)) + { + this.ErrorClass = errorClass; + this.ErrorCode = errorCode; + } + + public override string ToString() + { + return "errorClass=" + ErrorClass + + ",errorCode=" + ErrorCode + + ",errorString=" + GetErrorString(ErrorClass, ErrorCode); + } + } } |
