diff --git a/Service/TBox/Codec/Decoder.cs b/Service/TBox/Codec/Decoder.cs index 7ca0e25..17b25ae 100644 --- a/Service/TBox/Codec/Decoder.cs +++ b/Service/TBox/Codec/Decoder.cs @@ -32,7 +32,7 @@ public class Decoder : ByteToMessageDecoder Log.Info($"receive {BitUtls.BytesToHexStr(bytes)}"); - int id = BitConverter.ToInt32(new byte[] { bytes[4], bytes[3], bytes[2], bytes[1] }, 0); + int id = BitConverter.ToInt32(new byte[] { bytes[3], bytes[2], bytes[1], bytes[0] }, 0); Log.Info( $"receive id={id} {BitUtls.BytesToHexStr(BitConverter.GetBytes(0x1882D0F3))} {BitUtls.BytesToHexStr(BitConverter.GetBytes(4090528280))}"); BaseMsg baseMsg = id switch diff --git a/Service/TBox/Codec/Encoder.cs b/Service/TBox/Codec/Encoder.cs index c30d6b3..fcbaee5 100644 --- a/Service/TBox/Codec/Encoder.cs +++ b/Service/TBox/Codec/Encoder.cs @@ -19,6 +19,8 @@ public class Encoder : MessageToByteEncoder protected override void Encode(IChannelHandlerContext context, BaseMsg obj, IByteBuffer output) { byte[] bytes = obj.ToBytes(); - output.WriteBytes(bytes); + byte[] result = + { 0, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], 0, 0, 0, 0 }; + output.WriteBytes(result); } }