/// <summary> /// Construct a HttpParallelDownloader. /// </summary> /// <param name="task">Download task, must with HttpRangedTarget.</param> /// <param name="folderProvider">Folder provider must not be null.</param> /// <param name="cacheProvider">Cache provider must not be null.</param> /// <param name="bufferProvider">Buffer provider must not be null.</param> /// <param name="checkPoint">Set the downloader to start at given checkPoint.</param> /// <param name="threadNum">Number of threads used.</param> /// <param name="threadSegmentSize">Downloading task is divided as segments /// before assigned to each thread. Segment size defines the approximate /// size of each segment.</param> public HttpParallelDownloader( DownloadTask task, IFolderProvider folderProvider, ICacheStorageProvider cacheProvider, IBufferProvider bufferProvider, byte[] checkPoint = null, int threadNum = 8, long threadSegmentSize = 8 * 1024 * 1024 ) : base(task) { Ensure.That(task.Target is HttpRangableTarget, null, opts => opts.WithMessage( $"type of {nameof(task.Target)} must be {nameof(HttpRangableTarget)}") ).IsTrue(); Ensure.That(folderProvider, nameof(folderProvider)).IsNotNull(); Ensure.That(cacheProvider, nameof(cacheProvider)).IsNotNull(); Ensure.That(bufferProvider, nameof(bufferProvider)).IsNotNull(); Ensure.That(threadNum, nameof(threadNum)).IsGte(1); Ensure.That(threadSegmentSize, nameof(threadSegmentSize)).IsGt(1024 * 1024); this.folderProvider = folderProvider; this.cacheProvider = cacheProvider; this.bufferProvider = bufferProvider; this.threadNum = threadNum; this.threadSegmentSize = threadSegmentSize; Progress = new CompositeProgress((task.Target as HttpRangableTarget).DataLength); Speed = SharedSpeedCalculatorFactory.NewSpeedCalculator(); Progress.ProgressChanged += (sender, arg) => Speed.CurrentValue = Progress.DownloadedSize; if (checkPoint != null) { ApplyCheckPoint(checkPoint); } }
public static void Startup(ISQLitePlatform platform, IFolderProvider folderProvider) { TinyIoC.TinyIoCContainer.Current.Register <IFolderProvider> (folderProvider); TinyIoC.TinyIoCContainer.Current.Register <ISQLitePlatform> (platform); TinyIoC.TinyIoCContainer.Current.Register <IDataAccess> (new DataAccess.DataAccess()); }
public CacheFolderContentManager( IPathManager pathManager, IConfiguration configuration, IFolderProvider <CacheFolder> cacheFolderProvider) : base(pathManager, cacheFolderProvider) { CreateFolders(configuration); }
public FileRepository(IOptions <FileStorage> options, IFolderProvider folderProvider, IFileProvider fileProvider) { _rootPath = Path.Combine(options.Value.FilesPath, BaseFolder); _folderProvider = folderProvider; _fileProvider = fileProvider; }
public EditDiscsDetailsViewModel(IFolderProvider folderProvider, IDiscsService discService, IArtistsService artistService, IGenresService genreService) { this.folderProvider = folderProvider ?? throw new ArgumentNullException(nameof(folderProvider)); this.discService = discService ?? throw new ArgumentNullException(nameof(discService)); this.artistService = artistService ?? throw new ArgumentNullException(nameof(artistService)); this.genreService = genreService ?? throw new ArgumentNullException(nameof(genreService)); Discs = new ObservableCollection <DiscViewItem>(); }
public FolderContentSearchManager(IConfiguration configuration) { _configuration = configuration; _pathManager = new PathManager(); var directoryManager = new DirectoryManagerAsync(); var fileManager = new FileManagerAsync(); _folderProvider = new CacheSearchFolderProvider(directoryManager, _pathManager, fileManager, configuration); }
public FolderContentManager( IConfiguration configuration, IFolderProvider <Folder> folderProvider) : base(folderProvider) { CreateFolderAsync(configuration.BaseFolderName, configuration.BaseFolderPath).Wait(); CreateFolderAsync(configuration.HomeFolderName, configuration.HomeFolderPath).Wait(); CreateFolderAsync(configuration.TemporaryFileFolderName, configuration.HomeFolderPath).Wait(); }
public MainViewModel(IFolderProvider folderProvider) { Ensure.NotNull(folderProvider, "folderProvider"); Folders = new ObservableCollection <Folder>(folderProvider.Get().OrderBy(f => f.Name.ToString())); Open = new OpenFolderCommand(); Copy = new CopyToClipBoardAsTextCommand(); }
public Interactors(IFolderProvider folderProvider, ICsProvider csProvider, IKommentarschlucker kommentarSchlucker, IStats stats) { this.folderProvider = folderProvider; this.csProvider = csProvider; this.kommentarSchlucker = kommentarSchlucker; this.stats = stats; }
public FolderContentSearchManager( IDirectoryManagerAsync directoryManager, IPathManager pathManager, IFileManagerAsync fileManager, IConfiguration configuration) { _pathManager = pathManager; _configuration = configuration; _folderProvider = new CacheSearchFolderProvider(directoryManager, pathManager, fileManager, configuration); }
public ProcessingTask( IFolderProvider folderProvider, IFileReader fileReader, IMatrixProcessor matrixProcessor, ILogger logger) { _folderProvider = folderProvider; _fileReader = fileReader; _matrixProcessor = matrixProcessor; _logger = logger; }
/// <summary> /// Construct a TorrentDownloader. /// </summary> /// <param name="task">Download task, must with HttpRangedTarget.</param> /// <param name="engine">Client engine of MonoTorrent which provides torrent and magnet downloading.</param> /// <param name="folderProvider">Folder provider must not be null.</param> /// <param name="cacheProvider">Cache provider must not be null.</param> /// <param name="checkPoint">Set the downloader to start at given checkPoint.</param> /// <param name="maximumConnections"> /// The maximum number of concurrent open connections for this torrent. /// Defaults to 60.</param> /// <param name="maximumDownloadSpeed"> /// The maximum download speed, in bytes per second, for this torrent. /// A value of 0 means unlimited. Defaults to 0.</param> /// <param name="maximumUploadSpeed"> /// The maximum upload speed, in bytes per second, for this torrent. /// A value of 0 means unlimited. defaults to 0.</param> /// <param name="uploadSlots"> /// The number of peers which can be uploaded to concurrently for this torrent. /// A value of 0 means unlimited. defaults to 8.</param> /// <param name="customAnnounceUrls">Custom announce URLs.</param> public TorrentDownloader( DownloadTask task, ClientEngine engine, IFolderProvider folderProvider, ICacheStorageProvider cacheProvider, byte[] checkPoint = null, int maximumConnections = 60, int maximumDownloadSpeed = 0, int maximumUploadSpeed = 0, int uploadSlots = 8, IEnumerable <string> announceUrls = null ) : base(task) { Ensure.That(task.Target is TorrentTarget).IsTrue(); Ensure.That(cacheProvider, nameof(cacheFolder)).IsNotNull(); Ensure.That(folderProvider, nameof(folderProvider)).IsNotNull(); Ensure.That(engine, nameof(engine)).IsNotNull(); Ensure.That(maximumConnections).IsGt(0); Ensure.That(maximumDownloadSpeed).IsGte(0); Ensure.That(maximumUploadSpeed).IsGte(0); Ensure.That(uploadSlots).IsGt(0); this.engine = engine; this.cacheProvider = cacheProvider; this.folderProvider = folderProvider; this.maximumConnections = maximumConnections; this.maximumDownloadSpeed = maximumDownloadSpeed; this.maximumUploadSpeed = maximumUploadSpeed; this.uploadSlots = uploadSlots; this.announceUrls = announceUrls?.ToList(); TorrentTarget realTarget = (TorrentTarget)task.Target; Progress = new BaseMeasurableProgress( realTarget.Torrent.Files.Sum( file => realTarget.IsFileSelected(file) ? file.Length : 0)); Speed = SharedSpeedCalculatorFactory.NewSpeedCalculator(); Progress.ProgressChanged += (sender, arg) => Speed.CurrentValue = Progress.DownloadedSize; if (checkPoint != null) { ApplyCheckPoint(checkPoint); } }
public ICollection <Anime> GetAnimes(IWebDriver webDriver, string destination) { this.webDriver = webDriver; IList <string> animeUrls = new List <string>(); //Handle updated Privacy Policy try { webDriver.FindElement(By.ClassName("modal-content")).FindElement(By.TagName("Button")).Submit(); } catch (NoSuchElementException) { } folderProvider = new FolderChecker(destination); IList <Anime> animes = new List <Anime>(); foreach (IWebElement animeRow in webDriver.FindElements(By.ClassName("list-item"))) { Anime currentAnime = new Anime(); IWebElement nameElement = animeRow.FindElement(By.ClassName("title")).FindElement(By.TagName("a")); animeUrls.Add(nameElement.GetAttribute("href")); currentAnime.Name = nameElement.Text; IWebElement progressDiv = animeRow.FindElement(By.ClassName("progress")); currentAnime.WatchedEpisodes = folderProvider.GetWatchedEpisodeCount(currentAnime); currentAnime.CurrentEpisode = folderProvider.GetCurrentEpisode(currentAnime); try { currentAnime.TotalEpisodes = Int32.Parse(progressDiv.FindElements(By.TagName("span"))[1].Text); } catch (FormatException) { currentAnime.TotalEpisodes = int.MaxValue; } animes.Add(currentAnime); } IsSignedIn = IsLoggedIn(); FindAltName(animeUrls, animes); return(animes); }
/// <summary> /// Construct a HttpDownloader with given task and configurations. /// </summary> /// <param name="task">Download task, must with HttpTarget.</param> /// <param name="folderProvider">Folder provider must not be null.</param> /// <param name="cacheProvider">Cache provider must not be null.</param> /// <param name="bufferProvider">Buffer provider must not be null.</param> public HttpDownloader( DownloadTask task, IFolderProvider folderProvider, ICacheStorageProvider cacheProvider, IBufferProvider bufferProvider ) : base(task) { Ensure.That(task.Target is HttpTarget, null, opts => opts.WithMessage($"type of {nameof(task.Target)} must be {nameof(HttpTarget)}") ).IsTrue(); Ensure.That(folderProvider, nameof(folderProvider)).IsNotNull(); Ensure.That(cacheProvider, nameof(cacheProvider)).IsNotNull(); Ensure.That(bufferProvider, nameof(bufferProvider)).IsNotNull(); this.folderProvider = folderProvider; this.cacheProvider = cacheProvider; this.bufferProvider = bufferProvider; Progress = new BaseProgress(); Speed = SharedSpeedCalculatorFactory.NewSpeedCalculator(); Progress.ProgressChanged += (sender, arg) => Speed.CurrentValue = Progress.DownloadedSize; }
public async Task <IResult <Void> > CreateFolderAsync( string name, string path, IFolderProvider <T> folderProvider = null) { folderProvider = folderProvider ?? FolderProvider; var folderResult = folderProvider.GetFolder(path); if (!folderResult.IsSuccess) { return(new FailureResult(folderResult.Exception)); } var addChildFolderResult = await folderResult.Data.AddChildFolderAsync(name); if (!addChildFolderResult.IsSuccess) { return(new FailureResult(addChildFolderResult.Exception)); } return(new SuccessResult()); }
public FolderManager(IFolderProvider <T> provider) : base(provider) { }
public SqLiteConnectionStringBuilder(IFolderProvider folderProvider) { this.folderProvider = folderProvider; }
public AsymetricEnryptionService(IKeyStore keyStore, IFolderProvider folderProvider) { this.keyStore = keyStore; this.folderProvider = folderProvider; }
public ContentManager(IFolderProvider <T> folderProvider, IPathManager pathManager) { FolderProvider = folderProvider; PathManager = pathManager; }
protected FolderContentManagerBase(IFolderProvider <T> folderProvider) : base(folderProvider, new PathManager()) { }
protected FolderContentManagerBase( IPathManager pathManager, IFolderProvider <T> folderProvider) : base(folderProvider, pathManager) { }