mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-30 19:56:54 +00:00
30 lines
No EOL
846 B
C#
30 lines
No EOL
846 B
C#
using System;
|
|
using NzbDrone.Common.Eventing;
|
|
|
|
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; }
|
|
}
|
|
|
|
protected TSetting Settings { get; private set; }
|
|
|
|
public void Handle(IndexerSettingUpdatedEvent message)
|
|
{
|
|
if (message.IndexerName.Equals(Name, StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
Settings = (TSetting)message.IndexerSetting;
|
|
}
|
|
}
|
|
}
|
|
} |