public FileReceiveBufferEventArgs( ReceiveFileManager receiveFileManager, int size) : base() { _receiveFileManager = receiveFileManager; _size = size; }
/// <summary> /// 完成接收文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReceiveFileManagerReceiveFileComplete( object sender, FileReceiveCompleteEventArgs e) { ReceiveFileManager receiveFileManager = sender as ReceiveFileManager; OnFileReceiveComplete(new FileReceiveEventArgs(receiveFileManager)); ReceiveFileManagerList.Remove(receiveFileManager.MD5); }
private void ReceiveFileManagerReceiveFileTimeout( object sender, EventArgs e) { ReceiveFileManager receiveFileManager = sender as ReceiveFileManager; ResponeTraFransfersFile responeTraFransfersFile = new ResponeTraFransfersFile( receiveFileManager.MD5, 0, receiveFileManager.GetNextReceiveIndex()); Send( (int)Command.ResponeSendFilePack, responeTraFransfersFile, receiveFileManager.RemoteIP); }
/// <summary> /// 允许接收 /// </summary> /// <param name="e"></param> public void AcceptReceive(RequestSendFileEventArgs e) { TraFransfersFileStart traFransfersFileStart = e.TraFransfersFileStart; IPEndPoint remoteIP = e.RemoteIP; ResponeTraFransfersFile responeTraFransfersFile; if (e.Cancel) { responeTraFransfersFile = new ResponeTraFransfersFile( traFransfersFileStart.MD5, 0, -1); Send((int)Command.ResponeSendFile, responeTraFransfersFile, remoteIP); } else { ReceiveFileManager receiveFileManager; if (!ReceiveFileManagerList.TryGetValue( traFransfersFileStart.MD5, out receiveFileManager)) { receiveFileManager = new ReceiveFileManager( traFransfersFileStart.MD5, e.Path, traFransfersFileStart.FileName, traFransfersFileStart.PartCount, traFransfersFileStart.PartSize, traFransfersFileStart.Length, remoteIP); receiveFileManager.ReceiveFileComplete += new FileReceiveCompleteEventHandler( ReceiveFileManagerReceiveFileComplete); receiveFileManager.ReceiveFileTimeout += new EventHandler(ReceiveFileManagerReceiveFileTimeout); ReceiveFileManagerList.Add( traFransfersFileStart.MD5, receiveFileManager); receiveFileManager.Start(); } responeTraFransfersFile = new ResponeTraFransfersFile( traFransfersFileStart.MD5, 0, 0); Send((int)Command.ResponeSendFile, responeTraFransfersFile, remoteIP); } }
public FileReceiveEventArgs( ReceiveFileManager receiveFileManager) : base() { _receiveFileManager = receiveFileManager; }