protected virtual void OnClientReceiveFile(string friendName, string fileName, Byte[] fileByteReceive) { ClientReceiveFile?.Invoke(this, new ClientEventArgs() { clientFriendName = friendName, FileName = fileName, FileByte = fileByteReceive }); }
/// <summary> /// 接收数据处理 /// </summary> /// <param name="transmit">传输对象</param> /// <param name="data">数据包</param> /// <param name="effectiveBytes">数据有效字节</param> private void ReceiveDataHandler(Transmit transmit, byte[] data, int effectiveBytes) { string[] parameters = transmit.Parameter.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); switch (transmit.DataType) { case DataType.Text: ClientReceiveString?.Invoke(this, new ReceiveTextEventArgs(transmit.SourceID, transmit.Parameter)); break; case DataType.Image: ClientReceiveImage?.Invoke(this, new ReceiveFileEventArgs(transmit.SourceID, parameters[0], double.Parse(parameters[1]), data, effectiveBytes)); break; case DataType.File: ClientReceiveFile?.Invoke(this, new ReceiveFileEventArgs(transmit.SourceID, parameters[0], double.Parse(parameters[1]), data, effectiveBytes)); break; } }