private void SendFileManageReadFileBuffer( object sender, ReadFileBufferEventArgs e) { TraFransfersFile ts = new TraFransfersFile( e.Index, e.Buffer); Send(1, ts); }
private void SendFileManageReadFileBuffer( object sender, ReadFileBufferEventArgs e) { SendFileManager sendFileManager = sender as SendFileManager; TraFransfersFile ts = new TraFransfersFile( sendFileManager.MD5, e.Index, e.Buffer); Send((int)Command.RequestSendFilePack, ts); }
private void OnRecieveBuffer( TraFransfersFile traFransfersFile, IPEndPoint remoteEP) { _receiveFileManager.ReceiveBuffer( traFransfersFile.Index, traFransfersFile.Buffer); if (_receiveFileManager.PartCount == traFransfersFile.Index + 1) { Send(2, "OK", remoteEP); } else { Send(1, "OK", remoteEP); } }
private void OnRecieveBuffer( TraFransfersFile traFransfersFile, IPEndPoint remoteEP) { ReceiveFileManager receiveFileManager; if (!ReceiveFileManagerList.TryGetValue( traFransfersFile.MD5, out receiveFileManager)) { return; } if (receiveFileManager != null) { ResponeTraFransfersFile responeTraFransfersFile; int size = receiveFileManager.ReceiveBuffer( traFransfersFile.Index, traFransfersFile.Buffer); if (receiveFileManager.Completed) { responeTraFransfersFile = new ResponeTraFransfersFile( traFransfersFile.MD5, size, -2); Send( (int)Command.ResponeSendFilePack, responeTraFransfersFile, remoteEP); } else { responeTraFransfersFile = new ResponeTraFransfersFile( traFransfersFile.MD5, size, receiveFileManager.GetNextReceiveIndex()); Send( (int)Command.ResponeSendFilePack, responeTraFransfersFile, remoteEP); } OnFileReceiveBuffer( new FileReceiveBufferEventArgs( receiveFileManager, traFransfersFile.Buffer.Length)); } }