Esempio n. 1
0
 public CJRFTPException(FileEntity filename, string msg)
     : base(msg)
 {
     FileName = filename.FileName;
     Folder = filename.ContainingFolder;
 }
Esempio n. 2
0
 private void moveToSendFolder(FileEntity fileEntity, string destPath, string workingPath)
 {
     var workingFileName = workingPath.ConcatenateFilePaths(fileEntity.FileName);
     var sendFileName = destPath.ConcatenateFilePaths(fileEntity.FileName);
         _fUtil.MoveFileWithOverwrite(workingFileName, sendFileName);
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
 private static void moveToArchiveFolder(FileEntity file, string originPath)
 {
     var archiveFile = originPath.ConcatenateFilePaths(@"Archive\").ConcatenateFilePaths(file.FileName);
     File.Move(file.FullPath,archiveFile);
 }
Esempio n. 5
0
        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);
        }