public virtual bool UnSerialize(ILPMessageSerializer messageSerializer) { bool result = false; if (LOG_ERROR(messageSerializer != null)) { goto Exit0; } // # begin unserialize field # result = messageSerializer.ReadUInt16(out MsgId); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadUInt16(out MsgSize); if (LOG_ERROR(result)) { goto Exit0; } // # end # return(true); Exit0: return(false); }
public bool Init() { m_RecvMessageSerializer = new LPMessageSerializer(); if (LOG_ERROR(m_RecvMessageSerializer != null)) { goto Exit0; } m_SendMessageSerializer = new LPMessageSerializer(); if (LOG_ERROR(m_SendMessageSerializer != null)) { goto Exit0; } m_MessageCallBackList = new pfunMessageCallback[LPProtocol.max_message_count]; if (LOG_ERROR(m_MessageCallBackList != null)) { goto Exit0; } // 消息回调函数注册 m_MessageCallBackList[(int)T2C_MESSAGE_ID.t2c_login_ack] = OnGTLoginAck; return(true); Exit0: return(false); }
public override bool UnSerialize(ILPMessageSerializer messageSerializer) { bool result = false; if (LOG_ERROR(messageSerializer != null)) { goto Exit0; } // # begin unserialize field # result = base.UnSerialize(messageSerializer); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadUInt8(out byValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadUInt16(out wValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadUInt32(out dwValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadUInt64(out qwValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.ReadString(out sValue); if (LOG_ERROR(result)) { goto Exit0; } // # end # return(true); Exit0: return(false); }
public virtual bool Serialize(ILPMessageSerializer messageSerializer) { bool result = false; UInt16 size = 0; byte[] buf = null; if (LOG_ERROR(messageSerializer != null)) { goto Exit0; } // # begin serialize field # result = messageSerializer.WriteUInt16(MsgId); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteUInt16(4); if (LOG_ERROR(result)) { goto Exit0; } // # end # buf = messageSerializer.GetSerializeBuf(); if (LOG_ERROR(buf != null)) { goto Exit0; } if (LOG_ERROR(messageSerializer.GetSerializeSize() <= LPMessageHeader.MAX_PACKET_LEN)) { goto Exit0; } size = (UInt16)messageSerializer.GetSerializeSize(); if (LOG_ERROR(size >= 4)) { goto Exit0; } buf[2] = (Byte)(size >> 8); buf[3] = (Byte)((size << 8) >> 8); return(true); Exit0: return(false); }
public override bool Serialize(ILPMessageSerializer messageSerializer) { bool result = false; UInt16 size = 0; byte[] buf = null; if (LOG_ERROR(messageSerializer != null)) { goto Exit0; } // # begin serialize field # result = base.Serialize(messageSerializer); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteUInt8(byValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteUInt16(wValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteUInt32(dwValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteUInt64(qwValue); if (LOG_ERROR(result)) { goto Exit0; } result = messageSerializer.WriteString(sValue); if (LOG_ERROR(result)) { goto Exit0; } // # end # buf = messageSerializer.GetSerializeBuf(); if (LOG_ERROR(buf != null)) { goto Exit0; } if (LOG_ERROR(messageSerializer.GetSerializeSize() <= LPMessageHeader.MAX_PACKET_LEN)) { goto Exit0; } size = (UInt16)messageSerializer.GetSerializeSize(); if (LOG_ERROR(size >= 4)) { goto Exit0; } buf[2] = (Byte)(size >> 8); buf[3] = (Byte)((size << 8) >> 8); return(true); Exit0: return(false); }