コード例 #1
0
ファイル: SFTPClient.cs プロジェクト: st4ck/FTPbox
 public void Download(string cpath, string lpath)
 {
     using (var f = new FileStream(lpath, FileMode.Create, FileAccess.ReadWrite))
         lock (ftpcLock)
         {
             _sftpc.DownloadFile(cpath, f);
         }
 }
コード例 #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);
     }
 }
コード例 #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);
            }
        }