public UploadInfo(WinFileSystem win, ClientInfo controlledClient, string localPath, FileTransmissionInfo trans) { LocalPath = localPath; File = trans.File; ID = trans.ID; Dialog = new ProgressDialog(win) { Message = "正在上传" + File.Name }; Dialog.Value = 0; Dialog.Minimum = 0; Dialog.Maximum = trans.File.Length; Dialog.Title = "上传"; Dialog.Cancle += (p1, p2) => { Canceled = true; Dispose(); Telnet.Instance.Send(new CommandBody(File_AskForCancelUpload, Global.CurrentClient.ID, controlledClient.ID, ID)); }; Dialog.Closed += (p1, p2) => { if (Dialog.Canceled == false) { win.RefreshFolder(); } }; Stream = System.IO.File.OpenRead(localPath); }
public DownloadingInfo(WinFileSystem win, ClientInfo controlledClient, string localPath, FileTransmissionInfo download) { LocalPath = localPath; File = download.File; ID = download.ID; Dialog = new ProgressDialog(win) { Message = "正在下载" + File.Name }; Dialog.Value = 0; Dialog.Minimum = 0; Dialog.Maximum = 1; Dialog.Title = "下载"; Dialog.Cancle += (p1, p2) => { Canceled = true; Dispose(true); Telnet.Instance.Send(new CommandBody(File_AskForCancelDownload, Global.CurrentClient.ID, controlledClient.ID, ID)); }; Dialog.Closed += (p1, p2) => { if (Dialog.Canceled == false) { win.RefreshFolder(); } }; Stream = System.IO.File.OpenWrite(localPath); Stream.SetLength(File.Length); }