Beispiel #1
0
        /// <summary>
        /// Downloads a file
        /// </summary>
        /// <param name="credentials">The ssh site credentials</param>
        /// <param name="fileMap">The mapping file to download</param>
        /// <param name="replace">True if the downloaded file will be replaced</param>
        public static void Download(this SiteCredentials credentials, MappedPath fileMap, Boolean replace)
        {
            FileInfo sC, lC;

            AuraSftpClient.SSHTransactionVoid(credentials, (AuraSftpClient c) => {
                sC = new FileInfo(fileMap.GetFullServerCopy());
                lC = new FileInfo(fileMap.GetFullProjectCopy());
                DownloadFile(c, fileMap.GetFullRemotePath(), sC, lC, replace);
            });
        }
Beispiel #2
0
        /// <summary>
        /// Downloads a directory
        /// </summary>
        /// <param name="client">The Sftp client</param>
        /// <param name="file">The directory used to download its files</param>
        /// <param name="filter">The download filter</param>
        /// <param name="silentDownload">Download the files without listing everything</param>
        public static void Download(this RenciSftpClient client, SiteCredentials credentials,
                                    MappedPath dir, SftpFilter filter, Boolean replace, Boolean silentDownload = false)
        {
            var      files = SftpUtils.ListFiles(client, dir.GetFullRemotePath(), filter, silentDownload);
            string   fileName, serverCopy;
            FileInfo cC, wC;

            AuraSftpClient.SSHTransactionVoid(credentials, (Action <AuraSftpClient>)((AuraSftpClient c) => {
                foreach (String remoteFile in files)
                {
                    fileName   = remoteFile.Replace((string)dir.GetFullRemotePath(), "").Substring(1).Replace("/", "\\");
                    serverCopy = Path.Combine((string)dir.GetFullServerCopy(), fileName);
                    //Cache copy
                    cC = new FileInfo(serverCopy);
                    //The path to the working copy
                    wC = new FileInfo(Path.Combine((string)dir.GetFullProjectCopy(), fileName));
                    DownloadFile(c, remoteFile, cC, wC, replace, silentDownload);
                }
            }));
        }