2014-02-14 05:31:49 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common.Composition;
|
2014-02-26 05:40:47 +00:00
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
2014-02-14 05:31:49 +00:00
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download
|
|
|
|
|
{
|
|
|
|
|
public interface IDownloadClientFactory : IProviderFactory<IDownloadClient, DownloadClientDefinition>
|
|
|
|
|
{
|
|
|
|
|
List<IDownloadClient> Enabled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DownloadClientFactory : ProviderFactory<IDownloadClient, DownloadClientDefinition>, IDownloadClientFactory
|
|
|
|
|
{
|
|
|
|
|
private readonly IDownloadClientRepository _providerRepository;
|
|
|
|
|
|
2014-02-26 05:40:47 +00:00
|
|
|
|
public DownloadClientFactory(IDownloadClientRepository providerRepository, IEnumerable<IDownloadClient> providers, IContainer container, IEventAggregator eventAggregator, Logger logger)
|
|
|
|
|
: base(providerRepository, providers, container, eventAggregator, logger)
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
|
|
|
|
_providerRepository = providerRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<IDownloadClient> Enabled()
|
|
|
|
|
{
|
|
|
|
|
return GetAvailableProviders().Where(n => ((DownloadClientDefinition)n.Definition).Enable).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|