using System.Collections.Generic; using System.Linq; using NLog; using NzbDrone.Common.Composition; using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications { public interface INotificationFactory : IProviderFactory { List OnGrabEnabled(); List OnDownloadEnabled(); List OnUpgradeEnabled(); } public class NotificationFactory : ProviderFactory, INotificationFactory { public NotificationFactory(INotificationRepository providerRepository, IEnumerable providers, IContainer container, Logger logger) : base(providerRepository, providers, container, logger) { } public List OnGrabEnabled() { return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnGrab).ToList(); } public List OnDownloadEnabled() { return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnDownload).ToList(); } public List OnUpgradeEnabled() { return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnUpgrade).ToList(); } } }