mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
a1783a53a9
download might still not work.
38 lines
985 B
C#
38 lines
985 B
C#
using System;
|
|
using NzbDrone.Common.Messaging;
|
|
|
|
namespace NzbDrone.Core.Indexers
|
|
{
|
|
public abstract class IndexerWithSetting<TSetting> :
|
|
Indexer,
|
|
IHandle<IndexerSettingUpdatedEvent> where TSetting : IIndexerSetting, new()
|
|
{
|
|
protected IndexerWithSetting(IProviderIndexerSetting settingProvider)
|
|
{
|
|
Settings = settingProvider.Get<TSetting>(this);
|
|
}
|
|
|
|
public override bool IsConfigured
|
|
{
|
|
get { return Settings.IsValid; }
|
|
}
|
|
|
|
public override bool EnabledByDefault
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public TSetting Settings { get; private set; }
|
|
|
|
public void Handle(IndexerSettingUpdatedEvent message)
|
|
{
|
|
if (message.IndexerName.Equals(Name, StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
Settings = (TSetting)message.IndexerSetting;
|
|
}
|
|
}
|
|
}
|
|
} |