コード例 #1
0
ファイル: CJRFTPException.cs プロジェクト: agglerithm/CJRFTP
 public CJRFTPException(FileEntity filename, string msg)
     : base(msg)
 {
     FileName = filename.FileName;
     Folder = filename.ContainingFolder;
 }
コード例 #2
0
ファイル: PGPWrapper.cs プロジェクト: agglerithm/CJRFTP
 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);
 }
コード例 #3
0
ファイル: FTPRepository.cs プロジェクト: agglerithm/CJRFTP
 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);
     }
 }
コード例 #4
0
ファイル: PGPWrapper.cs プロジェクト: agglerithm/CJRFTP
 private static void moveToArchiveFolder(FileEntity file, string originPath)
 {
     var archiveFile = originPath.ConcatenateFilePaths(@"Archive\").ConcatenateFilePaths(file.FileName);
     File.Move(file.FullPath,archiveFile);
 }
コード例 #5
0
ファイル: FTPRepository.cs プロジェクト: agglerithm/CJRFTP
        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);
        }