Пример #1
0
        private void OnServerTimeInit(byte[] data)
        {
            GameTimeTimerCmd cmd = (GameTimeTimerCmd)CmdSerializer.BytesToStruct(data, typeof(GameTimeTimerCmd));

            this.m_dwServerTime = cmd.gameTime;
            this.m_dwClientTime = this.GetNowSecond();
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
 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);
     }
 }
Пример #4
0
        public void CheckGameVersion()
        {
            stCheckVerisonCmd checkVersion;

            checkVersion.data    = 0;
            checkVersion.version = GameVersion;
            var server = ServiceCenter.GetService <IGiantFreeServer>();

            server.SendMessage(stCheckVerisonCmd.byCmd, stCheckVerisonCmd.byParam, CmdSerializer.StructToBytes(checkVersion));
        }
Пример #5
0
        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();
            }
        }
Пример #6
0
        private byte[] GetCommandBuffer()
        {
            byte[] ncm      = CmdSerializer.StructToBytes(this.bmdParamTime);
            int    totalLen = ncm.Length;

            if (this.bodyData != null)
            {
                totalLen += this.bodyData.Length;
            }

            byte[] con = new byte[totalLen];
            Array.Copy(ncm, con, ncm.Length);
            Array.Copy(this.bodyData, 0, con, ncm.Length, totalLen - ncm.Length);
            return(con);
        }
Пример #7
0
        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();
            }
        }
Пример #8
0
        public void LoginFirServer()
        {
            Logger <IGiantFreeServer> .L("正在登录Fir Server...");

            stRequestLoginCmd loginCmd = new stRequestLoginCmd();

            loginCmd.strName = this.loginModule.Account;

            byte len = this.loginModule.Password[0];

            byte[] szPass = new byte[34];
            for (int i = 0; i < (len + 1); i++)
            {
                szPass[i] = this.loginModule.Password[i];
            }
            this.UseIPEncry(ref szPass, len + 1);

            loginCmd.strPassword = new byte[33];
            Array.Copy(szPass, loginCmd.strPassword, 33);
            loginCmd.game       = this.loginModule.GameType;
            loginCmd.zone       = this.loginModule.ZoneID;
            loginCmd.macAddress = "74D02BC4CE2B";
            loginCmd.uuid       = "))L1?o1?L1????z/ 2?";
            loginCmd.wdNetType  = 0;

            this.loginModule._SendMessage(stRequestLoginCmd.byCmd, stRequestLoginCmd.byParam, CmdSerializer.StructToBytes(loginCmd));
        }
Пример #9
0
        private void OnConnectFirSuccess()
        {
            Logger <IGiantFreeServer> .L("连接Fir Server成功");

            this.loginModule.CheckGameVersion();

            stRequestClientIPCmd requestIP;

            this.loginModule._SendMessage(stRequestClientIPCmd.byCmd, stRequestClientIPCmd.byParam, CmdSerializer.StructToBytes(requestIP));
        }
Пример #10
0
        public void SendGateWayLogin()
        {
            Logger <IGiantFreeServer> .L("正在登录GameServer...");

            stPasswordLoginCmd cmd;

            cmd.strName = new byte[48];

            cmd.userID     = this.loginModule.UserID;
            cmd.loginTmpID = this.loginModule.UserTmpID;
            byte[] tmp = Encoding.UTF8.GetBytes(this.loginModule.Account);
            Array.Copy(tmp, cmd.strName, tmp.Length);
            cmd.strPassword = "";

            this.loginModule._SendMessage(stPasswordLoginCmd.byCmd, stPasswordLoginCmd.byParam, CmdSerializer.StructToBytes(cmd));
        }
Пример #11
0
        private void SendUserGameTime()
        {
            UserResponseGameTimeCmd cmd;
            ulong serverTime = this.GetServerTime();

            cmd.userTmpID = this.loginModule.UserTmpID;
            cmd.gameTime  = serverTime;
            var server = ServiceCenter.GetService <IGiantFreeServer>();

            server.SendMessage(UserResponseGameTimeCmd.byCmd, UserResponseGameTimeCmd.byParam, CmdSerializer.StructToBytes(cmd));
        }
Пример #12
0
 public void SerizizeNullCmd(byte[] data)
 {
     byte[] nullCmdBytes = new byte[6];
     Array.Copy(data, HeadSize, nullCmdBytes, 0, 6);
     bmdParamTime = (stNullUserCmd)CmdSerializer.BytesToStruct(nullCmdBytes, typeof(stNullUserCmd));
 }