Esempio n. 1
0
 public void Download(string cpath, string lpath)
 {
     using (var f = new FileStream(lpath, FileMode.Create, FileAccess.ReadWrite))
         lock (ftpcLock)
         {
             _sftpc.DownloadFile(cpath, f);
         }
 }
Esempio n. 2
0
 public void Download(string cpath, string lpath)
 {
     if (FTP)
     {
         _ftpc.GetFile(cpath, lpath, FileAction.Create);
     }
     else
     {
         using (var f = new FileStream(lpath, FileMode.Create, FileAccess.ReadWrite))
             _sftpc.DownloadFile(cpath, f);
     }
 }
Esempio n. 3
0
        public void Download(string cpath, string lpath)
        {
            if (FTP)
            {
                using (Stream file = File.OpenWrite(lpath), rem = _ftpc.OpenRead(cpath))
                {
                    var buf = new byte[8192];
                    int read;

                    while ((read = rem.Read(buf, 0, buf.Length)) > 0)
                    {
                        file.Write(buf, 0, read);
                    }
                }
            }
            else
            {
                using (var f = new FileStream(lpath, FileMode.Create, FileAccess.ReadWrite))
                    _sftpc.DownloadFile(cpath, f);
            }
        }