示例#1
0
 public void DownloadAsync(string cpath, string lpath)
 {
     if (FTP)
     {
         _ftpc.GetFileAsyncCompleted += (sender, args) => DownloadComplete.SafeInvoke(sender, args);
         _ftpc.GetFileAsync(cpath, lpath, FileAction.Create);
     }
     else
     {
         using (var f = new FileStream(lpath, FileMode.Create, FileAccess.ReadWrite))
             _sftpc.BeginDownloadFile(cpath, f, ar => DownloadComplete.SafeInvoke(_sftpc, EventArgs.Empty), state: null);
     }
 }