mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
upgraded to autofac 3. created nancy only mode for nzbdrone.exe /n
This commit is contained in:
parent
177f88303c
commit
b0940ed8de
77 changed files with 3930 additions and 113 deletions
56
NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs
Normal file
56
NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System.Diagnostics;
|
||||
using NzbDrone.Common.EnsureThat.Resources;
|
||||
|
||||
namespace NzbDrone.Common.EnsureThat
|
||||
{
|
||||
public static class EnsureIntExtensions
|
||||
{
|
||||
[DebuggerStepThrough]
|
||||
public static Param<int> IsLessThan(this Param<int> param, int limit)
|
||||
{
|
||||
if (param.Value >= limit)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotLt.Inject(param.Value, limit));
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<int> IsLessThanOrEqualTo(this Param<int> param, int limit)
|
||||
{
|
||||
if (!(param.Value <= limit))
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotLte.Inject(param.Value, limit));
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<int> IsGreaterThan(this Param<int> param, int limit)
|
||||
{
|
||||
if (param.Value <= limit)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotGt.Inject(param.Value, limit));
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<int> IsGreaterOrEqualTo(this Param<int> param, int limit)
|
||||
{
|
||||
if (!(param.Value >= limit))
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotGte.Inject(param.Value, limit));
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static Param<int> IsInRange(this Param<int> param, int min, int max)
|
||||
{
|
||||
if (param.Value < min)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotInRange_ToLow.Inject(param.Value, min));
|
||||
|
||||
if (param.Value > max)
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, ExceptionMessages.EnsureExtensions_IsNotInRange_ToHigh.Inject(param.Value, max));
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue