/// <summary> /// 加载英雄数据 /// </summary> /// <param name="sAccount"></param> /// <param name="sCharName"></param> /// <param name="sStr"></param> /// <param name="nCertCode"></param> /// <param name="HumanRcd"></param> /// <returns></returns> public unsafe static bool LoadHeroRcd(string sAccount, string sCharName, string sStr, int nCertCode, THumDataInfo *HumanRcd) { bool result; TDefaultMessage DefMsg; int nQueryID = 0; int nIdent = 0; int nRecog = 0; string sHumanRcdStr = string.Empty; string sDBMsg = string.Empty; string sDBCharName; nQueryID = GetQueryID(M2Share.g_Config); DefMsg = EncryptUnit.MakeDefaultMsg(Common.DB_LOADHERORCD, 0, 0, 0, 0, 0); TLoadHuman LoadHuman = new TLoadHuman(); LoadHuman.sAccount = sAccount; LoadHuman.sChrName = sCharName; LoadHuman.sUserAddr = sStr; LoadHuman.nSessionID = nCertCode; byte[] data = HUtil32.StructToBytes(LoadHuman); sDBMsg = EncryptUnit.EncodeMessage(DefMsg) + EncryptUnit.EncodeBuffer(data, Marshal.SizeOf(LoadHuman)); SendDBSockMsg(nQueryID, sDBMsg); if (GetDBSockMsg(nQueryID, ref nIdent, ref nRecog, ref sHumanRcdStr, M2Share.g_Config.dwGetDBSockMsgTime, true, "LoadHeroRcd(" + sAccount + "/" + sCharName + ")")) { result = false; if (nIdent == Common.DB_LOADHERORCD) { if (nRecog == 1) { sHumanRcdStr = HUtil32.GetValidStr3(sHumanRcdStr, ref sDBMsg, new string[] { "/" }); sDBCharName = EncryptUnit.DeCodeString(sDBMsg); if (sDBCharName == sCharName) { if (HUtil32.GetCodeMsgSize(sizeof(THumDataInfo) * 4 / 3) == sHumanRcdStr.Length) { EncryptUnit.DecodeBuffer(sHumanRcdStr, HumanRcd, sizeof(THumDataInfo)); result = true; } } else { result = false; } } else { result = false; } } else { result = false; } } else { result = false; } return(result); }
static unsafe void socket_ReceivedDatagram(object sender, NetFramework.DSCClientDataInEventArgs e) { var HumanRcd = new THumDataInfo(); int a = 0, b = 0; string c = string.Empty; GetDBSockMsg(e.Data, 0, ref a, ref b, ref c, 0, true, ""); string sDBMsg = string.Empty; c = HUtil32.GetValidStr3(c, ref sDBMsg, new string[] { "/" }); int DataSize = Marshal.SizeOf(HumanRcd); if (HUtil32.GetCodeMsgSize(DataSize * 4 / 3) == c.Length) { EncryptUnit.DecodeBuffer <THumDataInfo>(c, ref HumanRcd); } //if (HumanRcd.Data.BagItems[0] != null) //{ // TUserItem hun = new TUserItem(); // int HumSize = Marshal.SizeOf(hun); //} }