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); }
public AutoDownloadForm() { InitializeComponent(); _ftpWrapper = new FtpWrapper(); _cleanup = new FileCleanup(Log); _processWorker.WorkerReportsProgress = true; _processWorker.DoWork += DownloadFiles; _checkWorker.WorkerReportsProgress = true; _checkWorker.ProgressChanged += BeginDownloading; _checkWorker.DoWork += CheckServer; FtpWrapper.DownloadList.OnAdd += FileAdded; FtpWrapper.DownloadList.OnRemove += RemoveFileFromList; Log($"FTP AutoDownloader v{typeof (Program).Assembly.GetName().Version}\n"); _timer = new Timer(BeginCheck, 1, new TimeSpan(0, 0, 5), new TimeSpan(0, Settings.Default.NormalRecheckTime, 0)); }
public AutoDownload(IFtpWrapper ftpWrapper, IFileCleanup cleanup) { _ftpWrapper = ftpWrapper; _ftpWrapper.OnDownloadComplete += cleanup.CleanupFile; _isDownloading = false; }