Exemple #1
0
        /// <summary>
        /// Downloads remote file using alternate local filename.
        /// </summary>
        /// <param name="localFile">Local filename to use for download.</param>
        public void Get(string localFile)
        {
            string            remoteFile = FtpPath.Combine(m_parent.FullPath, Name);
            FtpFileTransferer transferer = new FtpFileTransferer(m_parent, localFile, remoteFile, Size, TransferDirection.Download);

            transferer.StartTransfer();
        }
Exemple #2
0
        /// <summary>
        /// Downloads remote file using alternate local filename.
        /// </summary>
        /// <param name="localFile">Local filename to use for download.</param>
        public void Get(string localFile)
        {
            string            remoteFile = $"{m_parent.FullPath}/{Name}";
            FtpFileTransferer transferer = new FtpFileTransferer(m_parent, localFile, remoteFile, Size, TransferDirection.Download);

            transferer.StartTransfer();
        }
Exemple #3
0
        /// <summary>
        /// Starts asynchrnonous local file upload to directory using alternate name.
        /// </summary>
        /// <param name="localFile">Local file to upload.</param>
        /// <param name="remoteFile">Remote filename to use for upload.</param>
        public void BeginPutFile(string localFile, string remoteFile)
        {
            CheckSessionCurrentDirectory();

            FileInfo fi = new FileInfo(localFile);

            if ((object)remoteFile == null)
            {
                remoteFile = fi.Name;
            }

            FtpFileTransferer transfer = new FtpFileTransferer(this, localFile, remoteFile, fi.Length, TransferDirection.Upload);

            transfer.StartAsyncTransfer();
        }
Exemple #4
0
        /// <summary>
        /// Starts asynchronous remote file download from directory using alternate local filename.
        /// </summary>
        /// <param name="localFile">Local filename to use for download.</param>
        /// <param name="remoteFile">Remote filename to download.</param>
        public void BeginGetFile(string localFile, string remoteFile)
        {
            InitHashtable();

            FtpFile file;

            if (m_files.TryGetValue(remoteFile, out file))
            {
                FtpFileTransferer transfer = new FtpFileTransferer(this, localFile, remoteFile, file.Size, TransferDirection.Download);
                transfer.StartAsyncTransfer();
            }
            else
            {
                throw new FtpFileNotFoundException(remoteFile);
            }
        }