public void AddProvider(ILyricsProvider provider) { if (this.started) { throw new InvalidOperationException("Already started."); } this.providers.Add(provider); }
public void AddProvidersForAssembly(Assembly assembly) { Type targetInterface = typeof(ILyricsProvider); foreach (Type t in assembly.GetTypes().Where(t => targetInterface.IsAssignableFrom(t))) { if (t.IsInterface) { continue; } if (t.IsAbstract) { continue; } ConstructorInfo constructor = t.GetConstructor(EmptyTypes); ILyricsProvider provider = (ILyricsProvider)constructor.Invoke(null); this.AddProvider(provider); } }
public Processor(IRecordingInformationProvider recordingInformationProvider, ILyricsProvider lyricsProvider, ILyricParser lyricParser) { this.recordingInformationProvider = recordingInformationProvider ?? throw new ArgumentNullException($"{nameof(recordingInformationProvider)} cannot be null"); this.lyricsProvider = lyricsProvider ?? throw new ArgumentNullException($"{nameof(lyricsProvider)} cannot be null"); this.lyricParser = lyricParser ?? throw new ArgumentNullException($"{nameof(lyricParser)} cannot be null"); }
public LyricsController(ILyricsProvider l, IS3Provider r) { _lyricsProvider = l; _recordProvider = r; req.Properties[System.Web.Http.Hosting.HttpPropertyKeys.HttpConfigurationKey] = configuration; }