added simple injector for dependancy management
This commit is contained in:
parent
107c241598
commit
a2d215b6ae
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Mef;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
@ -213,7 +212,7 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
var kernel = (Kernel)Kernel;
|
||||
|
||||
var allTypes = kernel.Assemblies.SelectMany(MefUtils.GetTypes).Where(t => !t.IsAbstract && t.IsSubclassOf(typeof(BaseItem)));
|
||||
var allTypes = kernel.AllTypes.Where(t => !t.IsAbstract && t.IsSubclassOf(typeof(BaseItem)));
|
||||
|
||||
if (request.HasInternetProvider)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Common.Mef;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
|
@ -13,12 +11,14 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.ComponentModel.Composition.Primitives;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SimpleInjector;
|
||||
|
||||
namespace MediaBrowser.Common.Kernel
|
||||
{
|
||||
|
@ -200,13 +200,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
[ImportMany(typeof(IWebSocketListener))]
|
||||
public IEnumerable<IWebSocketListener> WebSocketListeners { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of Localized string files
|
||||
/// </summary>
|
||||
/// <value>The string files.</value>
|
||||
[ImportMany(typeof(LocalizedStringData))]
|
||||
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MEF CompositionContainer
|
||||
/// </summary>
|
||||
|
@ -241,7 +234,6 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// Gets the rest services.
|
||||
/// </summary>
|
||||
/// <value>The rest services.</value>
|
||||
[ImportMany(typeof(IRestfulService))]
|
||||
public IEnumerable<IRestfulService> RestServices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -265,7 +257,7 @@ namespace MediaBrowser.Common.Kernel
|
|||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _protobufSerializer, ref _protobufSerializerInitialized, ref _protobufSerializerSyncLock, () => DynamicProtobufSerializer.Create(Assemblies));
|
||||
LazyInitializer.EnsureInitialized(ref _protobufSerializer, ref _protobufSerializerInitialized, ref _protobufSerializerSyncLock, () => DynamicProtobufSerializer.Create(AllTypes));
|
||||
return _protobufSerializer;
|
||||
}
|
||||
private set
|
||||
|
@ -341,6 +333,12 @@ namespace MediaBrowser.Common.Kernel
|
|||
/// <value>The assemblies.</value>
|
||||
public Assembly[] Assemblies { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all types.
|
||||
/// </summary>
|
||||
/// <value>All types.</value>
|
||||
public Type[] AllTypes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseKernel{TApplicationPathsType}" /> class.
|
||||
/// </summary>
|
||||
|
@ -460,25 +458,83 @@ namespace MediaBrowser.Common.Kernel
|
|||
|
||||
Assemblies = GetComposablePartAssemblies().ToArray();
|
||||
|
||||
CompositionContainer = MefUtils.GetSafeCompositionContainer(Assemblies.Select(i => new AssemblyCatalog(i)));
|
||||
AllTypes = Assemblies.SelectMany(GetTypes).ToArray();
|
||||
|
||||
ComposeExportedValues(CompositionContainer);
|
||||
|
||||
CompositionContainer.ComposeParts(this);
|
||||
ComposeParts(AllTypes);
|
||||
|
||||
await OnComposablePartsLoaded().ConfigureAwait(false);
|
||||
|
||||
CompositionContainer.Catalog.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The ioc container
|
||||
/// </summary>
|
||||
private readonly Container _iocContainer = new Container();
|
||||
|
||||
/// <summary>
|
||||
/// Composes the parts.
|
||||
/// </summary>
|
||||
/// <param name="allTypes">All types.</param>
|
||||
private void ComposeParts(IEnumerable<Type> allTypes)
|
||||
{
|
||||
var concreteTypes = allTypes.Where(t => t.IsClass && !t.IsAbstract && !t.IsInterface && !t.IsGenericType).ToArray();
|
||||
|
||||
CompositionContainer = GetSafeCompositionContainer(concreteTypes.Select(i => new TypeCatalog(i)));
|
||||
|
||||
ComposeExportedValues(CompositionContainer, _iocContainer);
|
||||
|
||||
CompositionContainer.ComposeParts(this);
|
||||
|
||||
ComposePartsWithIocContainer(concreteTypes, _iocContainer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Composes the parts with ioc container.
|
||||
/// </summary>
|
||||
/// <param name="allTypes">All types.</param>
|
||||
/// <param name="container">The container.</param>
|
||||
protected virtual void ComposePartsWithIocContainer(Type[] allTypes, Container container)
|
||||
{
|
||||
RestServices = GetExports<IRestfulService>(allTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the exports.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="allTypes">All types.</param>
|
||||
/// <returns>IEnumerable{``0}.</returns>
|
||||
protected IEnumerable<T> GetExports<T>(Type[] allTypes)
|
||||
{
|
||||
var currentType = typeof(T);
|
||||
|
||||
Logger.Info("Composing instances of " + currentType.Name);
|
||||
|
||||
return allTypes.Where(currentType.IsAssignableFrom).Select(Instantiate).Cast<T>().ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
private object Instantiate(Type type)
|
||||
{
|
||||
return _iocContainer.GetInstance(type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Composes the exported values.
|
||||
/// </summary>
|
||||
/// <param name="container">The container.</param>
|
||||
protected virtual void ComposeExportedValues(CompositionContainer container)
|
||||
protected virtual void ComposeExportedValues(CompositionContainer container, Container iocContainer)
|
||||
{
|
||||
container.ComposeExportedValue("logger", Logger);
|
||||
container.ComposeExportedValue("appHost", ApplicationHost);
|
||||
|
||||
iocContainer.RegisterSingle(Logger);
|
||||
iocContainer.RegisterSingle(ApplicationHost);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -545,6 +601,71 @@ namespace MediaBrowser.Common.Kernel
|
|||
yield return GetType().Assembly;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plugins that live on both the server and UI are going to have references to assemblies from both sides.
|
||||
/// But looks for Parts on one side, it will throw an exception when it seems Types from the other side that it doesn't have a reference to.
|
||||
/// For example, a plugin provides a Resolver. When MEF runs in the UI, it will throw an exception when it sees the resolver because there won't be a reference to the base class.
|
||||
/// This method will catch those exceptions while retining the list of Types that MEF is able to resolve.
|
||||
/// </summary>
|
||||
/// <param name="catalogs">The catalogs.</param>
|
||||
/// <returns>CompositionContainer.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">catalogs</exception>
|
||||
private static CompositionContainer GetSafeCompositionContainer(IEnumerable<ComposablePartCatalog> catalogs)
|
||||
{
|
||||
if (catalogs == null)
|
||||
{
|
||||
throw new ArgumentNullException("catalogs");
|
||||
}
|
||||
|
||||
var newList = new List<ComposablePartCatalog>();
|
||||
|
||||
// Go through each Catalog
|
||||
foreach (var catalog in catalogs)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to have MEF find Parts
|
||||
catalog.Parts.ToArray();
|
||||
|
||||
// If it succeeds we can use the entire catalog
|
||||
newList.Add(catalog);
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
// If it fails we can still get a list of the Types it was able to resolve and create TypeCatalogs
|
||||
var typeCatalogs = ex.Types.Where(t => t != null).Select(t => new TypeCatalog(t));
|
||||
newList.AddRange(typeCatalogs);
|
||||
}
|
||||
}
|
||||
|
||||
return new CompositionContainer(new AggregateCatalog(newList));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of types within an assembly
|
||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly.</param>
|
||||
/// <returns>IEnumerable{Type}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">assembly</exception>
|
||||
private static IEnumerable<Type> GetTypes(Assembly assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new ArgumentNullException("assembly");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
// If it fails we can still get a list of the Types it was able to resolve
|
||||
return ex.Types.Where(t => t != null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires after MEF finishes finding composable parts within plugin assemblies
|
||||
/// </summary>
|
||||
|
|
|
@ -88,6 +88,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimpleInjector">
|
||||
<HintPath>..\packages\SimpleInjector.2.0.0-beta5\lib\net40-client\SimpleInjector.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
@ -139,7 +142,6 @@
|
|||
<Compile Include="Kernel\IKernel.cs" />
|
||||
<Compile Include="Kernel\TcpManager.cs" />
|
||||
<Compile Include="Localization\LocalizedStringData.cs" />
|
||||
<Compile Include="Mef\MefUtils.cs" />
|
||||
<Compile Include="Net\AlchemyWebSocket.cs" />
|
||||
<Compile Include="Net\BaseRestService.cs" />
|
||||
<Compile Include="Net\Handlers\BaseActionHandler.cs" />
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.ComponentModel.Composition.Primitives;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MediaBrowser.Common.Mef
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MefUtils
|
||||
/// </summary>
|
||||
public static class MefUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Plugins that live on both the server and UI are going to have references to assemblies from both sides.
|
||||
/// But looks for Parts on one side, it will throw an exception when it seems Types from the other side that it doesn't have a reference to.
|
||||
/// For example, a plugin provides a Resolver. When MEF runs in the UI, it will throw an exception when it sees the resolver because there won't be a reference to the base class.
|
||||
/// This method will catch those exceptions while retining the list of Types that MEF is able to resolve.
|
||||
/// </summary>
|
||||
/// <param name="catalogs">The catalogs.</param>
|
||||
/// <returns>CompositionContainer.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">catalogs</exception>
|
||||
public static CompositionContainer GetSafeCompositionContainer(IEnumerable<ComposablePartCatalog> catalogs)
|
||||
{
|
||||
if (catalogs == null)
|
||||
{
|
||||
throw new ArgumentNullException("catalogs");
|
||||
}
|
||||
|
||||
var newList = new List<ComposablePartCatalog>();
|
||||
|
||||
// Go through each Catalog
|
||||
foreach (var catalog in catalogs)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to have MEF find Parts
|
||||
catalog.Parts.ToArray();
|
||||
|
||||
// If it succeeds we can use the entire catalog
|
||||
newList.Add(catalog);
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
// If it fails we can still get a list of the Types it was able to resolve and create TypeCatalogs
|
||||
var typeCatalogs = ex.Types.Where(t => t != null).Select(t => new TypeCatalog(t));
|
||||
newList.AddRange(typeCatalogs);
|
||||
}
|
||||
}
|
||||
|
||||
return new CompositionContainer(new AggregateCatalog(newList));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of types within an assembly
|
||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly.</param>
|
||||
/// <returns>IEnumerable{Type}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">assembly</exception>
|
||||
public static IEnumerable<Type> GetTypes(Assembly assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new ArgumentNullException("assembly");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException ex)
|
||||
{
|
||||
// If it fails we can still get a list of the Types it was able to resolve
|
||||
return ex.Types.Where(t => t != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
using MediaBrowser.Common.Mef;
|
||||
using ProtoBuf;
|
||||
using ProtoBuf;
|
||||
using ProtoBuf.Meta;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
|
@ -135,21 +133,20 @@ namespace MediaBrowser.Common.Serialization
|
|||
/// <summary>
|
||||
/// Creates the specified assemblies.
|
||||
/// </summary>
|
||||
/// <param name="assemblies">The assemblies.</param>
|
||||
/// <returns>DynamicProtobufSerializer.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">assemblies</exception>
|
||||
public static DynamicProtobufSerializer Create(IEnumerable<Assembly> assemblies)
|
||||
public static DynamicProtobufSerializer Create(IEnumerable<Type> types)
|
||||
{
|
||||
if (assemblies == null)
|
||||
if (types == null)
|
||||
{
|
||||
throw new ArgumentNullException("assemblies");
|
||||
throw new ArgumentNullException("types");
|
||||
}
|
||||
|
||||
var model = TypeModel.Create();
|
||||
var attributeType = typeof(ProtoContractAttribute);
|
||||
|
||||
// Find all ProtoContracts in the current assembly
|
||||
foreach (var type in assemblies.SelectMany(a => MefUtils.GetTypes(a).Where(t => Attribute.IsDefined(t, attributeType))))
|
||||
foreach (var type in types.Where(t => Attribute.IsDefined(t, attributeType)))
|
||||
{
|
||||
model.Add(type, true);
|
||||
}
|
||||
|
|
|
@ -13,4 +13,5 @@
|
|||
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.37" targetFramework="net45" />
|
||||
<package id="ServiceStack.Redis" version="3.9.37" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.37" targetFramework="net45" />
|
||||
<package id="SimpleInjector" version="2.0.0-beta5" targetFramework="net45" />
|
||||
</packages>
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Localization;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
@ -27,6 +28,7 @@ using System.ComponentModel.Composition.Hosting;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SimpleInjector;
|
||||
|
||||
namespace MediaBrowser.Controller
|
||||
{
|
||||
|
@ -178,25 +180,29 @@ namespace MediaBrowser.Controller
|
|||
get { return KernelContext.Server; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of Localized string files
|
||||
/// </summary>
|
||||
/// <value>The string files.</value>
|
||||
[ImportMany(typeof(LocalizedStringData))]
|
||||
public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of plugin configuration pages
|
||||
/// </summary>
|
||||
/// <value>The configuration pages.</value>
|
||||
[ImportMany(typeof(IPluginConfigurationPage))]
|
||||
public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the intro providers.
|
||||
/// </summary>
|
||||
/// <value>The intro providers.</value>
|
||||
[ImportMany(typeof(IIntroProvider))]
|
||||
public IEnumerable<IIntroProvider> IntroProviders { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of currently registered weather prvoiders
|
||||
/// </summary>
|
||||
/// <value>The weather providers.</value>
|
||||
[ImportMany(typeof(IWeatherProvider))]
|
||||
public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -232,7 +238,6 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of available user repositories
|
||||
/// </summary>
|
||||
/// <value>The user repositories.</value>
|
||||
[ImportMany(typeof(IUserRepository))]
|
||||
private IEnumerable<IUserRepository> UserRepositories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -251,7 +256,6 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of available item repositories
|
||||
/// </summary>
|
||||
/// <value>The item repositories.</value>
|
||||
[ImportMany(typeof(IItemRepository))]
|
||||
private IEnumerable<IItemRepository> ItemRepositories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -264,22 +268,19 @@ namespace MediaBrowser.Controller
|
|||
/// Gets the list of available item repositories
|
||||
/// </summary>
|
||||
/// <value>The user data repositories.</value>
|
||||
[ImportMany(typeof(IUserDataRepository))]
|
||||
private IEnumerable<IUserDataRepository> UserDataRepositories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of available DisplayPreferencesRepositories
|
||||
/// </summary>
|
||||
/// <value>The display preferences repositories.</value>
|
||||
[ImportMany(typeof(IDisplayPreferencesRepository))]
|
||||
private IEnumerable<IDisplayPreferencesRepository> DisplayPreferencesRepositories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of entity resolution ignore rules
|
||||
/// </summary>
|
||||
/// <value>The entity resolution ignore rules.</value>
|
||||
[ImportMany(typeof(BaseResolutionIgnoreRule))]
|
||||
internal IEnumerable<BaseResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
||||
internal IEnumerable<IResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active user data repository
|
||||
|
@ -357,12 +358,35 @@ namespace MediaBrowser.Controller
|
|||
/// Composes the exported values.
|
||||
/// </summary>
|
||||
/// <param name="container">The container.</param>
|
||||
protected override void ComposeExportedValues(CompositionContainer container)
|
||||
/// <param name="iocContainer">The _ioc container.</param>
|
||||
protected override void ComposeExportedValues(CompositionContainer container, Container iocContainer)
|
||||
{
|
||||
base.ComposeExportedValues(container);
|
||||
base.ComposeExportedValues(container, iocContainer);
|
||||
|
||||
container.ComposeExportedValue("kernel", this);
|
||||
container.ComposeExportedValue("blurayExaminer", BlurayExaminer);
|
||||
|
||||
iocContainer.RegisterSingle(this);
|
||||
iocContainer.RegisterSingle(BlurayExaminer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Composes the parts with ioc container.
|
||||
/// </summary>
|
||||
/// <param name="allTypes">All types.</param>
|
||||
/// <param name="container">The container.</param>
|
||||
protected override void ComposePartsWithIocContainer(Type[] allTypes, Container container)
|
||||
{
|
||||
base.ComposePartsWithIocContainer(allTypes, container);
|
||||
|
||||
EntityResolutionIgnoreRules = GetExports<IResolutionIgnoreRule>(allTypes);
|
||||
UserDataRepositories = GetExports<IUserDataRepository>(allTypes);
|
||||
UserRepositories = GetExports<IUserRepository>(allTypes);
|
||||
DisplayPreferencesRepositories = GetExports<IDisplayPreferencesRepository>(allTypes);
|
||||
ItemRepositories = GetExports<IItemRepository>(allTypes);
|
||||
WeatherProviders = GetExports<IWeatherProvider>(allTypes);
|
||||
IntroProviders = GetExports<IIntroProvider>(allTypes);
|
||||
PluginConfigurationPages = GetExports<IPluginConfigurationPage>(allTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -63,6 +63,10 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimpleInjector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SimpleInjector.2.0.0-beta5\lib\net40-client\SimpleInjector.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -165,7 +169,7 @@
|
|||
<Compile Include="Providers\MediaInfo\FFMpegVideoImageProvider.cs" />
|
||||
<Compile Include="Resolvers\Audio\MusicAlbumResolver.cs" />
|
||||
<Compile Include="Resolvers\Audio\MusicArtistResolver.cs" />
|
||||
<Compile Include="Resolvers\BaseResolutionIgnoreRule.cs" />
|
||||
<Compile Include="Resolvers\IResolutionIgnoreRule.cs" />
|
||||
<Compile Include="Resolvers\CoreResolutionIgnoreRule.cs" />
|
||||
<Compile Include="Resolvers\EntityResolutionHelper.cs" />
|
||||
<Compile Include="Resolvers\LocalTrailerResolver.cs" />
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// <summary>
|
||||
/// Provides the core resolver ignore rules
|
||||
/// </summary>
|
||||
[Export(typeof(BaseResolutionIgnoreRule))]
|
||||
public class CoreResolutionIgnoreRule : BaseResolutionIgnoreRule
|
||||
[Export(typeof(IResolutionIgnoreRule))]
|
||||
public class CoreResolutionIgnoreRule : IResolutionIgnoreRule
|
||||
{
|
||||
/// <summary>
|
||||
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
|
||||
|
@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
"extrafanart"
|
||||
};
|
||||
|
||||
public override bool ShouldIgnore(ItemResolveArgs args)
|
||||
public bool ShouldIgnore(ItemResolveArgs args)
|
||||
{
|
||||
// Ignore hidden files and folders
|
||||
if (args.IsHidden)
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// <summary>
|
||||
/// Provides a base "rule" that anyone can use to have paths ignored by the resolver
|
||||
/// </summary>
|
||||
public abstract class BaseResolutionIgnoreRule
|
||||
public interface IResolutionIgnoreRule
|
||||
{
|
||||
public abstract bool ShouldIgnore(ItemResolveArgs args);
|
||||
bool ShouldIgnore(ItemResolveArgs args);
|
||||
}
|
||||
}
|
|
@ -2,4 +2,5 @@
|
|||
<packages>
|
||||
<package id="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
||||
<package id="protobuf-net" version="2.0.0.621" targetFramework="net45" />
|
||||
<package id="SimpleInjector" version="2.0.0-beta5" targetFramework="net45" />
|
||||
</packages>
|
|
@ -36,7 +36,6 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\packages\System.Data.SQLite.1.0.84.0\lib\net45\System.Data.SQLite.dll</HintPath>
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -16,7 +15,6 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// <summary>
|
||||
/// Class SQLiteDisplayPreferencesRepository
|
||||
/// </summary>
|
||||
[Export(typeof(IDisplayPreferencesRepository))]
|
||||
class SQLiteDisplayPreferencesRepository : SqliteRepository, IDisplayPreferencesRepository
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -40,8 +38,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteDisplayPreferencesRepository([Import("logger")] ILogger logger)
|
||||
public SQLiteDisplayPreferencesRepository(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ using MediaBrowser.Controller.Persistence;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -16,7 +15,6 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// <summary>
|
||||
/// Class SQLiteItemRepository
|
||||
/// </summary>
|
||||
[Export(typeof(IItemRepository))]
|
||||
public class SQLiteItemRepository : SqliteRepository, IItemRepository
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -45,8 +43,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteItemRepository([Import("logger")] ILogger logger)
|
||||
public SQLiteItemRepository(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Persistence;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -15,7 +14,6 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// <summary>
|
||||
/// Class SQLiteUserDataRepository
|
||||
/// </summary>
|
||||
[Export(typeof(IUserDataRepository))]
|
||||
public class SQLiteUserDataRepository : SqliteRepository, IUserDataRepository
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -39,8 +37,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteUserDataRepository([Import("logger")] ILogger logger)
|
||||
public SQLiteUserDataRepository(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Persistence;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -16,7 +15,6 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// <summary>
|
||||
/// Class SQLiteUserRepository
|
||||
/// </summary>
|
||||
[Export(typeof(IUserRepository))]
|
||||
public class SQLiteUserRepository : SqliteRepository, IUserRepository
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -40,8 +38,7 @@ namespace MediaBrowser.Server.Sqlite
|
|||
/// Initializes a new instance of the <see cref="SQLiteUserDataRepository" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
[ImportingConstructor]
|
||||
protected SQLiteUserRepository([Import("logger")] ILogger logger)
|
||||
public SQLiteUserRepository(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user