mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
Remove trailing whitespace
This commit is contained in:
parent
8d27111f7b
commit
d4fa9b7345
@ -5,7 +5,7 @@
|
|||||||
using System.Resources;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")]
|
[assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")]
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
|
||||||
|
|
||||||
// This file is used by Code Analysis to maintain SuppressMessage
|
// This file is used by Code Analysis to maintain SuppressMessage
|
||||||
// attributes that are applied to this project.
|
// attributes that are applied to this project.
|
||||||
// Project-level suppressions either have no target or are given
|
// Project-level suppressions either have no target or are given
|
||||||
// a specific target and scoped to a namespace, type, member, etc.
|
// a specific target and scoped to a namespace, type, member, etc.
|
||||||
//
|
//
|
||||||
// To add a suppression to this file, right-click the message in the
|
// To add a suppression to this file, right-click the message in the
|
||||||
// Code Analysis results, point to "Suppress Message", and click
|
// Code Analysis results, point to "Suppress Message", and click
|
||||||
// "In Suppression File".
|
// "In Suppression File".
|
||||||
// You do not need to add suppressions to this file manually.
|
// You do not need to add suppressions to this file manually.
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<!-- Common to all Radarr Projects -->
|
<!-- Common to all Radarr Projects -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<CodeAnalysisRuleSet>$(SolutionDir)Stylecop.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> -->
|
||||||
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||||
@ -92,6 +93,16 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Set up stylecop -->
|
||||||
|
<ItemGroup Condition="'$(RadarrProject)'=='true' and '$(RadarrOutputType)'!='Test'">
|
||||||
|
<!-- StyleCop analysis -->
|
||||||
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<AdditionalFiles Include="$(SolutionDir)stylecop.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Set runtime identifier to local system type if not specified
|
Set runtime identifier to local system type if not specified
|
||||||
-->
|
-->
|
||||||
|
@ -27,14 +27,14 @@ namespace Marr.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class DataHelper
|
internal static class DataHelper
|
||||||
{
|
{
|
||||||
public static bool HasColumn(this IDataReader dr, string columnName)
|
public static bool HasColumn(this IDataReader dr, string columnName)
|
||||||
{
|
{
|
||||||
for (int i=0; i < dr.FieldCount; i++)
|
for (int i=0; i < dr.FieldCount; i++)
|
||||||
{
|
{
|
||||||
if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
|
if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ParameterPrefix(this IDbCommand command)
|
public static string ParameterPrefix(this IDbCommand command)
|
||||||
@ -42,7 +42,7 @@ public static string ParameterPrefix(this IDbCommand command)
|
|||||||
string commandType = command.GetType().Name.ToLower();
|
string commandType = command.GetType().Name.ToLower();
|
||||||
return commandType.Contains("oracle") ? ":" : "@";
|
return commandType.Contains("oracle") ? ":" : "@";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the mapped name, or the member name.
|
/// Returns the mapped name, or the member name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -131,8 +131,8 @@ public IDbDataParameter AddParameter(IDbDataParameter parameter)
|
|||||||
#region - SP / SQL Mode -
|
#region - SP / SQL Mode -
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value that determines whether the DataMapper will
|
/// Gets or sets a value that determines whether the DataMapper will
|
||||||
/// use a stored procedure or a sql text command to access
|
/// use a stored procedure or a sql text command to access
|
||||||
/// the database. The default is stored procedure.
|
/// the database. The default is stored procedure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SqlModes SqlMode { get; set; }
|
public SqlModes SqlMode { get; set; }
|
||||||
@ -617,7 +617,7 @@ internal ICollection<T> QueryToGraph<T>(string sql, EntityGraph graph, List<Memb
|
|||||||
{
|
{
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
// The entire EntityGraph is traversed for each record,
|
// The entire EntityGraph is traversed for each record,
|
||||||
// and multiple entities are created from each view record.
|
// and multiple entities are created from each view record.
|
||||||
foreach (EntityGraph lvl in graph)
|
foreach (EntityGraph lvl in graph)
|
||||||
{
|
{
|
||||||
|
@ -238,14 +238,14 @@ public bool IsNewGroup(DbDataReader reader)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the GroupingKeys for this entity.
|
/// Gets the GroupingKeys for this entity.
|
||||||
/// GroupingKeys determine when to create and add a new entity to the graph.
|
/// GroupingKeys determine when to create and add a new entity to the graph.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// A simple entity with no relationships will return only its PrimaryKey columns.
|
/// A simple entity with no relationships will return only its PrimaryKey columns.
|
||||||
/// A parent entity with one-to-one child relationships will include its own PrimaryKeys,
|
/// A parent entity with one-to-one child relationships will include its own PrimaryKeys,
|
||||||
/// and it will recursively traverse all Children with one-to-one relationships and add their PrimaryKeys.
|
/// and it will recursively traverse all Children with one-to-one relationships and add their PrimaryKeys.
|
||||||
/// A child entity that has a one-to-one relationship with its parent will use the same
|
/// A child entity that has a one-to-one relationship with its parent will use the same
|
||||||
/// GroupingKeys already defined by its parent.
|
/// GroupingKeys already defined by its parent.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public GroupingKeyCollection GroupingKeyColumns
|
public GroupingKeyCollection GroupingKeyColumns
|
||||||
|
@ -32,11 +32,11 @@ public interface IDataMapper : IDisposable
|
|||||||
DbCommand Command { get; }
|
DbCommand Command { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value that determines whether the DataMapper will
|
/// Gets or sets a value that determines whether the DataMapper will
|
||||||
/// use a stored procedure or a sql text command to access
|
/// use a stored procedure or a sql text command to access
|
||||||
/// the database. The default is stored procedure.
|
/// the database. The default is stored procedure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SqlModes SqlMode { get; set; }
|
SqlModes SqlMode { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -181,10 +181,10 @@ public RelationshipCollection GetRelationships(Type type)
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the reflection strategy that the DataMapper will use to load entities.
|
/// Gets or sets the reflection strategy that the DataMapper will use to load entities.
|
||||||
/// By default the CachedReflector will be used, which provides a performance increase over the SimpleReflector.
|
/// By default the CachedReflector will be used, which provides a performance increase over the SimpleReflector.
|
||||||
/// However, the SimpleReflector can be used in Medium Trust enviroments.
|
/// However, the SimpleReflector can be used in Medium Trust enviroments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
///
|
///
|
||||||
public IReflectionStrategy ReflectionStrategy { get; set; }
|
public IReflectionStrategy ReflectionStrategy { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -236,7 +236,7 @@ internal IConverter GetConverter(Type dataType)
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IDBTypeBuilder that is responsible for converting parameter DbTypes based on the parameter value.
|
/// Gets or sets the IDBTypeBuilder that is responsible for converting parameter DbTypes based on the parameter value.
|
||||||
/// Defaults to use the DbTypeBuilder.
|
/// Defaults to use the DbTypeBuilder.
|
||||||
/// You can replace this with a more specific builder if you want more control over the way the parameter types are set.
|
/// You can replace this with a more specific builder if you want more control over the way the parameter types are set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDbTypeBuilder DbTypeBuilder
|
public IDbTypeBuilder DbTypeBuilder
|
||||||
|
@ -198,7 +198,7 @@ public FluentMappings.MappingsFluentEntity<TNewEntity> Entity<TNewEntity>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to add a ColumnMap for the given field name.
|
/// Tries to add a ColumnMap for the given field name.
|
||||||
/// Throws and exception if field cannot be found.
|
/// Throws and exception if field cannot be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void TryAddColumnMapForField(string fieldName)
|
private void TryAddColumnMapForField(string fieldName)
|
||||||
|
@ -99,7 +99,7 @@ public ColumnMapCollection PrimaryKeys
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses and orders the parameters from the query text.
|
/// Parses and orders the parameters from the query text.
|
||||||
/// Filters the list of mapped columns to match the parameters found in the sql query.
|
/// Filters the list of mapped columns to match the parameters found in the sql query.
|
||||||
/// All parameters starting with the '@' or ':' symbol are matched and returned.
|
/// All parameters starting with the '@' or ':' symbol are matched and returned.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -139,7 +139,7 @@ public ColumnMapCollection OrderParameters(DbCommand command)
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set's each column's altname as the given prefix + the column name.
|
/// Set's each column's altname as the given prefix + the column name.
|
||||||
/// Ex:
|
/// Ex:
|
||||||
/// Original column name: "ID"
|
/// Original column name: "ID"
|
||||||
/// Passed in prefix: "PRODUCT_"
|
/// Passed in prefix: "PRODUCT_"
|
||||||
/// Generated AltName: "PRODUCT_ID"
|
/// Generated AltName: "PRODUCT_ID"
|
||||||
@ -154,7 +154,7 @@ public ColumnMapCollection PrefixAltNames(string prefix)
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set's each column's altname as the column name + the given prefix.
|
/// Set's each column's altname as the column name + the given prefix.
|
||||||
/// Ex:
|
/// Ex:
|
||||||
/// Original column name: "ID"
|
/// Original column name: "ID"
|
||||||
/// Passed in suffix: "_PRODUCT"
|
/// Passed in suffix: "_PRODUCT"
|
||||||
/// Generated AltName: "ID_PRODUCT"
|
/// Generated AltName: "ID_PRODUCT"
|
||||||
|
@ -19,7 +19,7 @@ public FluentMappings()
|
|||||||
public FluentMappings(bool publicOnly)
|
public FluentMappings(bool publicOnly)
|
||||||
{
|
{
|
||||||
_publicOnly = publicOnly;
|
_publicOnly = publicOnly;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MappingsFluentEntity<TEntity> Entity<TEntity>()
|
public MappingsFluentEntity<TEntity> Entity<TEntity>()
|
||||||
@ -77,7 +77,7 @@ public ColumnMapBuilder<TEntity> AutoMapAllProperties()
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates column mappings for the given type.
|
/// Creates column mappings for the given type.
|
||||||
/// Maps all properties that are simple types (int, string, DateTime, etc).
|
/// Maps all properties that are simple types (int, string, DateTime, etc).
|
||||||
/// ICollection properties are not included.
|
/// ICollection properties are not included.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type that is being built.</typeparam>
|
/// <typeparam name="T">The type that is being built.</typeparam>
|
||||||
|
@ -28,5 +28,5 @@ public interface IColumnInfo
|
|||||||
ParameterDirection ParamDirection { get; set; }
|
ParameterDirection ParamDirection { get; set; }
|
||||||
string TryGetAltName();
|
string TryGetAltName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public ColumnMapBuilder<T> BuildColumns<T>()
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates column mappings for the given type.
|
/// Creates column mappings for the given type.
|
||||||
/// Maps all properties that are simple types (int, string, DateTime, etc).
|
/// Maps all properties that are simple types (int, string, DateTime, etc).
|
||||||
/// ICollection properties are not included.
|
/// ICollection properties are not included.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type that is being built.</typeparam>
|
/// <typeparam name="T">The type that is being built.</typeparam>
|
||||||
@ -49,7 +49,7 @@ public ColumnMapBuilder<T> BuildColumnsFromSimpleTypes<T>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates column mappings for the given type.
|
/// Creates column mappings for the given type.
|
||||||
/// Maps properties that are included in the include list.
|
/// Maps properties that are included in the include list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type that is being built.</typeparam>
|
/// <typeparam name="T">The type that is being built.</typeparam>
|
||||||
@ -71,7 +71,7 @@ public ColumnMapBuilder<T> BuildColumns<T>(params string[] propertiesToInclude)
|
|||||||
/// <returns><see cref="ColumnMapCollection"/></returns>
|
/// <returns><see cref="ColumnMapCollection"/></returns>
|
||||||
public ColumnMapBuilder<T> BuildColumnsExcept<T>(params string[] propertiesToExclude)
|
public ColumnMapBuilder<T> BuildColumnsExcept<T>(params string[] propertiesToExclude)
|
||||||
{
|
{
|
||||||
return BuildColumns<T>(m =>
|
return BuildColumns<T>(m =>
|
||||||
m.MemberType == MemberTypes.Property &&
|
m.MemberType == MemberTypes.Property &&
|
||||||
!propertiesToExclude.Contains(m.Name));
|
!propertiesToExclude.Contains(m.Name));
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ public ColumnMapBuilder<T> Columns<T>()
|
|||||||
MapRepository.Instance.Columns[entityType] = columns;
|
MapRepository.Instance.Columns[entityType] = columns;
|
||||||
return new ColumnMapBuilder<T>(null, columns);
|
return new ColumnMapBuilder<T>(null, columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region - Relationships -
|
#region - Relationships -
|
||||||
@ -118,8 +118,8 @@ public ColumnMapBuilder<T> Columns<T>()
|
|||||||
/// <returns><see cref="RelationshipBuilder"/></returns>
|
/// <returns><see cref="RelationshipBuilder"/></returns>
|
||||||
public RelationshipBuilder<T> BuildRelationships<T>()
|
public RelationshipBuilder<T> BuildRelationships<T>()
|
||||||
{
|
{
|
||||||
return BuildRelationships<T>(m =>
|
return BuildRelationships<T>(m =>
|
||||||
m.MemberType == MemberTypes.Property &&
|
m.MemberType == MemberTypes.Property &&
|
||||||
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType));
|
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,10 +132,10 @@ public RelationshipBuilder<T> BuildRelationships<T>()
|
|||||||
/// <returns><see cref="RelationshipBuilder"/></returns>
|
/// <returns><see cref="RelationshipBuilder"/></returns>
|
||||||
public RelationshipBuilder<T> BuildRelationships<T>(params string[] propertiesToInclude)
|
public RelationshipBuilder<T> BuildRelationships<T>(params string[] propertiesToInclude)
|
||||||
{
|
{
|
||||||
Func<MemberInfo, bool> predicate = m =>
|
Func<MemberInfo, bool> predicate = m =>
|
||||||
(
|
(
|
||||||
// ICollection properties
|
// ICollection properties
|
||||||
m.MemberType == MemberTypes.Property &&
|
m.MemberType == MemberTypes.Property &&
|
||||||
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
|
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
|
||||||
propertiesToInclude.Contains(m.Name)
|
propertiesToInclude.Contains(m.Name)
|
||||||
) || ( // Single entity properties
|
) || ( // Single entity properties
|
||||||
@ -143,7 +143,7 @@ public RelationshipBuilder<T> BuildRelationships<T>(params string[] propertiesTo
|
|||||||
!typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
|
!typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
|
||||||
propertiesToInclude.Contains(m.Name)
|
propertiesToInclude.Contains(m.Name)
|
||||||
);
|
);
|
||||||
|
|
||||||
return BuildRelationships<T>(predicate);
|
return BuildRelationships<T>(predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ public RelationshipBuilder<T> Relationships<T>()
|
|||||||
MapRepository.Instance.Relationships[entityType] = relationships;
|
MapRepository.Instance.Relationships[entityType] = relationships;
|
||||||
return new RelationshipBuilder<T>(null, relationships);
|
return new RelationshipBuilder<T>(null, relationships);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region - Tables -
|
#region - Tables -
|
||||||
|
@ -135,7 +135,7 @@ public FluentMappings.MappingsFluentEntity<TNewEntity> Entity<TNewEntity>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to add a Relationship for the given field name.
|
/// Tries to add a Relationship for the given field name.
|
||||||
/// Throws and exception if field cannot be found.
|
/// Throws and exception if field cannot be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void TryAddRelationshipForField(string fieldName)
|
private void TryAddRelationshipForField(string fieldName)
|
||||||
|
@ -23,9 +23,9 @@ public ConventionMapStrategy(bool publicOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Func<MemberInfo, bool> ColumnPredicate;
|
public Func<MemberInfo, bool> ColumnPredicate;
|
||||||
public Func<MemberInfo, bool> RelationshipPredicate;
|
public Func<MemberInfo, bool> RelationshipPredicate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
|
protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ You should have received a copy of the GNU Lesser General Public
|
|||||||
namespace Marr.Data.Mapping.Strategies
|
namespace Marr.Data.Mapping.Strategies
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maps all public properties to DB columns.
|
/// Maps all public properties to DB columns.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PropertyMapStrategy : AttributeMapStrategy
|
public class PropertyMapStrategy : AttributeMapStrategy
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ public ColumnMapCollection MapColumns(Type entityType)
|
|||||||
ColumnAttribute columnAtt = GetColumnAttribute(member);
|
ColumnAttribute columnAtt = GetColumnAttribute(member);
|
||||||
CreateColumnMap(entityType, member, columnAtt, columnMaps);
|
CreateColumnMap(entityType, member, columnAtt, columnMaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
return columnMaps;
|
return columnMaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ protected RelationshipAttribute GetRelationshipAttribute(MemberInfo member)
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inspect a member and optionally add a ColumnMap.
|
/// Inspect a member and optionally add a ColumnMap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public
|
|||||||
namespace Marr.Data.Parameters
|
namespace Marr.Data.Parameters
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts from a .NET datatype to the appropriate DB type enum,
|
/// Converts from a .NET datatype to the appropriate DB type enum,
|
||||||
/// and then adds the value to the appropriate property on the parameter.
|
/// and then adds the value to the appropriate property on the parameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IDbTypeBuilder
|
public interface IDbTypeBuilder
|
||||||
|
@ -37,7 +37,7 @@ public ParameterChainMethods(DbCommand command, string parameterName, object val
|
|||||||
Parameter.ParameterName = parameterName;
|
Parameter.ParameterName = parameterName;
|
||||||
|
|
||||||
// Convert null to DBNull.Value
|
// Convert null to DBNull.Value
|
||||||
if (value == null)
|
if (value == null)
|
||||||
value = DBNull.Value;
|
value = DBNull.Value;
|
||||||
|
|
||||||
Type valueType = value.GetType();
|
Type valueType = value.GetType();
|
||||||
@ -59,9 +59,9 @@ public ParameterChainMethods(DbCommand command, string parameterName, object val
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Parameter.Value = value;
|
Parameter.Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//// Determine the correct DbType based on the passed in value type
|
//// Determine the correct DbType based on the passed in value type
|
||||||
//IDbTypeBuilder typeBuilder = MapRepository.Instance.DbTypeBuilder;
|
//IDbTypeBuilder typeBuilder = MapRepository.Instance.DbTypeBuilder;
|
||||||
@ -122,7 +122,7 @@ public ParameterChainMethods Scale(byte scale)
|
|||||||
Parameter.Scale = scale;
|
Parameter.Scale = scale;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParameterChainMethods Name(string name)
|
public ParameterChainMethods Name(string name)
|
||||||
{
|
{
|
||||||
Parameter.ParameterName = name;
|
Parameter.ParameterName = name;
|
||||||
|
@ -21,7 +21,7 @@ public DeleteQuery(Dialect dialect, Table targetTable, string whereClause)
|
|||||||
public string Generate()
|
public string Generate()
|
||||||
{
|
{
|
||||||
return string.Format("DELETE FROM {0} {1} ",
|
return string.Format("DELETE FROM {0} {1} ",
|
||||||
Dialect.CreateToken(TargetTable.Name),
|
Dialect.CreateToken(TargetTable.Name),
|
||||||
WhereClause);
|
WhereClause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
namespace Marr.Data.QGen
|
namespace Marr.Data.QGen
|
||||||
{
|
{
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Expression visitor
|
/// Expression visitor
|
||||||
///</summary>
|
///</summary>
|
||||||
public class ExpressionVisitor
|
public class ExpressionVisitor
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ public virtual object Execute()
|
|||||||
_db.CloseConnection();
|
_db.CloseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_generateQuery)
|
if (_generateQuery)
|
||||||
{
|
{
|
||||||
// Return to previous sql mode
|
// Return to previous sql mode
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace Marr.Data.QGen
|
namespace Marr.Data.QGen
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class overrides the WhereBuilder which utilizes the ExpressionVisitor base class,
|
/// This class overrides the WhereBuilder which utilizes the ExpressionVisitor base class,
|
||||||
/// and it is responsible for translating the lambda expression into a "JOIN ON" clause.
|
/// and it is responsible for translating the lambda expression into a "JOIN ON" clause.
|
||||||
/// It populates the protected string builder, which outputs the "JOIN ON" clause when the ToString method is called.
|
/// It populates the protected string builder, which outputs the "JOIN ON" clause when the ToString method is called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -27,7 +27,7 @@ public PagingQueryDecorator(SelectQuery innerQuery, int skip, int take)
|
|||||||
public string Generate()
|
public string Generate()
|
||||||
{
|
{
|
||||||
// Decide which type of paging query to create
|
// Decide which type of paging query to create
|
||||||
|
|
||||||
if (_innerQuery.IsView || _innerQuery.IsJoin)
|
if (_innerQuery.IsView || _innerQuery.IsJoin)
|
||||||
{
|
{
|
||||||
return ComplexPaging();
|
return ComplexPaging();
|
||||||
@ -56,7 +56,7 @@ private string SimplePaging()
|
|||||||
|
|
||||||
return sql.ToString();
|
return sql.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a query that pages a view or joined inner query.
|
/// Generates a query that pages a view or joined inner query.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -165,7 +165,7 @@ private void BuildRowNumberColumn(StringBuilder sql)
|
|||||||
{
|
{
|
||||||
orderBy = orderBy.Replace(string.Format("[{0}].", t.Alias), "");
|
orderBy = orderBy.Replace(string.Format("[{0}].", t.Alias), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
sql.AppendFormat(", ROW_NUMBER() OVER ({0}) As RowNumber ", orderBy);
|
sql.AppendFormat(", ROW_NUMBER() OVER ({0}) As RowNumber ", orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ public virtual QueryBuilder<T> Graph(params Expression<Func<T, object>>[] childr
|
|||||||
_isGraph = true;
|
_isGraph = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual QueryBuilder<T> Page(int pageNumber, int pageSize)
|
public virtual QueryBuilder<T> Page(int pageNumber, int pageSize)
|
||||||
{
|
{
|
||||||
_enablePaging = true;
|
_enablePaging = true;
|
||||||
@ -198,7 +198,7 @@ public virtual QueryBuilder<T> Page(int pageNumber, int pageSize)
|
|||||||
_take = pageSize;
|
_take = pageSize;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string[] ParseChildrenToLoad(Expression<Func<T, object>>[] childrenToLoad)
|
private string[] ParseChildrenToLoad(Expression<Func<T, object>>[] childrenToLoad)
|
||||||
{
|
{
|
||||||
List<string> entitiesToLoad = new List<string>();
|
List<string> entitiesToLoad = new List<string>();
|
||||||
@ -208,7 +208,7 @@ private string[] ParseChildrenToLoad(Expression<Func<T, object>>[] childrenToLoa
|
|||||||
{
|
{
|
||||||
MemberInfo member = (exp.Body as MemberExpression).Member;
|
MemberInfo member = (exp.Body as MemberExpression).Member;
|
||||||
entitiesToLoad.Add(member.Name);
|
entitiesToLoad.Add(member.Name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return entitiesToLoad.ToArray();
|
return entitiesToLoad.ToArray();
|
||||||
|
@ -16,7 +16,7 @@ internal class QueryFactory
|
|||||||
private const string DB_OracleDataAccessClient = "Oracle.DataAccess.Client.OracleClientFactory";
|
private const string DB_OracleDataAccessClient = "Oracle.DataAccess.Client.OracleClientFactory";
|
||||||
private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory";
|
private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory";
|
||||||
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
|
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
|
||||||
|
|
||||||
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
|
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
|
||||||
{
|
{
|
||||||
Dialect dialect = CreateDialect(dataMapper);
|
Dialect dialect = CreateDialect(dataMapper);
|
||||||
|
@ -10,7 +10,7 @@ public RowCountQueryDecorator(SelectQuery innerQuery)
|
|||||||
{
|
{
|
||||||
_innerQuery = innerQuery;
|
_innerQuery = innerQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Generate()
|
public string Generate()
|
||||||
{
|
{
|
||||||
// Decide which type of paging query to create
|
// Decide which type of paging query to create
|
||||||
@ -108,12 +108,12 @@ private Table GetBaseTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
WITH GroupCTE AS
|
WITH GroupCTE AS
|
||||||
(
|
(
|
||||||
SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price],
|
SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price],
|
||||||
ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow
|
ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow
|
||||||
FROM [Order] [t0]
|
FROM [Order] [t0]
|
||||||
LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID]))
|
LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID]))
|
||||||
--WHERE (([t0].[OrderName] = @P0))
|
--WHERE (([t0].[OrderName] = @P0))
|
||||||
)
|
)
|
||||||
SELECT * FROM GroupCTE
|
SELECT * FROM GroupCTE
|
||||||
|
@ -131,7 +131,7 @@ public void BuildOrderClause(StringBuilder sql)
|
|||||||
{
|
{
|
||||||
sql.Append(OrderBy.ToString());
|
sql.Append(OrderBy.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BuildGroupBy(StringBuilder sql)
|
public void BuildGroupBy(StringBuilder sql)
|
||||||
{
|
{
|
||||||
var baseTable = this.Tables.First();
|
var baseTable = this.Tables.First();
|
||||||
|
@ -85,7 +85,7 @@ internal SortBuilder<T> OrderByDescending(Type declaringType, string propertyNam
|
|||||||
_sortExpressions.Add(new SortColumn<T>(declaringType, propertyName, SortDirection.Desc));
|
_sortExpressions.Add(new SortColumn<T>(declaringType, propertyName, SortDirection.Desc));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual SortBuilder<T> OrderBy(string orderByClause)
|
public virtual SortBuilder<T> OrderBy(string orderByClause)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(orderByClause))
|
if (string.IsNullOrEmpty(orderByClause))
|
||||||
|
@ -37,7 +37,7 @@ private MemberExpression GetMemberExpression(Expression exp)
|
|||||||
return me;
|
return me;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SortDirection
|
public enum SortDirection
|
||||||
{
|
{
|
||||||
Asc,
|
Asc,
|
||||||
|
@ -10,11 +10,11 @@ public SqliteRowCountQueryDecorator(SelectQuery innerQuery)
|
|||||||
{
|
{
|
||||||
_innerQuery = innerQuery;
|
_innerQuery = innerQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Generate()
|
public string Generate()
|
||||||
{
|
{
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
BuildSelectCountClause(sql);
|
BuildSelectCountClause(sql);
|
||||||
|
|
||||||
if (_innerQuery.IsJoin)
|
if (_innerQuery.IsJoin)
|
||||||
@ -29,7 +29,7 @@ public string Generate()
|
|||||||
|
|
||||||
return sql.ToString();
|
return sql.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
_innerQuery.BuildFromClause(sql);
|
_innerQuery.BuildFromClause(sql);
|
||||||
_innerQuery.BuildJoinClauses(sql);
|
_innerQuery.BuildJoinClauses(sql);
|
||||||
_innerQuery.BuildWhereClause(sql);
|
_innerQuery.BuildWhereClause(sql);
|
||||||
|
@ -155,7 +155,7 @@ public virtual int Execute()
|
|||||||
{
|
{
|
||||||
_db.OpenConnection();
|
_db.OpenConnection();
|
||||||
rowsAffected = _db.Command.ExecuteNonQuery();
|
rowsAffected = _db.Command.ExecuteNonQuery();
|
||||||
_mappingHelper.SetOutputValues<T>(_entity, _mappings.OutputFields);
|
_mappingHelper.SetOutputValues<T>(_entity, _mappings.OutputFields);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ public Table[] Tables
|
|||||||
{
|
{
|
||||||
get { return _tables; }
|
get { return _tables; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -49,7 +49,7 @@ public WhereBuilder(DbCommand command, Dialect dialect, Expression filter, Table
|
|||||||
{
|
{
|
||||||
_sb.AppendFormat("{0} ", PrefixText);
|
_sb.AppendFormat("{0} ", PrefixText);
|
||||||
base.Visit(filter);
|
base.Visit(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string PrefixText
|
protected virtual string PrefixText
|
||||||
@ -93,7 +93,7 @@ protected override Expression VisitMethodCall(MethodCallExpression expression)
|
|||||||
case "EndsWith":
|
case "EndsWith":
|
||||||
Write_EndsWith(expression);
|
Write_EndsWith(expression);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "In":
|
case "In":
|
||||||
Write_In(expression);
|
Write_In(expression);
|
||||||
break;
|
break;
|
||||||
@ -148,14 +148,14 @@ protected override Expression VisitConstant(ConstantExpression expression)
|
|||||||
private object GetRightValue(Expression expression)
|
private object GetRightValue(Expression expression)
|
||||||
{
|
{
|
||||||
object rightValue = null;
|
object rightValue = null;
|
||||||
|
|
||||||
var simpleConstExp = expression as ConstantExpression;
|
var simpleConstExp = expression as ConstantExpression;
|
||||||
if (simpleConstExp == null) // Value is not directly passed in as a constant
|
if (simpleConstExp == null) // Value is not directly passed in as a constant
|
||||||
{
|
{
|
||||||
MemberExpression memberExp = expression as MemberExpression;
|
MemberExpression memberExp = expression as MemberExpression;
|
||||||
ConstantExpression constExp = null;
|
ConstantExpression constExp = null;
|
||||||
|
|
||||||
// Value may be nested in multiple levels of objects/properties, so traverse the MemberExpressions
|
// Value may be nested in multiple levels of objects/properties, so traverse the MemberExpressions
|
||||||
// until a ConstantExpression property value is found, and then unwind the stack to get the value.
|
// until a ConstantExpression property value is found, and then unwind the stack to get the value.
|
||||||
var memberNames = new Stack<string>();
|
var memberNames = new Stack<string>();
|
||||||
|
|
||||||
@ -218,8 +218,8 @@ protected string GetFullyQualifiedColumnName(MemberInfo member, Type declaringTy
|
|||||||
|
|
||||||
private string Decode(BinaryExpression expression)
|
private string Decode(BinaryExpression expression)
|
||||||
{
|
{
|
||||||
bool isRightSideNullConstant = expression.Right.NodeType ==
|
bool isRightSideNullConstant = expression.Right.NodeType ==
|
||||||
ExpressionType.Constant &&
|
ExpressionType.Constant &&
|
||||||
((ConstantExpression)expression.Right).Value == null;
|
((ConstantExpression)expression.Right).Value == null;
|
||||||
|
|
||||||
if (isRightSideNullConstant)
|
if (isRightSideNullConstant)
|
||||||
@ -315,7 +315,7 @@ public override string ToString()
|
|||||||
}
|
}
|
||||||
return _constantWhereClause;
|
return _constantWhereClause;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum WhereAppendType
|
internal enum WhereAppendType
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public static object GetDefaultValue(Type fieldType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the CLR data type of a MemberInfo.
|
/// Gets the CLR data type of a MemberInfo.
|
||||||
/// If the type is nullable, returns the underlying type.
|
/// If the type is nullable, returns the underlying type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="member"></param>
|
/// <param name="member"></param>
|
||||||
|
@ -7,7 +7,7 @@ namespace Marr.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UnitOfWork class can be used to manage the lifetime of an IDataMapper, from creation to disposal.
|
/// The UnitOfWork class can be used to manage the lifetime of an IDataMapper, from creation to disposal.
|
||||||
/// When used in a "using" statement, the UnitOfWork will create and dispose an IDataMapper.
|
/// When used in a "using" statement, the UnitOfWork will create and dispose an IDataMapper.
|
||||||
/// When the SharedContext property is used in a "using" statement,
|
/// When the SharedContext property is used in a "using" statement,
|
||||||
/// it will create a parent unit of work that will share a single IDataMapper with other units of work,
|
/// it will create a parent unit of work that will share a single IDataMapper with other units of work,
|
||||||
/// and the IDataMapper will not be disposed until the shared context is disposed.
|
/// and the IDataMapper will not be disposed until the shared context is disposed.
|
||||||
/// If more than one shared context is created, the IDataMapper will be disposed when the outer most
|
/// If more than one shared context is created, the IDataMapper will be disposed when the outer most
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Marr.Data
|
namespace Marr.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Works in conjunction with the UnitOfWork to create a new
|
/// Works in conjunction with the UnitOfWork to create a new
|
||||||
/// shared context that will preserve a single IDataMapper.
|
/// shared context that will preserve a single IDataMapper.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UnitOfWorkSharedContext : IDisposable
|
public class UnitOfWorkSharedContext : IDisposable
|
||||||
|
@ -59,7 +59,7 @@ public override int Encode(byte[] buffer, int offset)
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader"></param>
|
/// <param name="reader"></param>
|
||||||
internal override void DecodeInternal(RawReader reader)
|
internal override void DecodeInternal(RawReader reader)
|
||||||
@ -133,7 +133,7 @@ public static BEncodedDictionary DecodeTorrent(RawReader reader)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = BEncodedValue.Decode(reader); // the value is a BEncoded value
|
value = BEncodedValue.Decode(reader); // the value is a BEncoded value
|
||||||
|
|
||||||
torrent.dictionary.Add(key, value);
|
torrent.dictionary.Add(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public BEncodedList(IEnumerable<BEncodedValue> list)
|
|||||||
{
|
{
|
||||||
if (list == null)
|
if (list == null)
|
||||||
throw new ArgumentNullException("list");
|
throw new ArgumentNullException("list");
|
||||||
|
|
||||||
this.list = new List<BEncodedValue>(list);
|
this.list = new List<BEncodedValue>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public override int Encode(byte[] buffer, int offset)
|
|||||||
|
|
||||||
int written = offset;
|
int written = offset;
|
||||||
buffer[written++] = (byte)'i';
|
buffer[written++] = (byte)'i';
|
||||||
|
|
||||||
if (number < 0)
|
if (number < 0)
|
||||||
{
|
{
|
||||||
buffer[written++] = (byte)'-';
|
buffer[written++] = (byte)'-';
|
||||||
@ -171,7 +171,7 @@ public int CompareTo(long other)
|
|||||||
|
|
||||||
#region Overridden Methods
|
#region Overridden Methods
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj"></param>
|
/// <param name="obj"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -185,7 +185,7 @@ public override bool Equals(object obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
@ -194,7 +194,7 @@ public override int GetHashCode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -87,7 +87,7 @@ public static BEncodedValue Decode(byte[] buffer, int offset, int length, bool s
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decode BEncoded data in the given stream
|
/// Decode BEncoded data in the given stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">The stream containing the BEncoded data</param>
|
/// <param name="stream">The stream containing the BEncoded data</param>
|
||||||
/// <returns>BEncodedValue containing the data that was in the stream</returns>
|
/// <returns>BEncodedValue containing the data that was in the stream</returns>
|
||||||
@ -177,7 +177,7 @@ public static T Decode<T>(byte[] buffer, int offset, int length, bool strictDeco
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decode BEncoded data in the given stream
|
/// Decode BEncoded data in the given stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">The stream containing the BEncoded data</param>
|
/// <param name="stream">The stream containing the BEncoded data</param>
|
||||||
/// <returns>BEncodedValue containing the data that was in the stream</returns>
|
/// <returns>BEncodedValue containing the data that was in the stream</returns>
|
||||||
|
@ -61,7 +61,7 @@ public bool IsValid(byte[] hash, int hashIndex)
|
|||||||
throw new ArgumentException(string.Format("Hash must be {0} bytes in length", HashCodeLength), "hash");
|
throw new ArgumentException(string.Format("Hash must be {0} bytes in length", HashCodeLength), "hash");
|
||||||
|
|
||||||
if (hashIndex < 0 || hashIndex > this.count)
|
if (hashIndex < 0 || hashIndex > this.count)
|
||||||
throw new ArgumentOutOfRangeException("hashIndex", string.Format("hashIndex must be between 0 and {0}", this.count));
|
throw new ArgumentOutOfRangeException("hashIndex", string.Format("hashIndex must be between 0 and {0}", this.count));
|
||||||
|
|
||||||
int start = hashIndex * HashCodeLength;
|
int start = hashIndex * HashCodeLength;
|
||||||
for (int i = 0; i < HashCodeLength; i++)
|
for (int i = 0; i < HashCodeLength; i++)
|
||||||
|
@ -100,7 +100,7 @@ public static InfoHash FromBase32(string infoHash)
|
|||||||
Check.InfoHash (infoHash);
|
Check.InfoHash (infoHash);
|
||||||
if (infoHash.Length != 32)
|
if (infoHash.Length != 32)
|
||||||
throw new ArgumentException("Infohash must be a base32 encoded 32 character string");
|
throw new ArgumentException("Infohash must be a base32 encoded 32 character string");
|
||||||
|
|
||||||
infoHash = infoHash.ToLower();
|
infoHash = infoHash.ToLower();
|
||||||
int infohashOffset =0 ;
|
int infohashOffset =0 ;
|
||||||
byte[] hash = new byte[20];
|
byte[] hash = new byte[20];
|
||||||
@ -126,7 +126,7 @@ public static InfoHash FromHex(string infoHash)
|
|||||||
Check.InfoHash (infoHash);
|
Check.InfoHash (infoHash);
|
||||||
if (infoHash.Length != 40)
|
if (infoHash.Length != 40)
|
||||||
throw new ArgumentException("Infohash must be 40 characters long");
|
throw new ArgumentException("Infohash must be 40 characters long");
|
||||||
|
|
||||||
byte[] hash = new byte[20];
|
byte[] hash = new byte[20];
|
||||||
for (int i = 0; i < hash.Length; i++)
|
for (int i = 0; i < hash.Length; i++)
|
||||||
hash[i] = byte.Parse(infoHash.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);
|
hash[i] = byte.Parse(infoHash.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);
|
||||||
|
@ -26,7 +26,7 @@ public static long Accumulate<T>(IEnumerable<T> enumerable, Operation<T> action)
|
|||||||
|
|
||||||
foreach (T t in enumerable)
|
foreach (T t in enumerable)
|
||||||
count += action(t);
|
count += action(t);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ public IList<RawTrackerTier> AnnounceUrls
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This dictionary is specific for azureus client
|
/// This dictionary is specific for azureus client
|
||||||
/// It can contain
|
/// It can contain
|
||||||
/// dht_backup_enable (number)
|
/// dht_backup_enable (number)
|
||||||
/// Content (dictionnary)
|
/// Content (dictionnary)
|
||||||
/// Publisher
|
/// Publisher
|
||||||
@ -651,7 +651,7 @@ public static bool TryLoad(byte[] data, out Torrent torrent)
|
|||||||
public static bool TryLoad(Stream stream, out Torrent torrent)
|
public static bool TryLoad(Stream stream, out Torrent torrent)
|
||||||
{
|
{
|
||||||
Check.Stream(stream);
|
Check.Stream(stream);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
torrent = Torrent.Load(stream);
|
torrent = Torrent.Load(stream);
|
||||||
@ -676,7 +676,7 @@ public static bool TryLoad(Uri url, string location, out Torrent torrent)
|
|||||||
{
|
{
|
||||||
Check.Url(url);
|
Check.Url(url);
|
||||||
Check.Location(location);
|
Check.Location(location);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
torrent = Torrent.Load(url, location);
|
torrent = Torrent.Load(url, location);
|
||||||
|
@ -114,11 +114,11 @@ private void CreateEvent(Ical.Net.Calendar calendar, Movie movie, bool cinemasRe
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var occurrence = calendar.Create<CalendarEvent>();
|
var occurrence = calendar.Create<CalendarEvent>();
|
||||||
occurrence.Uid = "NzbDrone_movie_" + movie.Id + (cinemasRelease ? "_cinemas" : "_physical");
|
occurrence.Uid = "NzbDrone_movie_" + movie.Id + (cinemasRelease ? "_cinemas" : "_physical");
|
||||||
occurrence.Status = movie.Status == MovieStatusType.Announced ? EventStatus.Tentative : EventStatus.Confirmed;
|
occurrence.Status = movie.Status == MovieStatusType.Announced ? EventStatus.Tentative : EventStatus.Confirmed;
|
||||||
|
|
||||||
occurrence.Start = new CalDateTime(date.Value);
|
occurrence.Start = new CalDateTime(date.Value);
|
||||||
occurrence.End = occurrence.Start;
|
occurrence.End = occurrence.Start;
|
||||||
occurrence.IsAllDay = true;
|
occurrence.IsAllDay = true;
|
||||||
|
@ -26,7 +26,7 @@ public static UiConfigResource ToResource(IConfigService model)
|
|||||||
{
|
{
|
||||||
FirstDayOfWeek = model.FirstDayOfWeek,
|
FirstDayOfWeek = model.FirstDayOfWeek,
|
||||||
CalendarWeekColumnHeader = model.CalendarWeekColumnHeader,
|
CalendarWeekColumnHeader = model.CalendarWeekColumnHeader,
|
||||||
|
|
||||||
ShortDateFormat = model.ShortDateFormat,
|
ShortDateFormat = model.ShortDateFormat,
|
||||||
LongDateFormat = model.LongDateFormat,
|
LongDateFormat = model.LongDateFormat,
|
||||||
TimeFormat = model.TimeFormat,
|
TimeFormat = model.TimeFormat,
|
||||||
|
@ -12,7 +12,7 @@ public IndexerModule(IndexerFactory indexerFactory)
|
|||||||
protected override void MapToResource(IndexerResource resource, IndexerDefinition definition)
|
protected override void MapToResource(IndexerResource resource, IndexerDefinition definition)
|
||||||
{
|
{
|
||||||
base.MapToResource(resource, definition);
|
base.MapToResource(resource, definition);
|
||||||
|
|
||||||
resource.EnableRss = definition.EnableRss;
|
resource.EnableRss = definition.EnableRss;
|
||||||
resource.EnableSearch = definition.EnableAutomaticSearch || definition.EnableInteractiveSearch;
|
resource.EnableSearch = definition.EnableAutomaticSearch || definition.EnableInteractiveSearch;
|
||||||
resource.SupportsRss = definition.SupportsRss;
|
resource.SupportsRss = definition.SupportsRss;
|
||||||
|
@ -23,7 +23,7 @@ public class ReleaseModule : ReleaseModuleBase
|
|||||||
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
|
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
|
||||||
private readonly IDownloadService _downloadService;
|
private readonly IDownloadService _downloadService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
private readonly ICached<RemoteMovie> _remoteMovieCache;
|
private readonly ICached<RemoteMovie> _remoteMovieCache;
|
||||||
|
|
||||||
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
|
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
|
||||||
@ -46,7 +46,7 @@ public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
|
|||||||
|
|
||||||
//PostValidator.RuleFor(s => s.DownloadAllowed).Equal(true);
|
//PostValidator.RuleFor(s => s.DownloadAllowed).Equal(true);
|
||||||
PostValidator.RuleFor(s => s.Guid).NotEmpty();
|
PostValidator.RuleFor(s => s.Guid).NotEmpty();
|
||||||
|
|
||||||
_remoteMovieCache = cacheManager.GetCache<RemoteMovie>(GetType(), "remoteMovies");
|
_remoteMovieCache = cacheManager.GetCache<RemoteMovie>(GetType(), "remoteMovies");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ protected override ReleaseResource MapDecision(DownloadDecision decision, int in
|
|||||||
{
|
{
|
||||||
|
|
||||||
_remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30));
|
_remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30));
|
||||||
|
|
||||||
return base.MapDecision(decision, initialWeight);
|
return base.MapDecision(decision, initialWeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ private List<LogFileResource> GetLogFilesResponse()
|
|||||||
{
|
{
|
||||||
var file = files[i];
|
var file = files[i];
|
||||||
var filename = Path.GetFileName(file);
|
var filename = Path.GetFileName(file);
|
||||||
|
|
||||||
result.Add(new LogFileResource
|
result.Add(new LogFileResource
|
||||||
{
|
{
|
||||||
Id = i + 1,
|
Id = i + 1,
|
||||||
@ -63,7 +63,7 @@ private object GetLogFileResponse(string filename)
|
|||||||
return new NotFoundResponse();
|
return new NotFoundResponse();
|
||||||
|
|
||||||
var data = _diskProvider.ReadAllText(filePath);
|
var data = _diskProvider.ReadAllText(filePath);
|
||||||
|
|
||||||
return new TextResponse(data);
|
return new TextResponse(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class AlternativeTitleResource : RestResource
|
|||||||
{
|
{
|
||||||
public AlternativeTitleResource()
|
public AlternativeTitleResource()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Todo: Sorters should be done completely on the client
|
//Todo: Sorters should be done completely on the client
|
||||||
|
@ -6,7 +6,7 @@ public class AlternativeYearResource : RestResource
|
|||||||
{
|
{
|
||||||
public AlternativeYearResource()
|
public AlternativeYearResource()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Todo: Sorters should be done completely on the client
|
//Todo: Sorters should be done completely on the client
|
||||||
|
@ -18,7 +18,7 @@ public MovieResource()
|
|||||||
//Todo: Sorters should be done completely on the client
|
//Todo: Sorters should be done completely on the client
|
||||||
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
|
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
|
||||||
//Todo: We should get the entire Profile instead of ID and Name separately
|
//Todo: We should get the entire Profile instead of ID and Name separately
|
||||||
|
|
||||||
//View Only
|
//View Only
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public List<AlternativeTitleResource> AlternativeTitles { get; set; }
|
public List<AlternativeTitleResource> AlternativeTitles { get; set; }
|
||||||
@ -96,9 +96,9 @@ public static MovieResource ToResource(this Core.Movies.Movie model)
|
|||||||
long size = model.MovieFile?.Size ?? 0;
|
long size = model.MovieFile?.Size ?? 0;
|
||||||
bool downloaded = model.MovieFile != null;
|
bool downloaded = model.MovieFile != null;
|
||||||
MovieFileResource movieFile = model.MovieFile?.ToResource();
|
MovieFileResource movieFile = model.MovieFile?.ToResource();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*if(model.MovieFile != null)
|
/*if(model.MovieFile != null)
|
||||||
{
|
{
|
||||||
model.MovieFile.LazyLoad();
|
model.MovieFile.LazyLoad();
|
||||||
@ -110,7 +110,7 @@ public static MovieResource ToResource(this Core.Movies.Movie model)
|
|||||||
downloaded = true;
|
downloaded = true;
|
||||||
movieFile = model.MovieFile.Value.ToResource();
|
movieFile = model.MovieFile.Value.ToResource();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//model.AlternativeTitles.LazyLoad();
|
//model.AlternativeTitles.LazyLoad();
|
||||||
|
|
||||||
return new MovieResource
|
return new MovieResource
|
||||||
@ -134,18 +134,18 @@ public static MovieResource ToResource(this Core.Movies.Movie model)
|
|||||||
//NextAiring
|
//NextAiring
|
||||||
//PreviousAiring
|
//PreviousAiring
|
||||||
Images = model.Images,
|
Images = model.Images,
|
||||||
|
|
||||||
Year = model.Year,
|
Year = model.Year,
|
||||||
SecondaryYear = model.SecondaryYear,
|
SecondaryYear = model.SecondaryYear,
|
||||||
SecondaryYearSourceId = model.SecondaryYearSourceId,
|
SecondaryYearSourceId = model.SecondaryYearSourceId,
|
||||||
|
|
||||||
Path = model.Path,
|
Path = model.Path,
|
||||||
ProfileId = model.ProfileId,
|
ProfileId = model.ProfileId,
|
||||||
PathState = model.PathState,
|
PathState = model.PathState,
|
||||||
|
|
||||||
Monitored = model.Monitored,
|
Monitored = model.Monitored,
|
||||||
MinimumAvailability = model.MinimumAvailability,
|
MinimumAvailability = model.MinimumAvailability,
|
||||||
|
|
||||||
IsAvailable = model.IsAvailable(),
|
IsAvailable = model.IsAvailable(),
|
||||||
FolderName = model.FolderName(),
|
FolderName = model.FolderName(),
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ public static Core.Movies.Movie ToModel(this MovieResource resource)
|
|||||||
|
|
||||||
Monitored = resource.Monitored,
|
Monitored = resource.Monitored,
|
||||||
MinimumAvailability = resource.MinimumAvailability,
|
MinimumAvailability = resource.MinimumAvailability,
|
||||||
|
|
||||||
Runtime = resource.Runtime,
|
Runtime = resource.Runtime,
|
||||||
LastInfoSync = resource.LastInfoSync,
|
LastInfoSync = resource.LastInfoSync,
|
||||||
CleanTitle = resource.CleanTitle,
|
CleanTitle = resource.CleanTitle,
|
||||||
|
@ -27,7 +27,7 @@ public ImportExclusionsResource GetById(int id)
|
|||||||
{
|
{
|
||||||
return _exclusionService.GetById(id).ToResource();
|
return _exclusionService.GetById(id).ToResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int AddExclusion(ImportExclusionsResource exclusionResource)
|
public int AddExclusion(ImportExclusionsResource exclusionResource)
|
||||||
{
|
{
|
||||||
var model = exclusionResource.ToModel();
|
var model = exclusionResource.ToModel();
|
||||||
|
@ -12,7 +12,7 @@ public NotificationModule(NotificationFactory notificationFactory)
|
|||||||
protected override void MapToResource(NotificationResource resource, NotificationDefinition definition)
|
protected override void MapToResource(NotificationResource resource, NotificationDefinition definition)
|
||||||
{
|
{
|
||||||
base.MapToResource(resource, definition);
|
base.MapToResource(resource, definition);
|
||||||
|
|
||||||
resource.OnGrab = definition.OnGrab;
|
resource.OnGrab = definition.OnGrab;
|
||||||
resource.OnDownload = definition.OnDownload;
|
resource.OnDownload = definition.OnDownload;
|
||||||
resource.OnUpgrade = definition.OnUpgrade;
|
resource.OnUpgrade = definition.OnUpgrade;
|
||||||
|
@ -88,7 +88,7 @@ private object Import()
|
|||||||
{
|
{
|
||||||
var resource = Request.Body.FromJson<QueueResource>();
|
var resource = Request.Body.FromJson<QueueResource>();
|
||||||
var trackedDownload = GetTrackedDownload(resource.Id);
|
var trackedDownload = GetTrackedDownload(resource.Id);
|
||||||
|
|
||||||
_completedDownloadService.Process(trackedDownload, true);
|
_completedDownloadService.Process(trackedDownload, true);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
|
@ -10,9 +10,9 @@ namespace NzbDrone.Api.Wanted
|
|||||||
{
|
{
|
||||||
class MovieMissingModule : MovieModuleWithSignalR
|
class MovieMissingModule : MovieModuleWithSignalR
|
||||||
{
|
{
|
||||||
public MovieMissingModule(IMovieService movieService,
|
public MovieMissingModule(IMovieService movieService,
|
||||||
IUpgradableSpecification qualityUpgradableSpecification,
|
IUpgradableSpecification qualityUpgradableSpecification,
|
||||||
IBroadcastSignalRMessage signalRBroadcaster)
|
IBroadcastSignalRMessage signalRBroadcaster)
|
||||||
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
|
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
|
||||||
{
|
{
|
||||||
GetResourcePaged = GetMissingMovies;
|
GetResourcePaged = GetMissingMovies;
|
||||||
|
@ -76,7 +76,7 @@ public void should_not_contain_recycling_bin_or_system_volume_information_for_ro
|
|||||||
.Returns(_folders);
|
.Returns(_folders);
|
||||||
|
|
||||||
var result = Subject.LookupContents(root, false, false);
|
var result = Subject.LookupContents(root, false, false);
|
||||||
|
|
||||||
result.Directories.Should().HaveCount(_folders.Count - 3);
|
result.Directories.Should().HaveCount(_folders.Count - 3);
|
||||||
|
|
||||||
result.Directories.Should().NotContain(f => f.Name == RECYCLING_BIN);
|
result.Directories.Should().NotContain(f => f.Name == RECYCLING_BIN);
|
||||||
|
@ -62,7 +62,7 @@ public void should_throw_if_drive_doesnt_exist()
|
|||||||
{
|
{
|
||||||
if (new DriveInfo(driveletter.ToString()).IsReady)
|
if (new DriveInfo(driveletter.ToString()).IsReady)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace(driveletter + @":\NOT_A_REAL_PATH\DOES_NOT_EXIST".AsOsAgnostic()));
|
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace(driveletter + @":\NOT_A_REAL_PATH\DOES_NOT_EXIST".AsOsAgnostic()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public void should_preserver_no_browser(string arg, string preserved)
|
|||||||
args.PreservedArguments.Should().Be(preserved);
|
args.PreservedArguments.Should().Be(preserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_preserver_both()
|
public void should_preserver_both()
|
||||||
{
|
{
|
||||||
|
@ -301,7 +301,7 @@ public void FolderSetLastWriteTime(string path, DateTime dateTime)
|
|||||||
public void FileSetLastWriteTime(string path, DateTime dateTime)
|
public void FileSetLastWriteTime(string path, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
||||||
if (dateTime.Before(DateTimeExtensions.Epoch))
|
if (dateTime.Before(DateTimeExtensions.Epoch))
|
||||||
{
|
{
|
||||||
dateTime = DateTimeExtensions.Epoch;
|
dateTime = DateTimeExtensions.Epoch;
|
||||||
|
@ -97,7 +97,7 @@ public bool IsRooted
|
|||||||
{
|
{
|
||||||
return _path.StartsWith("/");
|
return _path.StartsWith("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public OsPath Directory
|
|||||||
{
|
{
|
||||||
return new OsPath(null);
|
return new OsPath(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new OsPath(_path.Substring(0, index), _kind).AsDirectory();
|
return new OsPath(_path.Substring(0, index), _kind).AsDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public string FileName
|
|||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _path.Substring(index).Trim('\\', '/');
|
return _path.Substring(index).Trim('\\', '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ namespace NzbDrone.Common.EnsureThat.Resources {
|
|||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class ExceptionMessages {
|
internal class ExceptionMessages {
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
internal ExceptionMessages() {
|
internal ExceptionMessages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -42,7 +42,7 @@ internal ExceptionMessages() {
|
|||||||
return resourceMan;
|
return resourceMan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
/// resource lookups using this strongly typed resource class.
|
/// resource lookups using this strongly typed resource class.
|
||||||
@ -56,7 +56,7 @@ internal ExceptionMessages() {
|
|||||||
resourceCulture = value;
|
resourceCulture = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Empty collection is not allowed..
|
/// Looks up a localized string similar to Empty collection is not allowed..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -65,7 +65,7 @@ internal static string EnsureExtensions_IsEmptyCollection {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsEmptyCollection", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsEmptyCollection", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Empty Guid is not allowed..
|
/// Looks up a localized string similar to Empty Guid is not allowed..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -74,7 +74,7 @@ internal static string EnsureExtensions_IsEmptyGuid {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsEmptyGuid", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsEmptyGuid", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Expected an expression that evaluates to false..
|
/// Looks up a localized string similar to Expected an expression that evaluates to false..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,7 +83,7 @@ internal static string EnsureExtensions_IsNotFalse {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotFalse", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotFalse", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is not greater than limit '{1}'..
|
/// Looks up a localized string similar to value '{0}' is not greater than limit '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -92,7 +92,7 @@ internal static string EnsureExtensions_IsNotGt {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotGt", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotGt", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is not greater than or equal to limit '{1}'..
|
/// Looks up a localized string similar to value '{0}' is not greater than or equal to limit '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -101,7 +101,7 @@ internal static string EnsureExtensions_IsNotGte {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotGte", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotGte", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is > max '{1}'..
|
/// Looks up a localized string similar to value '{0}' is > max '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -110,7 +110,7 @@ internal static string EnsureExtensions_IsNotInRange_ToHigh {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToHigh", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToHigh", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The string is too long. Must be between '{0}' and '{1}'. Must be between '{0}' and '{1}' but was '{2}' characters long..
|
/// Looks up a localized string similar to The string is too long. Must be between '{0}' and '{1}'. Must be between '{0}' and '{1}' but was '{2}' characters long..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -119,7 +119,7 @@ internal static string EnsureExtensions_IsNotInRange_ToLong {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLong", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLong", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is < min '{1}'..
|
/// Looks up a localized string similar to value '{0}' is < min '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -128,7 +128,7 @@ internal static string EnsureExtensions_IsNotInRange_ToLow {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLow", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLow", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The string is not long enough. Must be between '{0}' and '{1}' but was '{2}' characters long..
|
/// Looks up a localized string similar to The string is not long enough. Must be between '{0}' and '{1}' but was '{2}' characters long..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -137,7 +137,7 @@ internal static string EnsureExtensions_IsNotInRange_ToShort {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToShort", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToShort", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is not lower than limit '{1}'..
|
/// Looks up a localized string similar to value '{0}' is not lower than limit '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -146,7 +146,7 @@ internal static string EnsureExtensions_IsNotLt {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotLt", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotLt", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' is not lower than or equal to limit '{1}'..
|
/// Looks up a localized string similar to value '{0}' is not lower than or equal to limit '{1}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -155,7 +155,7 @@ internal static string EnsureExtensions_IsNotLte {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotLte", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotLte", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Value can not be null..
|
/// Looks up a localized string similar to Value can not be null..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -164,7 +164,7 @@ internal static string EnsureExtensions_IsNotNull {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotNull", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotNull", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The string can't be null or empty..
|
/// Looks up a localized string similar to The string can't be null or empty..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -173,7 +173,7 @@ internal static string EnsureExtensions_IsNotNullOrEmpty {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrEmpty", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrEmpty", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The string can't be left empty, null or consist of only whitespaces..
|
/// Looks up a localized string similar to The string can't be left empty, null or consist of only whitespaces..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -182,7 +182,7 @@ internal static string EnsureExtensions_IsNotNullOrWhiteSpace {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrWhiteSpace", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrWhiteSpace", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The param is not of expected type: '{0}'..
|
/// Looks up a localized string similar to The param is not of expected type: '{0}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -191,7 +191,7 @@ internal static string EnsureExtensions_IsNotOfType {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotOfType", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotOfType", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Expected an expression that evaluates to true..
|
/// Looks up a localized string similar to Expected an expression that evaluates to true..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -200,7 +200,7 @@ internal static string EnsureExtensions_IsNotTrue {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_IsNotTrue", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_IsNotTrue", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to value '{0}' does not match '{1}'.
|
/// Looks up a localized string similar to value '{0}' does not match '{1}'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -209,7 +209,7 @@ internal static string EnsureExtensions_NoMatch {
|
|||||||
return ResourceManager.GetString("EnsureExtensions_NoMatch", resourceCulture);
|
return ResourceManager.GetString("EnsureExtensions_NoMatch", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to No MemberExpression found in expression: '{0}'..
|
/// Looks up a localized string similar to No MemberExpression found in expression: '{0}'..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -47,7 +47,7 @@ public void Register()
|
|||||||
{
|
{
|
||||||
throw new RadarrStartupException("Cannot create AppFolder, Access to the path {0} is denied", _appFolderInfo.AppDataFolder);
|
throw new RadarrStartupException("Cannot create AppFolder, Access to the path {0} is denied", _appFolderInfo.AppDataFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (OsInfo.IsWindows)
|
if (OsInfo.IsWindows)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public static bool Between(this DateTime dateTime, DateTime afterDateTime, DateT
|
|||||||
{
|
{
|
||||||
return dateTime >= afterDateTime && dateTime <= beforeDateTime;
|
return dateTime >= afterDateTime && dateTime <= beforeDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
public static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public sealed class HttpAccept
|
|||||||
public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8");
|
public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8");
|
||||||
#endif
|
#endif
|
||||||
public static readonly HttpAccept Html = new HttpAccept("text/html");
|
public static readonly HttpAccept Html = new HttpAccept("text/html");
|
||||||
|
|
||||||
public string Value { get; private set; }
|
public string Value { get; private set; }
|
||||||
|
|
||||||
public HttpAccept(string accept)
|
public HttpAccept(string accept)
|
||||||
|
@ -16,7 +16,7 @@ public class CleanseLogMessage
|
|||||||
new Regex(@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled),
|
new Regex(@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled),
|
||||||
new Regex(@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
new Regex(@"""C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"""C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"""/home/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"""/home/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
|
@ -57,7 +57,7 @@ public class SentryTarget : TargetWithLayout
|
|||||||
private static readonly HashSet<string> IncludeExceptionMessageTypes = new HashSet<string> {
|
private static readonly HashSet<string> IncludeExceptionMessageTypes = new HashSet<string> {
|
||||||
"SQLiteException"
|
"SQLiteException"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly IDictionary<LogLevel, SentryLevel> LoggingLevelMap = new Dictionary<LogLevel, SentryLevel>
|
private static readonly IDictionary<LogLevel, SentryLevel> LoggingLevelMap = new Dictionary<LogLevel, SentryLevel>
|
||||||
{
|
{
|
||||||
{LogLevel.Debug, SentryLevel.Debug},
|
{LogLevel.Debug, SentryLevel.Debug},
|
||||||
@ -244,7 +244,7 @@ public bool IsSentryMessage(LogEventInfo logEvent)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FilteredExceptionMessages.Any(x => logEvent.Exception.Message.Contains(x)))
|
if (FilteredExceptionMessages.Any(x => logEvent.Exception.Message.Contains(x)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,7 +55,7 @@ static OAuthTools()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a random 16-byte lowercase alphanumeric string.
|
/// Generates a random 16-byte lowercase alphanumeric string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso href="http://oauth.net/core/1.0#nonce"/>
|
/// <seealso href="http://oauth.net/core/1.0#nonce"/>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -259,7 +259,7 @@ public static string ConstructRequestUrl(Uri url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a request elements concatentation value to send with a request.
|
/// Creates a request elements concatentation value to send with a request.
|
||||||
/// This is also known as the signature base.
|
/// This is also known as the signature base.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso href="http://oauth.net/core/1.0#rfc.section.9.1.3"/>
|
/// <seealso href="http://oauth.net/core/1.0#rfc.section.9.1.3"/>
|
||||||
@ -276,7 +276,7 @@ public static string ConcatenateRequestElements(string method, string url, WebPa
|
|||||||
var requestMethod = string.Concat(method.ToUpper(), "&");
|
var requestMethod = string.Concat(method.ToUpper(), "&");
|
||||||
var requestUrl = string.Concat(UrlEncodeRelaxed(ConstructRequestUrl(new Uri(url))), "&");
|
var requestUrl = string.Concat(UrlEncodeRelaxed(ConstructRequestUrl(new Uri(url))), "&");
|
||||||
var requestParameters = UrlEncodeRelaxed(NormalizeRequestParameters(parameters));
|
var requestParameters = UrlEncodeRelaxed(NormalizeRequestParameters(parameters));
|
||||||
|
|
||||||
sb.Append(requestMethod);
|
sb.Append(requestMethod);
|
||||||
sb.Append(requestUrl);
|
sb.Append(requestUrl);
|
||||||
sb.Append(requestParameters);
|
sb.Append(requestParameters);
|
||||||
@ -293,7 +293,7 @@ public static string ConcatenateRequestElements(string method, string url, WebPa
|
|||||||
/// <param name="signatureBase">The signature base</param>
|
/// <param name="signatureBase">The signature base</param>
|
||||||
/// <param name="consumerSecret">The consumer key</param>
|
/// <param name="consumerSecret">The consumer key</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
||||||
string signatureBase,
|
string signatureBase,
|
||||||
string consumerSecret)
|
string consumerSecret)
|
||||||
{
|
{
|
||||||
@ -311,7 +311,7 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
|||||||
/// <param name="consumerSecret">The consumer key</param>
|
/// <param name="consumerSecret">The consumer key</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
||||||
OAuthSignatureTreatment signatureTreatment,
|
OAuthSignatureTreatment signatureTreatment,
|
||||||
string signatureBase,
|
string signatureBase,
|
||||||
string consumerSecret)
|
string consumerSecret)
|
||||||
{
|
{
|
||||||
@ -327,7 +327,7 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
|||||||
/// <param name="consumerSecret">The consumer secret</param>
|
/// <param name="consumerSecret">The consumer secret</param>
|
||||||
/// <param name="tokenSecret">The token secret</param>
|
/// <param name="tokenSecret">The token secret</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
||||||
string signatureBase,
|
string signatureBase,
|
||||||
string consumerSecret,
|
string consumerSecret,
|
||||||
string tokenSecret)
|
string tokenSecret)
|
||||||
@ -345,7 +345,7 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
|||||||
/// <param name="consumerSecret">The consumer secret</param>
|
/// <param name="consumerSecret">The consumer secret</param>
|
||||||
/// <param name="tokenSecret">The token secret</param>
|
/// <param name="tokenSecret">The token secret</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
public static string GetSignature(OAuthSignatureMethod signatureMethod,
|
||||||
OAuthSignatureTreatment signatureTreatment,
|
OAuthSignatureTreatment signatureTreatment,
|
||||||
string signatureBase,
|
string signatureBase,
|
||||||
string consumerSecret,
|
string consumerSecret,
|
||||||
|
@ -15,7 +15,7 @@ public virtual WebParameter this[string name]
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var parameters = this.Where(p => p.Name.Equals(name));
|
var parameters = this.Where(p => p.Name.Equals(name));
|
||||||
|
|
||||||
if(parameters.Count() == 0)
|
if(parameters.Count() == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -142,7 +142,7 @@ IEnumerator IEnumerable.GetEnumerator()
|
|||||||
|
|
||||||
public virtual void Add(WebParameter parameter)
|
public virtual void Add(WebParameter parameter)
|
||||||
{
|
{
|
||||||
|
|
||||||
_parameters.Add(parameter);
|
_parameters.Add(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,17 +11,17 @@ public class LimitedConcurrencyLevelTaskScheduler : TaskScheduler
|
|||||||
/// <summary>Whether the current thread is processing work items.</summary>
|
/// <summary>Whether the current thread is processing work items.</summary>
|
||||||
[ThreadStatic]
|
[ThreadStatic]
|
||||||
private static bool _currentThreadIsProcessingItems;
|
private static bool _currentThreadIsProcessingItems;
|
||||||
/// <summary>The list of tasks to be executed.</summary>
|
/// <summary>The list of tasks to be executed.</summary>
|
||||||
private readonly LinkedList<Task> _tasks = new LinkedList<Task>(); // protected by lock(_tasks)
|
private readonly LinkedList<Task> _tasks = new LinkedList<Task>(); // protected by lock(_tasks)
|
||||||
/// <summary>The maximum concurrency level allowed by this scheduler.</summary>
|
/// <summary>The maximum concurrency level allowed by this scheduler.</summary>
|
||||||
private readonly int _maxDegreeOfParallelism;
|
private readonly int _maxDegreeOfParallelism;
|
||||||
/// <summary>Whether the scheduler is currently processing work items.</summary>
|
/// <summary>Whether the scheduler is currently processing work items.</summary>
|
||||||
private int _delegatesQueuedOrRunning = 0; // protected by lock(_tasks)
|
private int _delegatesQueuedOrRunning = 0; // protected by lock(_tasks)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the
|
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the
|
||||||
/// specified degree of parallelism.
|
/// specified degree of parallelism.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param>
|
/// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param>
|
||||||
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
||||||
{
|
{
|
||||||
@ -29,12 +29,12 @@ public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
|||||||
_maxDegreeOfParallelism = maxDegreeOfParallelism;
|
_maxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Queues a task to the scheduler.</summary>
|
/// <summary>Queues a task to the scheduler.</summary>
|
||||||
/// <param name="task">The task to be queued.</param>
|
/// <param name="task">The task to be queued.</param>
|
||||||
protected sealed override void QueueTask(Task task)
|
protected sealed override void QueueTask(Task task)
|
||||||
{
|
{
|
||||||
// Add the task to the list of tasks to be processed. If there aren't enough
|
// Add the task to the list of tasks to be processed. If there aren't enough
|
||||||
// delegates currently queued or running to process tasks, schedule another.
|
// delegates currently queued or running to process tasks, schedule another.
|
||||||
lock (_tasks)
|
lock (_tasks)
|
||||||
{
|
{
|
||||||
_tasks.AddLast(task);
|
_tasks.AddLast(task);
|
||||||
@ -46,26 +46,26 @@ protected sealed override void QueueTask(Task task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Informs the ThreadPool that there's work to be executed for this scheduler.
|
/// Informs the ThreadPool that there's work to be executed for this scheduler.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void NotifyThreadPoolOfPendingWork()
|
private void NotifyThreadPoolOfPendingWork()
|
||||||
{
|
{
|
||||||
ThreadPool.UnsafeQueueUserWorkItem(_ =>
|
ThreadPool.UnsafeQueueUserWorkItem(_ =>
|
||||||
{
|
{
|
||||||
// Note that the current thread is now processing work items.
|
// Note that the current thread is now processing work items.
|
||||||
// This is necessary to enable inlining of tasks into this thread.
|
// This is necessary to enable inlining of tasks into this thread.
|
||||||
_currentThreadIsProcessingItems = true;
|
_currentThreadIsProcessingItems = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Process all available items in the queue.
|
// Process all available items in the queue.
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Task item;
|
Task item;
|
||||||
lock (_tasks)
|
lock (_tasks)
|
||||||
{
|
{
|
||||||
// When there are no more items to be processed,
|
// When there are no more items to be processed,
|
||||||
// note that we're done processing, and get out.
|
// note that we're done processing, and get out.
|
||||||
if (_tasks.Count == 0)
|
if (_tasks.Count == 0)
|
||||||
{
|
{
|
||||||
--_delegatesQueuedOrRunning;
|
--_delegatesQueuedOrRunning;
|
||||||
@ -77,44 +77,44 @@ private void NotifyThreadPoolOfPendingWork()
|
|||||||
_tasks.RemoveFirst();
|
_tasks.RemoveFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the task we pulled out of the queue
|
// Execute the task we pulled out of the queue
|
||||||
base.TryExecuteTask(item);
|
base.TryExecuteTask(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We're done processing items on the current thread
|
// We're done processing items on the current thread
|
||||||
finally { _currentThreadIsProcessingItems = false; }
|
finally { _currentThreadIsProcessingItems = false; }
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Attempts to execute the specified task on the current thread.</summary>
|
/// <summary>Attempts to execute the specified task on the current thread.</summary>
|
||||||
/// <param name="task">The task to be executed.</param>
|
/// <param name="task">The task to be executed.</param>
|
||||||
/// <param name="taskWasPreviouslyQueued"></param>
|
/// <param name="taskWasPreviouslyQueued"></param>
|
||||||
/// <returns>Whether the task could be executed on the current thread.</returns>
|
/// <returns>Whether the task could be executed on the current thread.</returns>
|
||||||
protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
|
protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
|
||||||
{
|
{
|
||||||
// If this thread isn't already processing a task, we don't support inlining
|
// If this thread isn't already processing a task, we don't support inlining
|
||||||
if (!_currentThreadIsProcessingItems) return false;
|
if (!_currentThreadIsProcessingItems) return false;
|
||||||
|
|
||||||
// If the task was previously queued, remove it from the queue
|
// If the task was previously queued, remove it from the queue
|
||||||
if (taskWasPreviouslyQueued) TryDequeue(task);
|
if (taskWasPreviouslyQueued) TryDequeue(task);
|
||||||
|
|
||||||
// Try to run the task.
|
// Try to run the task.
|
||||||
return base.TryExecuteTask(task);
|
return base.TryExecuteTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Attempts to remove a previously scheduled task from the scheduler.</summary>
|
/// <summary>Attempts to remove a previously scheduled task from the scheduler.</summary>
|
||||||
/// <param name="task">The task to be removed.</param>
|
/// <param name="task">The task to be removed.</param>
|
||||||
/// <returns>Whether the task could be found and removed.</returns>
|
/// <returns>Whether the task could be found and removed.</returns>
|
||||||
protected sealed override bool TryDequeue(Task task)
|
protected sealed override bool TryDequeue(Task task)
|
||||||
{
|
{
|
||||||
lock (_tasks) return _tasks.Remove(task);
|
lock (_tasks) return _tasks.Remove(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the maximum concurrency level supported by this scheduler.</summary>
|
/// <summary>Gets the maximum concurrency level supported by this scheduler.</summary>
|
||||||
public sealed override int MaximumConcurrencyLevel => _maxDegreeOfParallelism;
|
public sealed override int MaximumConcurrencyLevel => _maxDegreeOfParallelism;
|
||||||
|
|
||||||
/// <summary>Gets an enumerable of the tasks currently scheduled on this scheduler.</summary>
|
/// <summary>Gets an enumerable of the tasks currently scheduled on this scheduler.</summary>
|
||||||
/// <returns>An enumerable of the tasks currently scheduled.</returns>
|
/// <returns>An enumerable of the tasks currently scheduled.</returns>
|
||||||
protected sealed override IEnumerable<Task> GetScheduledTasks()
|
protected sealed override IEnumerable<Task> GetScheduledTasks()
|
||||||
{
|
{
|
||||||
bool lockTaken = false;
|
bool lockTaken = false;
|
||||||
|
@ -676,7 +676,7 @@ public enum UnregisteredResolutionActions
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to resolve type, even if the type isn't registered.
|
/// Attempt to resolve type, even if the type isn't registered.
|
||||||
///
|
///
|
||||||
/// Registered types/options will always take precedence.
|
/// Registered types/options will always take precedence.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AttemptResolve,
|
AttemptResolve,
|
||||||
@ -689,7 +689,7 @@ public enum UnregisteredResolutionActions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to resolve unregistered type if requested type is generic
|
/// Attempt to resolve unregistered type if requested type is generic
|
||||||
/// and no registration exists for the specific generic parameters used.
|
/// and no registration exists for the specific generic parameters used.
|
||||||
///
|
///
|
||||||
/// Registered types/options will always take precedence.
|
/// Registered types/options will always take precedence.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GenericsOnly
|
GenericsOnly
|
||||||
@ -904,7 +904,7 @@ public RegisterOptions UsingConstructor<RegisterType>(Expression<Func<RegisterTy
|
|||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Switches to a custom lifetime manager factory if possible.
|
/// Switches to a custom lifetime manager factory if possible.
|
||||||
///
|
///
|
||||||
/// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one.
|
/// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="instance">RegisterOptions instance</param>
|
/// <param name="instance">RegisterOptions instance</param>
|
||||||
@ -994,7 +994,7 @@ public TinyIoCContainer GetChildContainer()
|
|||||||
#region Registration
|
#region Registration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
|
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
|
||||||
///
|
///
|
||||||
/// If more than one class implements an interface then only one implementation will be registered
|
/// If more than one class implements an interface then only one implementation will be registered
|
||||||
/// although no error will be thrown.
|
/// although no error will be thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1010,7 +1010,7 @@ public void AutoRegister()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
|
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
|
||||||
/// Types will only be registered if they pass the supplied registration predicate.
|
/// Types will only be registered if they pass the supplied registration predicate.
|
||||||
///
|
///
|
||||||
/// If more than one class implements an interface then only one implementation will be registered
|
/// If more than one class implements an interface then only one implementation will be registered
|
||||||
/// although no error will be thrown.
|
/// although no error will be thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1056,7 +1056,7 @@ public void AutoRegister(DuplicateImplementationActions duplicateAction, Func<Ty
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
|
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
|
||||||
///
|
///
|
||||||
/// If more than one class implements an interface then only one implementation will be registered
|
/// If more than one class implements an interface then only one implementation will be registered
|
||||||
/// although no error will be thrown.
|
/// although no error will be thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1069,7 +1069,7 @@ public void AutoRegister(IEnumerable<Assembly> assemblies)
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
|
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
|
||||||
/// Types will only be registered if they pass the supplied registration predicate.
|
/// Types will only be registered if they pass the supplied registration predicate.
|
||||||
///
|
///
|
||||||
/// If more than one class implements an interface then only one implementation will be registered
|
/// If more than one class implements an interface then only one implementation will be registered
|
||||||
/// although no error will be thrown.
|
/// although no error will be thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1361,7 +1361,7 @@ public RegisterOptions Register<RegisterType>(Func<TinyIoCContainer, NamedParame
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register multiple implementations of a type.
|
/// Register multiple implementations of a type.
|
||||||
///
|
///
|
||||||
/// Internally this registers each implementation using the full name of the class as its registration name.
|
/// Internally this registers each implementation using the full name of the class as its registration name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="RegisterType">Type that each implementation implements</typeparam>
|
/// <typeparam name="RegisterType">Type that each implementation implements</typeparam>
|
||||||
@ -1374,7 +1374,7 @@ public MultiRegisterOptions RegisterMultiple<RegisterType>(IEnumerable<Type> imp
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register multiple implementations of a type.
|
/// Register multiple implementations of a type.
|
||||||
///
|
///
|
||||||
/// Internally this registers each implementation using the full name of the class as its registration name.
|
/// Internally this registers each implementation using the full name of the class as its registration name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="registrationType">Type that each implementation implements</param>
|
/// <param name="registrationType">Type that each implementation implements</param>
|
||||||
@ -1720,7 +1720,7 @@ public bool CanResolve(Type resolveType, string name, ResolveOptions options)
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resolveType">Type to resolve</param>
|
/// <param name="resolveType">Type to resolve</param>
|
||||||
@ -1736,7 +1736,7 @@ public bool CanResolve(Type resolveType, NamedParameterOverloads parameters)
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resolveType">Type to resolve</param>
|
/// <param name="resolveType">Type to resolve</param>
|
||||||
@ -1753,7 +1753,7 @@ public bool CanResolve(Type resolveType, string name, NamedParameterOverloads pa
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resolveType">Type to resolve</param>
|
/// <param name="resolveType">Type to resolve</param>
|
||||||
@ -1770,7 +1770,7 @@ public bool CanResolve(Type resolveType, NamedParameterOverloads parameters, Res
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resolveType">Type to resolve</param>
|
/// <param name="resolveType">Type to resolve</param>
|
||||||
@ -1845,7 +1845,7 @@ public bool CanResolve<ResolveType>(string name, ResolveOptions options)
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
||||||
@ -1862,7 +1862,7 @@ public bool CanResolve<ResolveType>(NamedParameterOverloads parameters)
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
||||||
@ -1880,7 +1880,7 @@ public bool CanResolve<ResolveType>(string name, NamedParameterOverloads paramet
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
||||||
@ -1898,7 +1898,7 @@ public bool CanResolve<ResolveType>(NamedParameterOverloads parameters, ResolveO
|
|||||||
///
|
///
|
||||||
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
|
||||||
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
|
||||||
///
|
///
|
||||||
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
/// <typeparam name="ResolveType">Type to resolve</typeparam>
|
||||||
@ -2360,7 +2360,7 @@ private abstract class ObjectFactoryBase
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to assume this factory sucessfully constructs its objects
|
/// Whether to assume this factory sucessfully constructs its objects
|
||||||
///
|
///
|
||||||
/// Generally set to true for delegate style factories as CanResolve cannot delve
|
/// Generally set to true for delegate style factories as CanResolve cannot delve
|
||||||
/// into the delegates they contain.
|
/// into the delegates they contain.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -2638,7 +2638,7 @@ public void Dispose()
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores an particular instance to return for a type
|
/// Stores an particular instance to return for a type
|
||||||
///
|
///
|
||||||
/// Stores the instance with a weak reference
|
/// Stores the instance with a weak reference
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private class WeakInstanceFactory : ObjectFactoryBase, IDisposable
|
private class WeakInstanceFactory : ObjectFactoryBase, IDisposable
|
||||||
@ -3427,7 +3427,7 @@ private bool CanConstruct(ConstructorInfo ctor, NamedParameterOverloads paramete
|
|||||||
|
|
||||||
var isParameterOverload = parameters.ContainsKey(parameter.Name);
|
var isParameterOverload = parameters.ContainsKey(parameter.Name);
|
||||||
|
|
||||||
//#if NETFX_CORE
|
//#if NETFX_CORE
|
||||||
// if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload)
|
// if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload)
|
||||||
//#else
|
//#else
|
||||||
if (parameter.ParameterType.IsPrimitive() && !isParameterOverload)
|
if (parameter.ParameterType.IsPrimitive() && !isParameterOverload)
|
||||||
@ -3578,7 +3578,7 @@ private static ObjectConstructor CreateObjectConstructionDelegateWithCache(Const
|
|||||||
|
|
||||||
// We could lock the cache here, but there's no real side
|
// We could lock the cache here, but there's no real side
|
||||||
// effect to two threads creating the same ObjectConstructor
|
// effect to two threads creating the same ObjectConstructor
|
||||||
// at the same time, compared to the cost of a lock for
|
// at the same time, compared to the cost of a lock for
|
||||||
// every creation.
|
// every creation.
|
||||||
var constructorParams = constructor.GetParameters();
|
var constructorParams = constructor.GetParameters();
|
||||||
var lambdaParams = Expression.Parameter(typeof(object[]), "parameters");
|
var lambdaParams = Expression.Parameter(typeof(object[]), "parameters");
|
||||||
|
@ -42,7 +42,7 @@ public void Setup()
|
|||||||
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter());
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter());
|
||||||
MapRepository.Instance.RegisterTypeConverter(typeof(int), new Int32Converter());
|
MapRepository.Instance.RegisterTypeConverter(typeof(int), new Int32Converter());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public void should_not_fail_if_series_tags_are_null()
|
|||||||
|
|
||||||
c.Insert.IntoTable("Tags").Row(new
|
c.Insert.IntoTable("Tags").Row(new
|
||||||
{
|
{
|
||||||
Label = "test"
|
Label = "test"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public void should_not_fail_if_no_transmission()
|
|||||||
{
|
{
|
||||||
var db = WithMigrationTestDb(c =>
|
var db = WithMigrationTestDb(c =>
|
||||||
{
|
{
|
||||||
c.Insert.IntoTable("DownloadClients").Row(new
|
c.Insert.IntoTable("DownloadClients").Row(new
|
||||||
{
|
{
|
||||||
Enable = 1,
|
Enable = 1,
|
||||||
Name = "Deluge",
|
Name = "Deluge",
|
||||||
|
@ -15,7 +15,7 @@ public void should_not_fail_if_no_pushbullet()
|
|||||||
{
|
{
|
||||||
var db = WithMigrationTestDb(c =>
|
var db = WithMigrationTestDb(c =>
|
||||||
{
|
{
|
||||||
c.Insert.IntoTable("Notifications").Row(new
|
c.Insert.IntoTable("Notifications").Row(new
|
||||||
{
|
{
|
||||||
OnGrab = false,
|
OnGrab = false,
|
||||||
OnDownload = false,
|
OnDownload = false,
|
||||||
@ -71,7 +71,7 @@ public void should_add_deviceIds_setting_matching_deviceId()
|
|||||||
OnUpgrade = false,
|
OnUpgrade = false,
|
||||||
Name = "PushBullet",
|
Name = "PushBullet",
|
||||||
Implementation = "PushBullet",
|
Implementation = "PushBullet",
|
||||||
Settings = new
|
Settings = new
|
||||||
{
|
{
|
||||||
ApiKey = "my_api_key",
|
ApiKey = "my_api_key",
|
||||||
DeviceId = deviceId
|
DeviceId = deviceId
|
||||||
|
@ -20,7 +20,7 @@ public void should_replace_old_url(string oldUrl)
|
|||||||
{
|
{
|
||||||
var db = WithMigrationTestDb(c =>
|
var db = WithMigrationTestDb(c =>
|
||||||
{
|
{
|
||||||
c.Insert.IntoTable("Indexers").Row(new
|
c.Insert.IntoTable("Indexers").Row(new
|
||||||
{
|
{
|
||||||
Name = "Kickass_wrong_url",
|
Name = "Kickass_wrong_url",
|
||||||
Implementation = "KickassTorrents",
|
Implementation = "KickassTorrents",
|
||||||
|
@ -64,7 +64,7 @@ public void should_parse_column_attributes(string sql)
|
|||||||
result.Columns.First().Name.Should().Be("MyId");
|
result.Columns.First().Name.Should().Be("MyId");
|
||||||
result.Columns.First().Type.Should().BeNull();
|
result.Columns.First().Type.Should().BeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_ignore_unknown_symbols()
|
public void should_ignore_unknown_symbols()
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ public void Setup()
|
|||||||
_remoteEpisode = new RemoteMovie();
|
_remoteEpisode = new RemoteMovie();
|
||||||
_remoteEpisode.Release = new ReleaseInfo();
|
_remoteEpisode.Release = new ReleaseInfo();
|
||||||
_remoteEpisode.Movie = new Movie();
|
_remoteEpisode.Movie = new Movie();
|
||||||
|
|
||||||
_delayProfile = new DelayProfile();
|
_delayProfile = new DelayProfile();
|
||||||
|
|
||||||
Mocker.GetMock<IDelayProfileService>()
|
Mocker.GetMock<IDelayProfileService>()
|
||||||
|
@ -31,7 +31,7 @@ private void WithContainer(string container)
|
|||||||
{
|
{
|
||||||
_remoteMovie.Release.Container = container;
|
_remoteMovie.Release.Container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_no_container_specified()
|
public void should_return_true_if_no_container_specified()
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ private RemoteMovie GetRemoteMovie(QualityModel quality, Movie movie = null, Dow
|
|||||||
MovieTitle = "A Movie",
|
MovieTitle = "A Movie",
|
||||||
},
|
},
|
||||||
Movie = movie,
|
Movie = movie,
|
||||||
|
|
||||||
Release = new ReleaseInfo()
|
Release = new ReleaseInfo()
|
||||||
{
|
{
|
||||||
PublishDate = DateTime.UtcNow,
|
PublishDate = DateTime.UtcNow,
|
||||||
|
@ -119,7 +119,7 @@ protected void GivenSuccessfulDownload()
|
|||||||
.Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951".ToLower())
|
.Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951".ToLower())
|
||||||
.Callback(PrepareClientToReturnQueuedItem);
|
.Callback(PrepareClientToReturnQueuedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void GivenTorrents(List<DelugeTorrent> torrents)
|
protected virtual void GivenTorrents(List<DelugeTorrent> torrents)
|
||||||
{
|
{
|
||||||
if (torrents == null)
|
if (torrents == null)
|
||||||
@ -134,7 +134,7 @@ protected virtual void GivenTorrents(List<DelugeTorrent> torrents)
|
|||||||
|
|
||||||
protected void PrepareClientToReturnQueuedItem()
|
protected void PrepareClientToReturnQueuedItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<DelugeTorrent>
|
GivenTorrents(new List<DelugeTorrent>
|
||||||
{
|
{
|
||||||
_queued
|
_queued
|
||||||
});
|
});
|
||||||
@ -142,7 +142,7 @@ protected void PrepareClientToReturnQueuedItem()
|
|||||||
|
|
||||||
protected void PrepareClientToReturnDownloadingItem()
|
protected void PrepareClientToReturnDownloadingItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<DelugeTorrent>
|
GivenTorrents(new List<DelugeTorrent>
|
||||||
{
|
{
|
||||||
_downloading
|
_downloading
|
||||||
});
|
});
|
||||||
@ -150,7 +150,7 @@ protected void PrepareClientToReturnDownloadingItem()
|
|||||||
|
|
||||||
protected void PrepareClientToReturnFailedItem()
|
protected void PrepareClientToReturnFailedItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<DelugeTorrent>
|
GivenTorrents(new List<DelugeTorrent>
|
||||||
{
|
{
|
||||||
_failed
|
_failed
|
||||||
});
|
});
|
||||||
|
@ -565,7 +565,7 @@ public void should_not_fetch_details_twice()
|
|||||||
var item = Subject.GetItems().Single();
|
var item = Subject.GetItems().Single();
|
||||||
item.CanBeRemoved.Should().BeFalse();
|
item.CanBeRemoved.Should().BeFalse();
|
||||||
item.CanMoveFiles.Should().BeFalse();
|
item.CanMoveFiles.Should().BeFalse();
|
||||||
|
|
||||||
var item2 = Subject.GetItems().Single();
|
var item2 = Subject.GetItems().Single();
|
||||||
|
|
||||||
Mocker.GetMock<IQBittorrentProxy>()
|
Mocker.GetMock<IQBittorrentProxy>()
|
||||||
|
@ -144,7 +144,7 @@ protected void GivenSuccessfulDownload()
|
|||||||
.Setup(s => s.AddTorrentFromData(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<TransmissionSettings>()))
|
.Setup(s => s.AddTorrentFromData(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<TransmissionSettings>()))
|
||||||
.Callback(PrepareClientToReturnQueuedItem);
|
.Callback(PrepareClientToReturnQueuedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void GivenTorrents(List<TransmissionTorrent> torrents)
|
protected virtual void GivenTorrents(List<TransmissionTorrent> torrents)
|
||||||
{
|
{
|
||||||
if (torrents == null)
|
if (torrents == null)
|
||||||
@ -159,7 +159,7 @@ protected virtual void GivenTorrents(List<TransmissionTorrent> torrents)
|
|||||||
|
|
||||||
protected void PrepareClientToReturnQueuedItem()
|
protected void PrepareClientToReturnQueuedItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<TransmissionTorrent>
|
GivenTorrents(new List<TransmissionTorrent>
|
||||||
{
|
{
|
||||||
_queued
|
_queued
|
||||||
});
|
});
|
||||||
@ -167,7 +167,7 @@ protected void PrepareClientToReturnQueuedItem()
|
|||||||
|
|
||||||
protected void PrepareClientToReturnDownloadingItem()
|
protected void PrepareClientToReturnDownloadingItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<TransmissionTorrent>
|
GivenTorrents(new List<TransmissionTorrent>
|
||||||
{
|
{
|
||||||
_downloading
|
_downloading
|
||||||
});
|
});
|
||||||
@ -175,7 +175,7 @@ protected void PrepareClientToReturnDownloadingItem()
|
|||||||
|
|
||||||
protected void PrepareClientToReturnFailedItem()
|
protected void PrepareClientToReturnFailedItem()
|
||||||
{
|
{
|
||||||
GivenTorrents(new List<TransmissionTorrent>
|
GivenTorrents(new List<TransmissionTorrent>
|
||||||
{
|
{
|
||||||
_failed
|
_failed
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@ public void Download_report_should_publish_on_grab_event()
|
|||||||
{
|
{
|
||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
|
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
|
||||||
|
|
||||||
Subject.DownloadReport(_parseResult);
|
Subject.DownloadReport(_parseResult);
|
||||||
|
|
||||||
VerifyEventPublished<MovieGrabbedEvent>();
|
VerifyEventPublished<MovieGrabbedEvent>();
|
||||||
@ -85,7 +85,7 @@ public void Download_report_should_grab_using_client()
|
|||||||
{
|
{
|
||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
|
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
|
||||||
|
|
||||||
Subject.DownloadReport(_parseResult);
|
Subject.DownloadReport(_parseResult);
|
||||||
|
|
||||||
mock.Verify(s => s.Download(It.IsAny<RemoteMovie>()), Times.Once());
|
mock.Verify(s => s.Download(It.IsAny<RemoteMovie>()), Times.Once());
|
||||||
@ -109,7 +109,7 @@ public void Download_report_should_trigger_indexer_backoff_on_indexer_error()
|
|||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
|
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
|
||||||
.Callback<RemoteMovie>(v => {
|
.Callback<RemoteMovie>(v => {
|
||||||
throw new ReleaseDownloadException(v.Release, "Error", new WebException());
|
throw new ReleaseDownloadException(v.Release, "Error", new WebException());
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
||||||
@ -128,7 +128,7 @@ public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_
|
|||||||
var mock = WithUsenetClient();
|
var mock = WithUsenetClient();
|
||||||
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
|
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
|
||||||
.Callback<RemoteMovie>(v => {
|
.Callback<RemoteMovie>(v => {
|
||||||
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
|
||||||
|
@ -69,7 +69,7 @@ public void Setup()
|
|||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
.Setup(s => s.GetMovie(It.IsAny<int>()))
|
.Setup(s => s.GetMovie(It.IsAny<int>()))
|
||||||
.Returns(_movie);
|
.Returns(_movie);
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
.Setup(s => s.GetMovies(It.IsAny<IEnumerable<int>>()))
|
.Setup(s => s.GetMovies(It.IsAny<IEnumerable<int>>()))
|
||||||
.Returns(new List<Movie> { _movie });
|
.Returns(new List<Movie> { _movie });
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
||||||
public class FluentTest : CoreTest
|
public class FluentTest : CoreTest
|
||||||
{
|
{
|
||||||
[TestCase(null, "def", "def")]
|
[TestCase(null, "def", "def")]
|
||||||
@ -87,10 +87,10 @@ public void ToBestDateTime_Before_Yesterday()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MaxOrDefault_should_return_zero_when_collection_is_empty()
|
public void MaxOrDefault_should_return_zero_when_collection_is_empty()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = (new List<int>()).MaxOrDefault();
|
var result = (new List<int>()).MaxOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -100,10 +100,10 @@ public void MaxOrDefault_should_return_zero_when_collection_is_empty()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MaxOrDefault_should_return_max_when_collection_is_not_empty()
|
public void MaxOrDefault_should_return_max_when_collection_is_not_empty()
|
||||||
{
|
{
|
||||||
|
|
||||||
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
||||||
|
|
||||||
|
|
||||||
var result = list.MaxOrDefault();
|
var result = list.MaxOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -113,10 +113,10 @@ public void MaxOrDefault_should_return_max_when_collection_is_not_empty()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MaxOrDefault_should_return_zero_when_collection_is_null()
|
public void MaxOrDefault_should_return_zero_when_collection_is_null()
|
||||||
{
|
{
|
||||||
|
|
||||||
List<int> list = null;
|
List<int> list = null;
|
||||||
|
|
||||||
|
|
||||||
var result = list.MaxOrDefault();
|
var result = list.MaxOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -126,10 +126,10 @@ public void MaxOrDefault_should_return_zero_when_collection_is_null()
|
|||||||
[Test]
|
[Test]
|
||||||
public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes()
|
public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes()
|
||||||
{
|
{
|
||||||
|
|
||||||
var str = ReadAllText("Files/LongOverview.txt");
|
var str = ReadAllText("Files/LongOverview.txt");
|
||||||
|
|
||||||
|
|
||||||
var resultString = str.Truncate(1000);
|
var resultString = str.Truncate(1000);
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -140,10 +140,10 @@ public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes()
|
|||||||
[Test]
|
[Test]
|
||||||
public void Truncate_should_not_truncate_string_shorter_than_max_bytes()
|
public void Truncate_should_not_truncate_string_shorter_than_max_bytes()
|
||||||
{
|
{
|
||||||
|
|
||||||
var str = "Hello World";
|
var str = "Hello World";
|
||||||
|
|
||||||
|
|
||||||
var resultString = str.Truncate(1000);
|
var resultString = str.Truncate(1000);
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -154,10 +154,10 @@ public void Truncate_should_not_truncate_string_shorter_than_max_bytes()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MinOrDefault_should_return_zero_when_collection_is_empty()
|
public void MinOrDefault_should_return_zero_when_collection_is_empty()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = (new List<int>()).MinOrDefault();
|
var result = (new List<int>()).MinOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -167,10 +167,10 @@ public void MinOrDefault_should_return_zero_when_collection_is_empty()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MinOrDefault_should_return_min_when_collection_is_not_empty()
|
public void MinOrDefault_should_return_min_when_collection_is_not_empty()
|
||||||
{
|
{
|
||||||
|
|
||||||
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
||||||
|
|
||||||
|
|
||||||
var result = list.MinOrDefault();
|
var result = list.MinOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
@ -180,10 +180,10 @@ public void MinOrDefault_should_return_min_when_collection_is_not_empty()
|
|||||||
[Test]
|
[Test]
|
||||||
public void MinOrDefault_should_return_zero_when_collection_is_null()
|
public void MinOrDefault_should_return_zero_when_collection_is_null()
|
||||||
{
|
{
|
||||||
|
|
||||||
List<int> list = null;
|
List<int> list = null;
|
||||||
|
|
||||||
|
|
||||||
var result = list.MinOrDefault();
|
var result = list.MinOrDefault();
|
||||||
|
|
||||||
//Resolve
|
//Resolve
|
||||||
|
@ -25,7 +25,7 @@ public DirectDataMapper(IDatabase database)
|
|||||||
_providerFactory = dataMapper.ProviderFactory;
|
_providerFactory = dataMapper.ProviderFactory;
|
||||||
_connectionString = dataMapper.ConnectionString;
|
_connectionString = dataMapper.ConnectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DbConnection OpenConnection()
|
private DbConnection OpenConnection()
|
||||||
{
|
{
|
||||||
var connection = _providerFactory.CreateConnection();
|
var connection = _providerFactory.CreateConnection();
|
||||||
|
@ -32,10 +32,10 @@ public void should_return_warning_when_completed_download_handling_not_configure
|
|||||||
public void should_return_warning_when_both_completeddownloadhandling_and_dronefactory_are_not_configured()
|
public void should_return_warning_when_both_completeddownloadhandling_and_dronefactory_are_not_configured()
|
||||||
{
|
{
|
||||||
GivenCompletedDownloadHandling(false);
|
GivenCompletedDownloadHandling(false);
|
||||||
|
|
||||||
Subject.Check().ShouldBeWarning();
|
Subject.Check().ShouldBeWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_ok_when_no_issues_found()
|
public void should_return_ok_when_no_issues_found()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public void should_parse_recent_feed_from_newznab_nzb_su()
|
|||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
var releases = Subject.FetchRecent();
|
||||||
|
|
||||||
releases.Should().HaveCount(100);
|
releases.Should().HaveCount(100);
|
||||||
|
@ -35,7 +35,7 @@ public void should_parse_recent_feed_from_omgwtfnzbs()
|
|||||||
Mocker.GetMock<IHttpClient>()
|
Mocker.GetMock<IHttpClient>()
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
var releases = Subject.FetchRecent();
|
||||||
|
|
||||||
releases.Should().HaveCount(100);
|
releases.Should().HaveCount(100);
|
||||||
|
@ -31,13 +31,13 @@ public List<ValidationFailure> TestPublic()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetupNLog()
|
private void SetupNLog()
|
||||||
{
|
{
|
||||||
// Step 1. Create configuration object
|
// Step 1. Create configuration object
|
||||||
var config = new LoggingConfiguration();
|
var config = new LoggingConfiguration();
|
||||||
|
|
||||||
var fileTarget = new FileTarget();
|
var fileTarget = new FileTarget();
|
||||||
config.AddTarget("file", fileTarget);
|
config.AddTarget("file", fileTarget);
|
||||||
|
|
||||||
// Step 3. Set target properties
|
// Step 3. Set target properties
|
||||||
fileTarget.FileName = "${basedir}/log.txt";
|
fileTarget.FileName = "${basedir}/log.txt";
|
||||||
fileTarget.Layout = GetStandardLayout();
|
fileTarget.Layout = GetStandardLayout();
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ public void Setup()
|
|||||||
private void ExecuteAndVerifyCommand(Movie movie)
|
private void ExecuteAndVerifyCommand(Movie movie)
|
||||||
{
|
{
|
||||||
Subject.HandleAsync(new MovieUpdatedEvent(movie));
|
Subject.HandleAsync(new MovieUpdatedEvent(movie));
|
||||||
|
|
||||||
Mocker.GetMock<IManageCommandQueue>()
|
Mocker.GetMock<IManageCommandQueue>()
|
||||||
.Verify(v => v.Push(It.Is<EnsureMediaCoversCommand>(c => c.MovieId == movie.Id), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()), Times.Once());
|
.Verify(v => v.Push(It.Is<EnsureMediaCoversCommand>(c => c.MovieId == movie.Id), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()), Times.Once());
|
||||||
|
|
||||||
Subject.Execute(new EnsureMediaCoversCommand(movie.Id));
|
Subject.Execute(new EnsureMediaCoversCommand(movie.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ public void should_not_update_files_if_media_info_disabled()
|
|||||||
Mocker.GetMock<IConfigService>()
|
Mocker.GetMock<IConfigService>()
|
||||||
.SetupGet(s => s.EnableMediaInfo)
|
.SetupGet(s => s.EnableMediaInfo)
|
||||||
.Returns(false);
|
.Returns(false);
|
||||||
|
|
||||||
GivenFileExists();
|
GivenFileExists();
|
||||||
GivenSuccessfulScan();
|
GivenSuccessfulScan();
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ public void should_not_update_if_media_info_disabled()
|
|||||||
Mocker.GetMock<IConfigService>()
|
Mocker.GetMock<IConfigService>()
|
||||||
.SetupGet(s => s.EnableMediaInfo)
|
.SetupGet(s => s.EnableMediaInfo)
|
||||||
.Returns(false);
|
.Returns(false);
|
||||||
|
|
||||||
GivenFileExists();
|
GivenFileExists();
|
||||||
GivenSuccessfulScan();
|
GivenSuccessfulScan();
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ public void should_update_media_info()
|
|||||||
Mocker.GetMock<IMediaFileService>()
|
Mocker.GetMock<IMediaFileService>()
|
||||||
.Verify(v => v.Update(movieFile), Times.Once());
|
.Verify(v => v.Update(movieFile), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_update_media_info_if_new_info_is_null()
|
public void should_not_update_media_info_if_new_info_is_null()
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ public void should_not_update_media_info_if_new_info_is_null()
|
|||||||
|
|
||||||
movieFile.MediaInfo.Should().NotBeNull();
|
movieFile.MediaInfo.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_save_movie_file_if_new_info_is_null()
|
public void should_not_save_movie_file_if_new_info_is_null()
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
|
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AggregateLanguageFixture : CoreTest<AggregateLanguage>
|
public class AggregateLanguageFixture : CoreTest<AggregateLanguage>
|
||||||
{
|
{
|
||||||
private LocalMovie _localMovie;
|
private LocalMovie _localMovie;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
|
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AugmentQualityFixture : CoreTest<AggregateQuality>
|
public class AugmentQualityFixture : CoreTest<AggregateQuality>
|
||||||
{
|
{
|
||||||
private Mock<IAugmentQuality> _mediaInfoAugmenter;
|
private Mock<IAugmentQuality> _mediaInfoAugmenter;
|
||||||
|
@ -60,7 +60,7 @@ public void should_not_update_if_unable_to_parse()
|
|||||||
ExecuteCommand();
|
ExecuteCommand();
|
||||||
|
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
|
|
||||||
Mocker.GetMock<IMediaFileService>().Verify(s => s.Update(It.IsAny<MovieFile>()), Times.Never());
|
Mocker.GetMock<IMediaFileService>().Verify(s => s.Update(It.IsAny<MovieFile>()), Times.Never());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,12 +95,12 @@ public void should_queue_multiple_async_events()
|
|||||||
|
|
||||||
var handlers = new List<IHandleAsync<EventA>>
|
var handlers = new List<IHandleAsync<EventA>>
|
||||||
{
|
{
|
||||||
AsyncHandlerA1.Object,
|
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
|
AsyncHandlerA1.Object,
|
||||||
AsyncHandlerA1.Object,
|
AsyncHandlerA1.Object,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public override ValidationResult Test()
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -61,7 +61,7 @@ private void GivenMatchingMovie()
|
|||||||
{
|
{
|
||||||
ImdbId = "tt01000",
|
ImdbId = "tt01000",
|
||||||
Title = "Does not exist"
|
Title = "Does not exist"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user