private void OnServerTimeInit(byte[] data) { GameTimeTimerCmd cmd = (GameTimeTimerCmd)CmdSerializer.BytesToStruct(data, typeof(GameTimeTimerCmd)); this.m_dwServerTime = cmd.gameTime; this.m_dwClientTime = this.GetNowSecond(); }
public void ParseMessageInRC5Encrypt(byte[] data) { byte[] output = RC5Encrypt.Decrypt(data); int bodyLength = ((int)output[1] << 8) + output[0]; this.isCompress = false; if (((int)output[3] & 0x40) != 0) { this.isCompress = true; byte[] unCompressData = null; using (MemoryStream ms = new MemoryStream()) { ms.Write(output, HeadSize, bodyLength); //unCompressData = ZipCompress.Decompress(ms.GetBuffer()); } } byte[] nullCmdBytes = new byte[6]; Array.Copy(output, 4, nullCmdBytes, 0, 6); object obj = CmdSerializer.BytesToStruct(nullCmdBytes, typeof(stNullUserCmd)); if (obj is stNullUserCmd) { bmdParamTime = (stNullUserCmd)obj; } }
public void OnLoginFirFailed(byte[] data) { this.loginModule._NotifyClient(stLoginFailedCmd.byCmd, stLoginFailedCmd.byParam, data); stLoginFailedCmd cmd = (stLoginFailedCmd)CmdSerializer.BytesToStruct(data, typeof(stLoginFailedCmd)); { string str = string.Format("OnLoginFirFailed!!, ErrorID = {0}, ErrorMsg: {1}", cmd.retCode, this.LoginErrorMsg((int)cmd.retCode)); Logger <IGiantFreeServer> .L(str); } }
private void OnResponseClientIP(byte[] data) { stResponceClientIPCmd cmd = (stResponceClientIPCmd)CmdSerializer.BytesToStruct(data, typeof(stResponceClientIPCmd)); { if (cmd.ip == null) { Logger <IGiantFreeServer> .E("IP地址为空!"); return; } Array.Copy(cmd.ip, this.loginModule.szKeyIP, 16); this.LoginFirServer(); } }
public void OnLoginFirSuccess(byte[] data) { Logger <IGiantFreeServer> .L("登录Fir Server成功"); stLoginSuccessCmd cmd = (stLoginSuccessCmd)CmdSerializer.BytesToStruct(data, typeof(stLoginSuccessCmd)); { this.loginModule.GateWayIP = cmd.gameserIP; this.loginModule.GateWayPort = cmd.port; this.loginModule.UserID = cmd.dwUserID; this.loginModule.UserTmpID = cmd.loinTmpID; Array.Copy(cmd.key, this.loginModule.LoginKey, 256); byte index = this.loginModule.LoginKey[58]; DESEncrypt.ResetDESKey(this.loginModule.LoginKey, index); uint desKey = (uint)this.loginModule.LoginKey[index + 2]; DESEncryptorFix.SetDESEcryptMask(desKey); this.loginModule.LoginGameServer(); } }
public void SerizizeNullCmd(byte[] data) { byte[] nullCmdBytes = new byte[6]; Array.Copy(data, HeadSize, nullCmdBytes, 0, 6); bmdParamTime = (stNullUserCmd)CmdSerializer.BytesToStruct(nullCmdBytes, typeof(stNullUserCmd)); }