static private void ThrowExcption(int e, bool isHandle1Null, bool isHandle2Null, string message) { WiFiError err = (WiFiError)e; if (err == WiFiError.NotSupportedError) { throw new NotSupportedException("Unsupported feature http://tizen.org/feature/network.wifi"); } if (err == WiFiError.PermissionDeniedError) { throw new UnauthorizedAccessException("Permission denied " + message); } if (err == WiFiError.OutOfMemoryError) { throw new OutOfMemoryException("Out of memory"); } if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError) { if (isHandle1Null || isHandle2Null) { throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); } throw new ArgumentException("Invalid parameter"); } throw new InvalidOperationException(err.ToString()); }
// Used in callback static internal Exception GetException(int e, string message) { WiFiError err = (WiFiError)e; switch (err) { case WiFiError.NowInProgressError: return(new NowInProgressException(message)); case WiFiError.InvalidKeyError: return(new InvalidKeyException(message)); case WiFiError.SecurityRestrictedError: return(new UnauthorizedAccessException("Disabled by the device policy")); case WiFiError.WpsTimeoutError: return(new TimeoutException("WPS connection is timed out")); } return(new InvalidOperationException(message + " " + err.ToString())); }
// Used for return value of native API static private void ThrowException(int e, bool isHandle1Null, bool isHandle2Null, string message) { WiFiError err = (WiFiError)e; switch (err) { case WiFiError.NotSupportedError: throw new NotSupportedException("Unsupported feature http://tizen.org/feature/network.wifi"); case WiFiError.PermissionDeniedError: throw new UnauthorizedAccessException("Permission denied " + message); case WiFiError.SecurityRestrictedError: throw new UnauthorizedAccessException("Disabled by the device policy"); case WiFiError.OutOfMemoryError: throw new OutOfMemoryException("Out of memory"); case WiFiError.InvalidParameterError: if (isHandle1Null || isHandle2Null) { throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); } throw new ArgumentException("Invalid parameter"); case WiFiError.InvalidKeyError: if (isHandle1Null || isHandle2Null) { throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); } throw new InvalidKeyException(message); case WiFiError.NowInProgressError: throw new NowInProgressException(message); default: throw new InvalidOperationException(err.ToString()); } }