/// <summary> /// 用户发送文件请求 /// </summary> /// <param name="e"></param> private void FileSendRequestMethod(DataArrivalEventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(FileSendRequestEvent, e); } string[] fileInfo = TextEncoder.bytesToText(e.msg.Content).Split('|'); if (fileInfo.Length < 4) return;//抛掉非法数据 //string fileInfo = FileName + "|" + FileLen.ToString() + "|" + fileExtension + "|" + FileMD5Value;//初次请求发送文件时要先发送“控件参数”到对方,请求对方创建“文件发送控件”并建立连接 // FileTransfers(false, fileInfo[0], fileInfo[0], Convert.ToInt32(fileInfo[1]), fileInfo[2], fileInfo[3]); }
//接收图片 /// <summary> /// 图片文件发送请求 /// </summary> /// <param name="e"></param> private void onUserImageSendRequest(DataArrivalEventArgs e) { string[] fileInfo = TextEncoder.bytesToText(e.msg.Content).Split('|'); if (fileInfo.Length < 4) return;//抛掉非法数据 //FormSendMsg f = FormAccess.newSendMsgForm(e.msg.SendID); //if (f == null) return; //string fileInfo = FileName + "|" + FileLen.ToString() + "|" + fileExtension + "|" + FileMD5Value;//初次请求发送文件时要先发送“控件参数”到对方,请求对方创建“文件发送控件”并建立连接 ImageTransfers(false, fileInfo[0], fileInfo[0], Convert.ToInt32(fileInfo[1]), fileInfo[2], fileInfo[3]); }
/// <summary> /// 获取对方文件传输UDP端口 /// </summary> /// <param name="e"></param> private void onUserFileTransmitGetUDPPort(DataArrivalEventArgs e) { string[] IdInfo = TextEncoder.bytesToText(e.msg.Content).Split('|'); if (IdInfo.Length < 2) return; setFileTransmitGetUdpPort(IdInfo[0], IdInfo[1], IdInfo[2]); }