Esempio n. 1
0
        /// <summary>
        /// Instantiates a new copy of the TVDB API helper class
        /// </summary>
        /// <param name="apiKey">API Key to use for lookups</param>
        /// <param name="cacheType">Type of cache to use. Defaults to memory and persistent.</param>
        /// <param name="persistentCacheLocation">Location of persistent cache (if one is to be used).</param>
        public Tvdb(string apiKey, TvdbCacheType cacheType = TvdbCacheType.PersistentMemory, string persistentCacheLocation = null)
        {
            Debug.WriteLine("-> Tvdb::_cstr apiKey=\"" + apiKey + "\" cacheType=\"" + cacheType + "\" persistentCacheLocation=\"" + persistentCacheLocation + "\" Called");
            // Create the cache
            var tvdbCacheProvider = new TvdbCacheProvider(cacheType, persistentCacheLocation);

            // Create request object
            TvdbApiRequest = new TvdbApiRequest(apiKey, tvdbCacheProvider);
        }
 /// <summary>
 /// Creates a new cache provider for persistent storage of API requests.
 /// </summary>
 /// <param name="cacheType">Type of cache to provide.</param>
 /// <param name="persistentCacheLocation">Location to store the persistent cache.
 /// If null will default to current directory.</param>
 public TvdbCacheProvider(TvdbCacheType cacheType, string persistentCacheLocation)
 {
     Debug.WriteLine("-> TvdbCacheProvider::_cstr cacheType=\"" + cacheType + "\" persistentCacheLocation=\"" + persistentCacheLocation + "\" Called");
     LastApiTime             = 0;
     CacheType               = cacheType;
     PersistentCacheLocation = persistentCacheLocation ?? Environment.CurrentDirectory;
     if (cacheType == TvdbCacheType.PersistentMemory)
     {
         LoadFromPersistentCache();
     }
 }