public SGIP_MESSAGE(byte[] bytes) { int i = 0; byte[] buffer = new byte[4]; Buffer.BlockCopy(bytes, i, buffer, 0, buffer.Length); Array.Reverse(buffer); this._Total_Length = BitConverter.ToUInt32(buffer, 0); i += 4; Buffer.BlockCopy(bytes, 4, buffer, 0, buffer.Length); Array.Reverse(buffer); this._Command_Id = (SGIP_COMMAND)BitConverter.ToUInt32(buffer, 0); i += 4; Buffer.BlockCopy(bytes, i, buffer, 0, buffer.Length); Array.Reverse(buffer); this._SrcNodeSequence = BitConverter.ToUInt32(buffer, 0); i += 4; Buffer.BlockCopy(bytes, i, buffer, 0, buffer.Length); Array.Reverse(buffer); this._DateSequence = BitConverter.ToUInt32(buffer, 0); i += 4; Buffer.BlockCopy(bytes, i, buffer, 0, buffer.Length); Array.Reverse(buffer); this._Sequence_Id = BitConverter.ToUInt32(buffer, 0); }
private uint _Sequence_Id; // 4 Unsigned Integer 消息流水号,顺序累加,步长为1,循环使用(一对请求和应答消息的流水号必须相同) public SGIP_MESSAGE(uint Total_Length, SGIP_COMMAND Command_Id, uint Sequence_Id) { this._Total_Length = Total_Length; this._Command_Id = Command_Id; this._SrcNodeSequence = SGIP12.Setting.SrcNodeSequence; this._DateSequence = uint.Parse(Util.Get_MMDDHHMMSS_String(DateTime.Now)); this._Sequence_Id = Sequence_Id; }
public SGIP_MESSAGE ( uint Total_Length , SGIP_COMMAND Command_Id , uint SrcNodeSequence , uint DateSequence , uint Sequence_Id ) //发送前 { this._Total_Length = Total_Length; this._Command_Id = Command_Id; this._SrcNodeSequence = SrcNodeSequence; this._DateSequence = DateSequence; this._Sequence_Id = Sequence_Id; }