public void CompleteDownload(FTPLocalFileConfig config, string fname) { _fileUtil.MoveFileWithOverwrite(GetTransferPath(config).ConcatenateFilePaths(fname), GetDownloadPath(config).ConcatenateFilePaths(fname)); }
public string GetArchivePath(FTPLocalFileConfig config) { return _fileUtil.EnsurePath(GetUploadPath(config).ConcatenateFilePaths("archive")); }
public string GetUploadPath(FTPLocalFileConfig config) { if (config.UsesEncryption) return _fileUtil.EnsurePath(config.UploadFolder.ConcatenateFilePaths(ENCRYPTED)); return _fileUtil.EnsurePath(config.UploadFolder); }
public void ArchiveFile(FTPLocalFileConfig config, string fname) { _fileUtil.MoveFileWithOverwrite(GetUploadPath(config).ConcatenateFilePaths(fname), GetArchivePath(config).ConcatenateFilePaths(fname)); }
public string GetUploadErrorPath(FTPLocalFileConfig config) { return _fileUtil.EnsurePath(GetUploadPath(config).ConcatenateFilePaths("error")); }
public IList<FileEntity> GetUploadFiles(FTPLocalFileConfig config) { return _fileUtil.GetListFromFolder(GetUploadPath(config),config.FileMask); }
public string GetDownloadErrorPath(FTPLocalFileConfig config) { return _fileUtil.EnsurePath(GetDownloadPath(config).ConcatenateFilePaths(ERROR)); }
public string GetTransferPath(FTPLocalFileConfig config) { return _fileUtil.EnsurePath(GetDownloadPath(config).ConcatenateFilePaths(TRANSFER)); }
private void upload(string remoteFolder, IEnumerable<FileEntity> files, FTPLocalFileConfig config) { _error = ""; int result = _nav.SetCurrentDirectory(_conn,remoteFolder); if (result != 250 && result != 220) { if (result == 550 && _nav.CurrentDirectory != RootDirectoryName) { MoveUp(1); upload(remoteFolder, files, config); return; } throw new CJRFTPException(config.UploadFolder, _conn.LastMessage); } files.ToList().ForEach(f => upload_file(f,config)); if(_error.Length > 0) throw new Exception(_error); }
private void upload_file(FileEntity file, FTPLocalFileConfig config) { string remoteFile = file.FileName; try { string localFile = file.FullPath; _fileSvc.SendFile(_conn, localFile, remoteFile); _fileRepo.ArchiveFile(config, file.FileName); } catch (Exception ex) { Logger.Error(this, "Failed to upload file " + file.FileName, ex); _error += "Upload() caused an exception: " + ex.Message + "\r\n"; throw new CJRFTPException(file, ex.Message); } }
private void download_file(FileEntity file, string prefix, FTPLocalFileConfig config) { string fname = file.FileName; try { if (fname == null || fname[0] == '\0') return; if (fname.IndexOf(prefix) < 0) fname = prefix + fname; try { _fileSvc.GetFile(_conn, _fileRepo.GetTransferPath(config) .ConcatenateFilePaths(fname),file.FileName); } catch(ApplicationException ex) { throw new Exception("'Download()' resulted in the following error: " + ex.Message + ";Messages: " + _conn.MessageList.Combine(";")); } _fileRepo.CompleteDownload(config,fname); } catch (Exception ex) { _fileRepo.MoveToErrorFolder(_fileRepo.GetTransferPath(config), fname); throw new Exception("GetFile() caused an exception: " + ex.Message); } _fileSvc.DeleteFile(_conn, file.FileName); }
private void download(FTPLocalFileConfig config, List<FileEntity> list) { list.ForEach(file => download_file(file, Prefix, config)); return; }
public string UploadFolder(FTPLocalFileConfig config) { return _fileRepo.GetUploadPath(config); }
public void PutFiles(IList<FileEntity> files, FTPLocalFileConfig config, string remotePath) { if (files.Count == 0) return; ensure_logged_on(); upload(remotePath, files, config); }
// public string RenameToFolder // { // get; set; // } public FileEntity[] GetFiles(string remotePath, FTPLocalFileConfig config) { ensure_logged_on(); var flist = QueryFiles(remotePath); var files = build_file_list(flist, _fileRepo.GetDownloadPath(config)).ToList(); download(config,files); return files.ToArray(); }