fixed diskscan

removed all stored status fields from episode
This commit is contained in:
kay.one 2013-05-12 17:36:23 -07:00
commit cbe4be814c
32 changed files with 295 additions and 286 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using TinyIoC;
namespace NzbDrone.Common.Composition
@ -7,10 +8,12 @@ namespace NzbDrone.Common.Composition
public class Container : IContainer
{
private readonly TinyIoCContainer _container;
private readonly List<Type> _loadedTypes;
public Container(TinyIoCContainer container)
public Container(TinyIoCContainer container, List<Type> loadedTypes)
{
_container = container;
_loadedTypes = loadedTypes;
_container.Register<IContainer>(this);
}
@ -92,5 +95,15 @@ namespace NzbDrone.Common.Composition
{
return _container.CanResolve(type);
}
public IEnumerable<Type> GetImplementations(Type contractType)
{
return _loadedTypes
.Where(implementation =>
contractType.IsAssignableFrom(implementation) &&
!implementation.IsInterface &&
!implementation.IsAbstract
);
}
}
}

View file

@ -18,8 +18,6 @@ namespace NzbDrone.Common.Composition
protected ContainerBuilderBase(params string[] assemblies)
{
Container = new Container(new TinyIoCContainer());
_loadedTypes = new List<Type>();
foreach (var assembly in assemblies)
@ -27,6 +25,7 @@ namespace NzbDrone.Common.Composition
_loadedTypes.AddRange(Assembly.Load(assembly).GetTypes());
}
Container = new Container(new TinyIoCContainer(), _loadedTypes);
AutoRegisterInterfaces();
}
@ -52,7 +51,7 @@ namespace NzbDrone.Common.Composition
private void AutoRegisterImplementations(Type contractType)
{
var implementations = GetImplementations(contractType).Where(c => !c.IsGenericTypeDefinition).ToList();
var implementations = Container.GetImplementations(contractType).Where(c => !c.IsGenericTypeDefinition).ToList();
@ -84,14 +83,5 @@ namespace NzbDrone.Common.Composition
}
}
private IEnumerable<Type> GetImplementations(Type contractType)
{
return _loadedTypes
.Where(implementation =>
contractType.IsAssignableFrom(implementation) &&
!implementation.IsInterface &&
!implementation.IsAbstract
);
}
}
}

View file

@ -26,5 +26,7 @@ namespace NzbDrone.Common.Composition
void Register(Type registrationType, object instance);
void RegisterAll(Type registrationType, IEnumerable<Type> implementationList);
bool IsTypeRegistered(Type type);
IEnumerable<Type> GetImplementations(Type contractType);
}
}