using System; namespace NRKernal { public enum Level { High, Normal, } /// A nr kernal error. public class NRKernalError : ApplicationException { public Level level; /// The error message. protected string msg; /// The inner exception. protected Exception innerException; /// Constructor. /// The message. /// (Optional) The inner exception. public NRKernalError(string msg, Level level = Level.Normal, Exception innerException = null) : base(msg) { this.innerException = innerException; this.msg = msg; this.level = level; } /// Gets the error. /// The error. virtual public string GetErrorMsg() { return msg; } } #region native error ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// internal errors ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// A nr kernal error. public class NRNativeError : NRKernalError { public NativeResult result; /// Constructor. /// The message. /// (Optional) The inner exception. public NRNativeError(NativeResult result, string msg, Level level = Level.Normal, Exception innerException = null) : base(msg, level, innerException) { this.result = result; } /// Gets the error. /// The error. override public string GetErrorMsg() { return string.Format("Error Code-{0}: {1}", (int)result, msg); } } /// A nr invalid argument error. public class NRInvalidArgumentError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRInvalidArgumentError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException) { } } /// A nr not enough memory error. public class NRNotEnoughMemoryError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRNotEnoughMemoryError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A nr sdcard permission deny error. public class NRSdcardPermissionDenyError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRSdcardPermissionDenyError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A nr un supported error. public class NRUnSupportedError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRUnSupportedError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A nr glasses connect error. public class NRGlassesConnectError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRGlassesConnectError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A nr sdk version mismatch error. public class NRSdkVersionMismatchError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRSdkVersionMismatchError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A nr rgb camera device not find error. public class NRRGBCameraDeviceNotFindError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRRGBCameraDeviceNotFindError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException) { } } /// Display device not find error. public class NRDPDeviceNotFindError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRDPDeviceNotFindError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// MRSpace display device not find error. public class NRGetDisplayFailureError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRGetDisplayFailureError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// Display Mode mismatch error, as MRSpace mode is needed. public class NRDisplayModeMismatchError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRDisplayModeMismatchError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.High, innerException) { } } /// A device not support hand tracking calculation error. public class NRUnSupportedHandtrackingCalculationError : NRNativeError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRUnSupportedHandtrackingCalculationError(NativeResult result, string msg, Exception innerException = null) : base(result, msg, Level.Normal, innerException) { } } #endregion #region internal error ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// /// internal errors ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// A nr internal error. public class NRInternalError : NRKernalError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRInternalError(string msg, Level level = Level.Normal, Exception innerException = null) : base(msg, level, innerException) { } } public class NRMissingKeyComponentError : NRInternalError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRMissingKeyComponentError(string msg, Exception innerException = null) : base(msg, Level.High, innerException) { } } public class NRPermissionDenyError : NRInternalError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRPermissionDenyError(string msg, Exception innerException = null) : base(msg, Level.Normal, innerException) { } } public class NRUnSupportDeviceError : NRInternalError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRUnSupportDeviceError(string msg, Exception innerException = null) : base(msg, Level.High, innerException) { } } /// A nr glasses not available error. public class NRGlassesNotAvailbleError : NRInternalError { /// Constructor. /// The message. /// (Optional) The inner exception. public NRGlassesNotAvailbleError(string msg, Exception innerException = null) : base(msg, Level.High, innerException) { } } #endregion }