Esempio n. 1
0
 public Boot(IHostApplicationLifetime appLifetime, IUserSettings userSettings, IFileSystem fileSystem, IFileMerger fileMerger, IDownloadManager downloadManager,
             PlexRipperDbContext dbContext)
 {
     _appLifetime     = appLifetime;
     _userSettings    = userSettings;
     _fileSystem      = fileSystem;
     _fileMerger      = fileMerger;
     _downloadManager = downloadManager;
     _dbContext       = dbContext;
 }
        private static async Task <string> GetMergedTextAsync(IFileMerger merger)
        {
            await Console.Error.WriteLineAsync();

            await Console.Error.WriteLineAsync("[INFO] Merging all file contents into one...");

            string mergeText = merger.MergeFiles();
            await Console.Error.WriteLineAsync("[INFO] Done merging file contents...");

            return(mergeText);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DownloadManager"/> class.
        /// </summary>
        /// <param name="mediator">Defines a mediator to encapsulate request/response and publishing interaction patterns.</param>
        /// <param name="signalRService"></param>
        /// <param name="plexAuthenticationService">.</param>
        /// <param name="fileMerger">.</param>
        /// <param name="userSettings"></param>
        /// <param name="downloadQueue">Used to retrieve the next <see cref="DownloadTask"/> from the <see cref="DownloadQueue"/>.</param>
        /// <param name="notificationsService"></param>
        /// <param name="plexDownloadClientFactory"></param>
        public DownloadManager(
            IMediator mediator,
            ISignalRService signalRService,
            IPlexAuthenticationService plexAuthenticationService,
            IFileMerger fileMerger,
            IUserSettings userSettings,
            IDownloadQueue downloadQueue,
            INotificationsService notificationsService,
            Func <DownloadTask, PlexDownloadClient> plexDownloadClientFactory) : base(mediator, signalRService)
        {
            _plexAuthenticationService = plexAuthenticationService;
            _fileMerger                = fileMerger;
            _userSettings              = userSettings;
            _notificationsService      = notificationsService;
            _plexDownloadClientFactory = plexDownloadClientFactory;
            _downloadQueue             = downloadQueue;

            _fileMerger.FileMergeProgressObservable.Subscribe(OnFileMergeProgress);
        }
Esempio n. 4
0
        string MergeFileName(Header[] headers, IFileMerger merger, byte numberOfPart, long totalLength)
        {
            var ReadStreams = new MemoryStream[numberOfPart];
            for (byte i = 0; i < numberOfPart; i++)
                ReadStreams[i] = new MemoryStream(headers[i].FileName);

            var WriteStream = new MemoryStream();

            merger.Merge(WriteStream, ReadStreams, 0, numberOfPart, totalLength);
            WriteStream.Position = 0;

            byte[] buffer = new byte[WriteStream.Length];

            int lng = WriteStream.Read(buffer, 0, buffer.Length);

            var filenameBytes = new byte[lng];

            Array.Copy(buffer, 0, filenameBytes, 0, lng);

            return Encoding.Default.GetString(filenameBytes);
        }
Esempio n. 5
0
        public FileSynchronizer(
            IAppConfig appConfig,
            ILogger <FileSynchronizer> logger,
            IDirectoryStructureComparer directoryStructureComparer,
            IFileComparer fileComparer,
            IFileCopier fileCopier,
            IFileDeleter fileDeleter,
            IFileMerger fileMerger,
            IFileFilter fileFilter)
        {
            _appConfig = appConfig ?? throw new ArgumentNullException(nameof(appConfig));
            _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
            _directoryStructureComparer = directoryStructureComparer ?? throw new ArgumentNullException(nameof(directoryStructureComparer));
            _fileComparer = fileComparer ?? throw new ArgumentNullException(nameof(fileComparer));
            _fileCopier   = fileCopier ?? throw new ArgumentNullException(nameof(fileCopier));
            _fileDeleter  = fileDeleter ?? throw new ArgumentNullException(nameof(fileDeleter));
            _fileMerger   = fileMerger ?? throw new ArgumentNullException(nameof(fileMerger));
            _fileFilter   = fileFilter;

            _srcFileSystem  = _appConfig.Src;
            _destFileSystem = _appConfig.Dest;
        }
Esempio n. 6
0
 public FileCutterFileSorter(IFileCutter fileCutter, IFileMerger fileMerger)
 {
     _fileCutter = fileCutter;
     _fileMerger = fileMerger;
 }
Esempio n. 7
0
 public MergeScansControl(IFileMerger pdfMerger) : this()
 {
     _merger = pdfMerger ?? new ItextPdfMerger();
 }