Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DownloaderFile"/> class.
        /// </summary>
        public DownloaderFile(
            IIO io,
            Config config,
            ITransport transport,
            IEventDispatcher eventDispatcher = null,
            ICache cache           = null,
            IFileSystem fileSystem = null)
        {
            this.io              = io;
            this.config          = config;
            this.transport       = transport;
            this.eventDispatcher = eventDispatcher;
            this.cache           = cache;
            this.fileSystem      = fileSystem ?? new FileSystemLocal();

            if (CacheFileSystem.GCIsNecessary(cache))
            {
                cache.GC(config.Get(Settings.CacheFilesTTL), config.Get(Settings.CacheFilesMaxSize));
            }

            lastCacheWrites = new Dictionary <string, string>();
        }