Пример #1
0
 public GoodReadsDataSource(IPreferenceService preferenceService)
 {
     _preferenceService = preferenceService;
     _client            = GoodreadsClient.Create(
         preferenceService.Get("goodreads.apikey", "ckvsiSDsuqh7omh74ZZ6Q"), // todo: this is the lazylibrarian key...
         preferenceService.Get("goodreads.apisecret", "")
         );
 }
Пример #2
0
 public TransmissionDownloadClient(IPreferenceService preferencesService)
 {
     _preferencesService = preferencesService;
     _client             = new Client(
         preferencesService.Get("transmission.host", "127.0.0.1"), null,
         preferencesService.Get("transmission.username", "transmission"),
         preferencesService.Get("transmission.password", "transmission"));
 }
Пример #3
0
 public SabnzbdDownloadClient(IPreferenceService preferencesService)
 {
     _preferencesService = preferencesService;
     _category           = preferencesService.Get("sabnzbd.category", "audiobooks");
     _client             = new SabClient(
         preferencesService.Get("sabnzbd.host", "127.0.0.1"),
         preferencesService.Get("sabnzbd.port", (ushort)8080),
         preferencesService.Get("sabnzbd.apikey", ""));
 }
Пример #4
0
 public DownloadManager(IPreferenceService preferencesService, IServiceProvider provider)
 {
     _provider  = provider;
     _random    = new Random();
     _downloads = new List <DownloadHandle>();
     _pollTimer = new Timer(
         ExecuteDownloadClientPoll,
         null,
         TimeSpan.Zero,
         TimeSpan.FromMinutes(preferencesService.Get("downloadmanager.pollmins", 2)));
 }
Пример #5
0
        // GET: api/Preference/5
        public Preference Get(string id)
        {
            if (id == "undefined")
            {
                return(null);
            }
            string[]   input    = id.Split(' ');
            int        actorId  = int.Parse(input[0]);
            int        scriptId = int.Parse(input[1]);
            Preference result   = preferenceService.Get(preference => preference.ReaderId == actorId && preference.ScriptId == scriptId);

            return(result);
        }
Пример #6
0
        public Type GetMainPage()
        {
            var isNew = preferenceService.Get("isnew");

            //if (isNew == "false")
            if (true)
            {
                preferenceService.Set("isnew", "false");
                return(typeof(LoginPageViewModel));
            }
            else
            {
                var email = preferenceService.Get("email");

                if (string.IsNullOrEmpty(email))
                {
                    return(typeof(LoginPageViewModel));
                }
                else
                {
                    return(typeof(CategoryPageViewModel));
                }
            }
        }
Пример #7
0
        public bool CheckAuthentication(string username, string password)
        {
            if (_preferenceService.Get("authorisation.developerbypass", false))
            {
                return(false);
            }

            try
            {
                var users = _preferenceService.GetObjectArray <User>("authorisation.users");
                if (users.Length == 0)
                {
                    return(true);
                }
                var user = users.First(u => u.Username.ToLower().Trim() == username.ToLower().Trim());
                return(user.PasswordHash == HashPassword(password, user.Salt));
            }
            catch (Exception)
            {
                return(false);
            }
        }
 /// <summary>
 /// Gets value of stored key or null if key not exist.
 /// </summary>
 /// <param name="key">Key name.</param>
 /// <typeparam name="T">Type of stored value.</param>
 /// <returns>Value assigned to the key.</returns>
 public object Get <T>(string key)
 {
     return(_model.Get <T>(key));
 }
Пример #9
0
 public string GetValue(string key)
 {
     return(_preferenceService.Get(key, ""));
 }