public S4UDownloader(IApplicationSettings applicationSettings)
 {
     var settings = new S4USettings
     {
         ApiKey = applicationSettings.GetSetting("S4UApiKey")
     };
     _api = new S4UApi(settings);
 }
Example #2
0
        /// <summary>Gets a setting from the isolated storage. </summary>
        /// <typeparam name="T">The type of the setting. </typeparam>
        /// <param name="key">The key of the setting. </param>
        /// <param name="defaultValue">The default value of the settings (returned if it is not currently set). </param>
        /// <param name="roaming">True if the setting is roamed to other devices. </param>
        /// <returns>The setting. </returns>
        public static T GetSetting <T>(string key, T defaultValue, bool roaming = false)
        {
            if (_applicationSettings == null)
            {
                throw new NotImplementedException();
            }

            return(_applicationSettings.GetSetting(key, defaultValue, roaming));
        }
        public string GetSetting(string name)
        {
            string value;

            if (_settingsOverride.TryGetValue(name, out value))
            {
                return(value);
            }

            return(_base?.GetSetting(name));
        }
        public OpenSubtitlesDownloader(IApplicationSettings applicationSettings, IEpisodeParser episodeParser)
        {
            _episodeParser = episodeParser;
            var settings = new OpenSubtitlesSettings
            {
                Language = "en",
                Username = "",
                Password = "",
                Url = "http://api.opensubtitles.org/xml-rpc",
                UserAgent = applicationSettings.GetSetting("OpenSubtitlesKey"),
                Timeout = 60000
            };

            var proxy = CreateProxy(settings);
            _api = new OpenSubtitlesApi(settings, proxy);
        }