This is used in the ArgumentException constructor which is thrown in the method.
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
- ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
"Failed to set camera display mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
"Failed to set camera display mode.");
}
- ValidationUtil.ValidateEnum(typeof(Rotation), value);
+ ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
"Failed to set display rotation.");
CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
"Failed to set display rotation.");
- ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
"Failed to set camera autofocus mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
"Failed to set camera autofocus mode.");
}
- ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
"Failed to set camera exposure mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
"Failed to set camera exposure mode.");
}
- ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value);
+ ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
"Failed to set camera whitebalance.");
}
CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
"Failed to set camera whitebalance.");
}
- ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value);
+ ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
"Failed to set camera Iso level.");
}
CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
"Failed to set camera Iso level.");
}
- ValidationUtil.ValidateEnum(typeof(CameraFps), value);
+ ValidationUtil.ValidateEnum(typeof(CameraFps), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
"Failed to set preview fps.");
}
CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
"Failed to set preview fps.");
}
- ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
+ ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
"Failed to set preview format.");
}
CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
"Failed to set preview format.");
}
- ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value);
+ ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
"Failed to set capture format.");
}
CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
"Failed to set capture format.");
}
- ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
"Failed to set camera theater mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
"Failed to set camera theater mode.");
}
- ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
"Failed to set camera effect.");
}
CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
"Failed to set camera effect.");
}
- ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
"Failed to set camera scene mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
"Failed to set camera scene mode.");
}
- ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
"Failed to set camera flash mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
"Failed to set camera flash mode.");
}
- ValidationUtil.ValidateEnum(typeof(Rotation), value);
+ ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
"Failed to set camera stream rotation.");
CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
"Failed to set camera stream rotation.");
- ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value);
+ ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
"Failed to set camera hdr mode.");
}
CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
"Failed to set camera hdr mode.");
}
- ValidationUtil.ValidateEnum(typeof(CameraPtzType), value);
+ ValidationUtil.ValidateEnum(typeof(CameraPtzType), value, nameof(value));
CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
"Failed to set camera ptz type.");
CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
"Failed to set camera ptz type.");
public void SetPan(CameraPtzMoveType type, int panStep)
{
ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
public void SetPan(CameraPtzMoveType type, int panStep)
{
ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
"Failed to set the camera pan type.");
}
CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
"Failed to set the camera pan type.");
}
- ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value);
+ ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value, nameof(value));
+
CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
"Failed to set camera tag orientation.");
}
CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
"Failed to set camera tag orientation.");
}
- ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value);
+ ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value, nameof(value));
NativePlayer.SetAudioLatencyMode(Handle, value).
ThrowIfFailed(this, "Failed to set the audio latency mode of the player");
NativePlayer.SetAudioLatencyMode(Handle, value).
ThrowIfFailed(this, "Failed to set the audio latency mode of the player");
- ValidationUtil.ValidateEnum(typeof(PlayerDisplayMode), value);
+ ValidationUtil.ValidateEnum(typeof(PlayerDisplayMode), value, nameof(value));
Native.SetMode(Player.Handle, value).
ThrowIfFailed(Player, "Failed to set display mode");
Native.SetMode(Player.Handle, value).
ThrowIfFailed(Player, "Failed to set display mode");
- ValidationUtil.ValidateEnum(typeof(Rotation), value);
+ ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
Native.SetRotation(Player.Handle, value).
ThrowIfFailed(Player, "Failed to set the rotation state of the display");
Native.SetRotation(Player.Handle, value).
ThrowIfFailed(Player, "Failed to set the rotation state of the display");
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
{
Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
- ValidationUtil.ValidateEnum(typeof(StreamMetadataKey), key);
+ ValidationUtil.ValidateEnum(typeof(StreamMetadataKey), key, nameof(key));
IntPtr ptr = IntPtr.Zero;
IntPtr ptr = IntPtr.Zero;
- ValidationUtil.ValidateEnum(typeof(BarcodeDetectionTarget), value);
+ ValidationUtil.ValidateEnum(typeof(BarcodeDetectionTarget), value, nameof(value));
+
Set(KeyAttrTarget, (int)value);
}
}
Set(KeyAttrTarget, (int)value);
}
}
- ValidationUtil.ValidateEnum(typeof(Visibility), value);
+ ValidationUtil.ValidateEnum(typeof(Visibility), value, nameof(value));
+
Set(KeyTextAttr, (int)value);
}
}
Set(KeyTextAttr, (int)value);
}
}
throw new ArgumentNullException(nameof(message));
}
throw new ArgumentNullException(nameof(message));
}
- ValidationUtil.ValidateEnum(typeof(BarcodeType), type);
+ ValidationUtil.ValidateEnum(typeof(BarcodeType), type, nameof(type));
MediaVisionSource source = new MediaVisionSource();
try
MediaVisionSource source = new MediaVisionSource();
try
throw new ArgumentNullException(nameof(imageConfig));
}
throw new ArgumentNullException(nameof(imageConfig));
}
- ValidationUtil.ValidateEnum(typeof(BarcodeType), type);
+ ValidationUtil.ValidateEnum(typeof(BarcodeType), type, nameof(type));
InteropBarcode.GenerateImage(EngineConfiguration.GetHandle(config), message,
imageConfig.Width, imageConfig.Height, type, qrMode, qrEcc, qrVersion,
InteropBarcode.GenerateImage(EngineConfiguration.GetHandle(config), message,
imageConfig.Width, imageConfig.Height, type, qrMode, qrEcc, qrVersion,
throw new ArgumentNullException(nameof(path));
}
throw new ArgumentNullException(nameof(path));
}
- ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat);
+ ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat, nameof(imageFormat));
Size = size;
Path = path;
Size = size;
Path = path;
- ValidationUtil.ValidateEnum(typeof(FaceRecognitionModelType), value);
+ ValidationUtil.ValidateEnum(typeof(FaceRecognitionModelType), value, nameof(value));
+
Set(KeyModelType, (int)value);
}
}
Set(KeyModelType, (int)value);
}
}
{
internal static class ValidationUtil
{
{
internal static class ValidationUtil
{
- internal static void ValidateEnum(Type enumType, object value)
- {
- if (!Enum.IsDefined(enumType, value))
- {
- throw new ArgumentException($"Invalid { enumType.Name } value : { value }");
- }
- }
-
internal static void ValidateEnum(Type enumType, object value, string paramName)
{
if (!Enum.IsDefined(enumType, value))
internal static void ValidateEnum(Type enumType, object value, string paramName)
{
if (!Enum.IsDefined(enumType, value))