Ejemplo n.º 1
0
		public FtpDownloader(Settings settings, FtpEvents events = null)
		{
			_events = events ?? new FtpEvents();
			_settings = settings;
			TvRenamer.SetRemapFile(settings.RemapFile);
			_ftpWrapper = GenerateFtpWrapper(_settings, _events);
			_cleanup = GenerateFileCleanup(_settings, _events);
		}
Ejemplo n.º 2
0
		private static FtpWrapper GenerateFtpWrapper(Settings settings, FtpEvents events)
		{
			var ftp = new FtpWrapper(settings);

			if (events == null)
			{
				return ftp;
			}

			ftp.OnProgressUpdated += events.UpdatedProgressHandler;
			ftp.OnDownloadStarted += events.DownloadStartedHandler;
			ftp.OnDownloadError += events.DownloadErrorHandler;
			ftp.OnDownloadComplete += events.DownloadCompletedHandler;
			
			return ftp;
		}
Ejemplo n.º 3
0
		private static FileCleanup GenerateFileCleanup(Settings settings, FtpEvents events)
		{
			var cleanup = new FileCleanup(settings.VideoRootPath);
			
			cleanup.CleanupStarted += events.CleanupStartedHandler;
			cleanup.CleanupFinished += events.CleanupCompletedHandler;

			return cleanup;
		}