public void parseUserInfoMsg(byte[] packet) { int iCurPos = 0; uint sequence = 0; Packet_Head head = new Packet_Head(); sequence=head.charArrayToInt(packet,4); iCurPos+=4; }
/// <summary> /// 查看该玩家是否被激活 /// </summary> /// <returns></returns> public Message O2JAM2_AccountActive_Query() { System.Data.DataSet result = null; int status = -1; string serverIP = null; string account = null; string passwd = null; string number = null; try { //serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); // account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACCOUNT).m_bValueBuffer); passwd = account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_Id2).m_bValueBuffer); number = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_Id1).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_ActiveState); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_ActiveState); result = AccountInfo.O2JAM2_AccountActive_Query(account, passwd, number); if (result != null && result.Tables[0].Rows.Count > 0) { //密码错误 if (!result.Tables[0].Rows[0].ItemArray[3].Equals(passwd)) { status = 2; byte[] bgMsg_Status = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); TLV_Structure Msg_Status = new TLV_Structure(TagName.O2JAM2_Status, (uint)bgMsg_Status.Length, bgMsg_Status); byte[] baMsg_Pass = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, result.Tables[0].Rows[0].ItemArray[3]); TLV_Structure Msg_Pass = new TLV_Structure(TagName.O2JAM2_Id2, (uint)baMsg_Pass.Length, baMsg_Pass); Packet_Body body = new Packet_Body(new TLV_Structure[] { Msg_Status, Msg_Pass }, 2); Packet_Head head = new Packet_Head(SeqID_Generator.Instance().GetNewSeqID(), Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, body.m_uiBodyLen); return(new Message(new Packet(head, body))); } //激活码未被使用过 else if (Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[5].ToString()) == 0) { status = 3; return(Message.COMMON_MES_RESP(status, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.CR_STATUS, TagFormat.TLV_INTEGER)); } // 激活码已被使用 else if (Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[5].ToString()) == 1) { status = 4; byte[] bgMsg_Status = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); TLV_Structure Msg_Status = new TLV_Structure(TagName.O2JAM2_Status, (uint)bgMsg_Status.Length, bgMsg_Status); byte[] baMsg_Account = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[1])); TLV_Structure Msg_Account = new TLV_Structure(TagName.O2JAM2_UserName, (uint)baMsg_Account.Length, baMsg_Account); Packet_Body body = new Packet_Body(new TLV_Structure[] { Msg_Status, Msg_Account }, 2); Packet_Head head = new Packet_Head(SeqID_Generator.Instance().GetNewSeqID(), Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, body.m_uiBodyLen); return(new Message(new Packet(head, body))); } else { return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } /*// 查询帐号未被激活 * else if (!result.Tables[0].Rows[0].ItemArray[3].Equals(account)) * { * status = 5; * } * // 查询帐号已被激活 * else if (result.Tables[0].Rows[0].ItemArray[3].Equals(account)) * { * status = 6; * }*/ } return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } catch (System.Exception) { return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } }