Example #1
0
        /// <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);
            }
        }
Example #2
0
        static void testSizeOf()
        {
            MsgChareResRow t = new MsgChareResRow();

            Console.WriteLine("MsgChareResRow(50):" + Marshal.SizeOf(t).ToString());

            MsgDEmployeeRow t1 = new MsgDEmployeeRow();

            Console.WriteLine("MsgDEmployeeRow(38):" + Marshal.SizeOf(t1).ToString());

            MsgDrugRow t2 = new MsgDrugRow();

            Console.WriteLine("MsgDrugRow(116):" + Marshal.SizeOf(t2).ToString());

            MsgPatientRow t3 = new MsgPatientRow();

            Console.WriteLine("MsgPatientRow(92):" + Marshal.SizeOf(t3).ToString());

            MsgGeneral t4 = new MsgGeneral();

            Console.WriteLine("MsgGeneral(4):" + Marshal.SizeOf(t4).ToString());
        }