mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-23 22:45:06 -04:00
33 lines
1022 B
C#
33 lines
1022 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
namespace NzbDrone.Core.Download
|
|
{
|
|
public interface IProvideDownloadClient
|
|
{
|
|
IDownloadClient GetDownloadClient(DownloadProtocol downloadProtocol);
|
|
IEnumerable<IDownloadClient> GetDownloadClients();
|
|
}
|
|
|
|
public class DownloadClientProvider : IProvideDownloadClient
|
|
{
|
|
private readonly IDownloadClientFactory _downloadClientFactory;
|
|
|
|
public DownloadClientProvider(IDownloadClientFactory downloadClientFactory)
|
|
{
|
|
_downloadClientFactory = downloadClientFactory;
|
|
}
|
|
|
|
public IDownloadClient GetDownloadClient(DownloadProtocol downloadProtocol)
|
|
{
|
|
return _downloadClientFactory.GetAvailableProviders().FirstOrDefault(v => v.Protocol == downloadProtocol);
|
|
}
|
|
|
|
public IEnumerable<IDownloadClient> GetDownloadClients()
|
|
{
|
|
return _downloadClientFactory.GetAvailableProviders();
|
|
}
|
|
}
|
|
} |