2016-12-23 21:45:24 +00:00
|
|
|
|
using NzbDrone.Core.Download;
|
2014-02-14 05:31:49 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.DownloadClient
|
|
|
|
|
{
|
|
|
|
|
public class DownloadClientModule : ProviderModuleBase<DownloadClientResource, IDownloadClient, DownloadClientDefinition>
|
|
|
|
|
{
|
|
|
|
|
public DownloadClientModule(IDownloadClientFactory downloadClientFactory)
|
|
|
|
|
: base(downloadClientFactory, "downloadclient")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-25 00:56:29 +00:00
|
|
|
|
protected override void MapToResource(DownloadClientResource resource, DownloadClientDefinition definition)
|
|
|
|
|
{
|
|
|
|
|
base.MapToResource(resource, definition);
|
|
|
|
|
|
|
|
|
|
resource.Enable = definition.Enable;
|
|
|
|
|
resource.Protocol = definition.Protocol;
|
2019-07-01 01:50:01 +00:00
|
|
|
|
resource.Priority = definition.Priority;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void MapToModel(DownloadClientDefinition definition, DownloadClientResource resource)
|
|
|
|
|
{
|
|
|
|
|
base.MapToModel(definition, resource);
|
|
|
|
|
|
|
|
|
|
definition.Enable = resource.Enable;
|
|
|
|
|
definition.Protocol = resource.Protocol;
|
2019-07-01 01:50:01 +00:00
|
|
|
|
definition.Priority = resource.Priority;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 23:43:33 +00:00
|
|
|
|
protected override void Validate(DownloadClientDefinition definition, bool includeWarnings)
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
2019-12-22 22:08:53 +00:00
|
|
|
|
if (!definition.Enable)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 23:43:33 +00:00
|
|
|
|
base.Validate(definition, includeWarnings);
|
2014-02-14 05:31:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-22 21:24:10 +00:00
|
|
|
|
}
|