upgraded to autofac 3. created nancy only mode for nzbdrone.exe /n

This commit is contained in:
kay.one 2013-02-17 11:19:38 -08:00
commit b0940ed8de
77 changed files with 3930 additions and 113 deletions

View file

@ -0,0 +1,86 @@
using System;
using System.Diagnostics;
using NzbDrone.Common.EnsureThat.Resources;
namespace NzbDrone.Common.EnsureThat
{
public static class EnsureTypeExtensions
{
private static class Types
{
internal static readonly Type IntType = typeof (int);
internal static readonly Type ShortType = typeof(short);
internal static readonly Type DecimalType = typeof(decimal);
internal static readonly Type DoubleType = typeof(double);
internal static readonly Type FloatType = typeof(float);
internal static readonly Type BoolType = typeof(bool);
internal static readonly Type DateTimeType = typeof(DateTime);
internal static readonly Type StringType = typeof(string);
}
[DebuggerStepThrough]
public static TypeParam IsInt(this TypeParam param)
{
return IsOfType(param, Types.IntType);
}
[DebuggerStepThrough]
public static TypeParam IsShort(this TypeParam param)
{
return IsOfType(param, Types.ShortType);
}
[DebuggerStepThrough]
public static TypeParam IsDecimal(this TypeParam param)
{
return IsOfType(param, Types.DecimalType);
}
[DebuggerStepThrough]
public static TypeParam IsDouble(this TypeParam param)
{
return IsOfType(param, Types.DoubleType);
}
[DebuggerStepThrough]
public static TypeParam IsFloat(this TypeParam param)
{
return IsOfType(param, Types.FloatType);
}
[DebuggerStepThrough]
public static TypeParam IsBool(this TypeParam param)
{
return IsOfType(param, Types.BoolType);
}
[DebuggerStepThrough]
public static TypeParam IsDateTime(this TypeParam param)
{
return IsOfType(param, Types.DateTimeType);
}
[DebuggerStepThrough]
public static TypeParam IsString(this TypeParam param)
{
return IsOfType(param, Types.StringType);
}
[DebuggerStepThrough]
public static TypeParam IsOfType(this TypeParam param, Type type)
{
if (!param.Type.Equals(type))
throw ExceptionFactory.CreateForParamValidation(param.Name,
ExceptionMessages.EnsureExtensions_IsNotOfType.Inject(param.Type.FullName));
return param;
}
}
}