/// <summary> /// 进入区块链 /// </summary> /// <returns>状态</returns> public int Enter() { Binary bw = new Binary(); bw.WriteInt(DataCenter.ServerChatService.Port); bw.WriteInt(DataCenter.IsFull ? 1 : 0); bw.WriteString(DataCenter.UserID); bw.WriteString(DataCenter.UserName); byte[] bytes = bw.GetBytes(); int ret = Send(new CMessage(GroupID, ServiceID, FUNCTIONID_ENTER, SessionID, DataCenter.ChatRequestID, SocketID, 0, CompressType, bytes.Length, bytes)); bw.Close(); return(ret); }
/// <summary> /// 发送消息 /// </summary> /// <param name="userID">方法ID</param> /// <param name="tokens">请求ID</param> /// <param name="chatData">发送字符</param> public int Send(int functionID, int requestID, ChatData chatData) { Binary bw = new Binary(); bw.WriteString(chatData.m_aes); bw.WriteString(chatData.m_tokens); bw.WriteString(chatData.m_from); bw.WriteString(chatData.m_to); bw.WriteString(chatData.m_content); bw.WriteInt(chatData.m_bodyLength); if (chatData.m_bodyLength > 0) { bw.WriteBytes(chatData.m_body); } byte[] bytes = bw.GetBytes(); int ret = Send(new CMessage(GroupID, ServiceID, functionID, SessionID, requestID, SocketID, 0, CompressType, bytes.Length, bytes)); bw.Close(); return(ret); }