/// <summary> /// 将数据打包发送 /// </summary> /// <param name="displayController"></param> /// <param name="screenIp"></param> /// <param name="screenPort"></param> /// <param name="rowData"></param> private void PackSendData(DisplayController displayController, string screenIp, int screenPort, object rowData) { try { MsgGeneral general = new MsgGeneral(); general.FrameHead = BitConverter.GetBytes((ushort)0x5AA5); Array.Reverse(general.FrameHead); //大小端 general.FrameLen = (byte)(Marshal.SizeOf(rowData) + 1); //因含0x82一个字节 general.FrameConst = 0x82; byte[] arraySendData = general.StructToBytes().MergeBytes(rowData.StructToBytes()); TCPMessageEx tcpMessage = new TCPMessageEx(screenIp, screenPort, arraySendData); displayController.DisplayDataEnqueue(new PivasEventArgs <TCPMessageEx>(tcpMessage)); } catch (Exception ex) { InternalLogger.Log.Error("打包发送;需将data分成指定格式出错:" + ex.Message); } }