From 91796ce96df71ea604f80e63a54ab82c2e2bec46 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 9 Mar 2020 20:08:26 +1100 Subject: [PATCH] Update submodule and remove build copy. --- shared-infrastructure | 2 +- src/Directory.Build.targets | 13 - .../Common/Helpers/Guard.Numeric.cs | 1154 ----------------- src/ImageSharp/ImageSharp.csproj | 16 +- 4 files changed, 2 insertions(+), 1183 deletions(-) delete mode 100644 src/ImageSharp/Common/Helpers/Guard.Numeric.cs diff --git a/shared-infrastructure b/shared-infrastructure index 8dfef29f1..ea561c249 160000 --- a/shared-infrastructure +++ b/shared-infrastructure @@ -1 +1 @@ -Subproject commit 8dfef29f1838da76be9596f1a2f1be6d93e453d3 +Subproject commit ea561c249ba86352fe3b69e612b8072f3652eacb diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 055a6803e..d7171aa0f 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -55,14 +55,6 @@ - - @@ -70,11 +62,6 @@ - - diff --git a/src/ImageSharp/Common/Helpers/Guard.Numeric.cs b/src/ImageSharp/Common/Helpers/Guard.Numeric.cs deleted file mode 100644 index 72262e0b9..000000000 --- a/src/ImageSharp/Common/Helpers/Guard.Numeric.cs +++ /dev/null @@ -1,1154 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System; -using System.Runtime.CompilerServices; - -namespace SixLabors -{ - /// - /// Provides methods to protect against invalid parameters. - /// - internal static partial class Guard - { - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(byte value, byte max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(byte value, byte max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(byte value, byte min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(byte value, byte min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(byte value, byte min, byte max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(sbyte value, sbyte max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(sbyte value, sbyte max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(sbyte value, sbyte min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(sbyte value, sbyte min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(sbyte value, sbyte min, sbyte max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(short value, short max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(short value, short max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(short value, short min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(short value, short min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(short value, short min, short max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(ushort value, ushort max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(ushort value, ushort max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(ushort value, ushort min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(ushort value, ushort min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(ushort value, ushort min, ushort max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(char value, char max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(char value, char max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(char value, char min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(char value, char min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(char value, char min, char max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(int value, int max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(int value, int max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(int value, int min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(int value, int min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(int value, int min, int max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(uint value, uint max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(uint value, uint max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(uint value, uint min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(uint value, uint min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(uint value, uint min, uint max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(float value, float max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(float value, float max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(float value, float min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(float value, float min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(float value, float min, float max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(long value, long max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(long value, long max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(long value, long min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(long value, long min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(long value, long min, long max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(ulong value, ulong max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(ulong value, ulong max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(ulong value, ulong min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(ulong value, ulong min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(ulong value, ulong min, ulong max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(double value, double max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(double value, double max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(double value, double min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(double value, double min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(double value, double min, double max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - - /// - /// Ensures that the specified value is less than a maximum value. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThan(decimal value, decimal max, string parameterName) - { - if (value >= max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThan(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is less than or equal to a maximum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeLessThanOrEqualTo(decimal value, decimal max, string parameterName) - { - if (value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeLessThanOrEqualTo(value, max, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThan(decimal value, decimal min, string parameterName) - { - if (value <= min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThan(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value - /// and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeGreaterThanOrEqualTo(decimal value, decimal min, string parameterName) - { - if (value < min) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeGreaterThanOrEqualTo(value, min, parameterName); - } - } - - /// - /// Verifies that the specified value is greater than or equal to a minimum value and less than - /// or equal to a maximum value and throws an exception if it is not. - /// - /// The target value, which should be validated. - /// The minimum value. - /// The maximum value. - /// The name of the parameter that is to be checked. - /// - /// is less than the minimum value of greater than the maximum value. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void MustBeBetweenOrEqualTo(decimal value, decimal min, decimal max, string parameterName) - { - if (value < min || value > max) - { - ThrowHelper.ThrowArgumentOutOfRangeExceptionForMustBeBetweenOrEqualTo(value, min, max, parameterName); - } - } - } -} diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index 24d4f4a00..baf4a2ce1 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -36,17 +36,7 @@ - - - - True - True - Guard.Numeric.tt - - + True True @@ -212,10 +202,6 @@ DefaultPixelBlenders.Generated.cs TextTemplatingFileGenerator - - Guard.Numeric.cs - TextTemplatingFileGenerator -