protected void HandleAllowUserLogin(object stateInfo)
 {
     try
     {
         GSPacketIn gSPacketIn = (GSPacketIn)stateInfo;
         int        num        = gSPacketIn.ReadInt();
         if (gSPacketIn.ReadBoolean())
         {
             GamePlayer gamePlayer = LoginMgr.LoginClient(num);
             if (gamePlayer != null)
             {
                 if (gamePlayer.Login())
                 {
                     this.SendUserOnline(num, gamePlayer.PlayerCharacter.ConsortiaID);
                     WorldMgr.OnPlayerOnline(num, gamePlayer.PlayerCharacter.ConsortiaID);
                 }
                 else
                 {
                     gamePlayer.Client.Disconnect();
                     this.SendUserOffline(num, 0);
                 }
             }
             else
             {
                 this.SendUserOffline(num, 0);
             }
         }
     }
     catch (Exception exception)
     {
         GameServer.log.Error("HandleAllowUserLogin", exception);
     }
 }
Exemple #2
0
 protected override void OnDisconnect()
 {
     try
     {
         GamePlayer player = Interlocked.Exchange <GamePlayer>(ref this.m_player, null);
         if (player != null)
         {
             player.ClearFightBag();
             LoginMgr.ClearLoginPlayer(player.PlayerCharacter.ID, this);
             player.Quit();
         }
         byte[] temp = this.m_sendBuffer;
         this.m_sendBuffer = null;
         this._srvr.ReleasePacketBuffer(temp);
         temp = this.m_readBuffer;
         this.m_readBuffer = null;
         this._srvr.ReleasePacketBuffer(temp);
         base.OnDisconnect();
     }
     catch (Exception e)
     {
         //if (GameClient.log.IsErrorEnabled)
         {
             GameClient.log.Error("OnDisconnect", e);
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 客户端断开连接
        /// </summary>
        protected override void OnDisconnect()
        {
            try
            {
                GamePlayer player = Interlocked.Exchange <GamePlayer>(ref m_player, null);
                if (player != null)
                {
                    player.FightBag.ClearBag();
                    resetStoreBag2(player);
                    LoginMgr.ClearLoginPlayer(player.PlayerCharacter.ID, this);
                    player.Quit();
                }

                byte[] temp = m_sendBuffer;
                m_sendBuffer = null;
                _srvr.ReleasePacketBuffer(temp);

                temp         = m_readBuffer;
                m_readBuffer = null;
                _srvr.ReleasePacketBuffer(temp);

                base.OnDisconnect();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("OnDisconnect", e);
                }
            }
        }
        /// <summary>
        /// 允许用户登陆
        /// </summary>
        /// <param name="packet"></param>
        protected void HandleAllowUserLogin(Object stateInfo)
        {
            try
            {
                GSPacketIn packet   = (GSPacketIn)stateInfo;
                int        playerid = packet.ReadInt();

                if (packet.ReadBoolean())
                {
                    GamePlayer player = LoginMgr.LoginClient(playerid);
                    if (player != null)
                    {
                        if (player.Login())
                        {
                            SendUserOnline(playerid, player.PlayerCharacter.ConsortiaID);
                            WorldMgr.OnPlayerOnline(playerid, player.PlayerCharacter.ConsortiaID);
                        }
                        else
                        {
                            player.Client.Disconnect();
                            SendUserOffline(playerid, 0);
                        }
                    }
                    else
                    {
                        SendUserOffline(playerid, 0);
                    }
                }
            }
            catch (Exception e)
            {
                GameServer.log.Error("HandleAllowUserLogin", e);
            }
        }
Exemple #5
0
    public static LoginMgr GetInstance()
    {
        if (instance == null)
            instance = new LoginMgr();

        return instance;
    }
 protected override void OnDisconnect()
 {
     try
     {
         GamePlayer gamePlayer = Interlocked.Exchange <GamePlayer>(ref this.m_player, null);
         if (gamePlayer != null)
         {
             gamePlayer.FightBag.ClearBag();
             this.SaveBag(gamePlayer);
             LoginMgr.ClearLoginPlayer(gamePlayer.PlayerCharacter.ID, this);
             gamePlayer.Quit();
         }
         byte[] buf = this.m_sendBuffer;
         this.m_sendBuffer = null;
         this._srvr.ReleasePacketBuffer(buf);
         buf = this.m_readBuffer;
         this.m_readBuffer = null;
         this._srvr.ReleasePacketBuffer(buf);
         base.OnDisconnect();
     }
     catch (Exception exception)
     {
         if (GameClient.log.IsErrorEnabled)
         {
             GameClient.log.Error("OnDisconnect", exception);
         }
     }
 }
Exemple #7
0
    /// <summary>
    /// 处理发送的消息对列
    /// </summary>
    private void HandleMsgSendQueue()
    {
//		Debug.LogError("Network HandleMsgSendQueue");
        LoginMgr login = LoginMgr.Instance;

        //如果网络断了,会在下一次发送数据的时候做重连处理。
        if (mCSMsgWaitSendList.Count > 0)
        {
//			Debug.LogError("Network HandleMsgSendQueue mCSMsgWaitSendList.Count > 0 " + mCSMsgWaitSendList.Count);
            //如果这个时候Socket已经挂了,自动重连服务器
            //if (mGameServerHandler.IsShutDown() && login.IsAccountLogin )
            //{
            //login.IsRoleLogin = false;
            //ConnectGameServer(login.OnReConnectSuccess);
            //}
            if (mGameServerHandler.IsConnected())
            {
//				Debug.LogError("Network HandleMsgSendQueue mGameServerHandler.IsConnected()");
                //Socket在连接状态才发送网络数据,其他状态不做处理,等待socekt连接成功和rolelogin成功
                //if ( login.IsRoleLogin )
                {
                    //foreach (MsgInfo msginfo in mCSMsgWaitSendList)
                    for (int i = 0; i < mCSMsgWaitSendList.Count; i++)
                    {
                        MsgInfo msginfo = mCSMsgWaitSendList[i];
                        if (msginfo != null)
                        {
                            DGPKG msg = msginfo.Msg;
                            Send(ref msg);
                            mCSMsgAlreadySentList.Add(msginfo);
//							Debug.LogError("Network HandleMsgSendQueue msginfo != null mCSMsgAlreadySentList.Add(msginfo)");
                        }
                    }
                    mCSMsgWaitSendList.Clear();
                }
//                 else
//                 {//只处理登陆协议
//                     foreach (MsgInfo msginfo in mCSMsgWaitSendList)
//                     {
//                         string msg_full_name = msginfo.Msg.header.msg_full_name;
//                         if ( msg_full_name == typeof(CS.RoleLoginReq).FullName )
//                         {
//                             DGPKG msg = msginfo.Msg;
//                             Send(ref msg);
//                             mCSMsgAlreadySentList.AddLast(msginfo);
//                             mCSMsgWaitSendList.Remove(msginfo);
//                             break;
//                         }
//                     }
//                }//end else //只处理登陆协议
            }//end else if
        }
    }
Exemple #8
0
        protected void HandleUserOffline(GSPacketIn packet)
        {
            int count = packet.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int playerid    = packet.ReadInt();
                int consortiaID = packet.ReadInt();
                if (LoginMgr.ContainsUser(playerid))
                {
                    this.SendAllowUserLogin(playerid);
                }
                WorldMgr.OnPlayerOffline(playerid, consortiaID);
            }
        }
        protected void HandleUserOffline(GSPacketIn packet)
        {
            int num = packet.ReadInt();

            for (int i = 0; i < num; i++)
            {
                int num2        = packet.ReadInt();
                int consortiaID = packet.ReadInt();
                if (LoginMgr.ContainsUser(num2))
                {
                    this.SendAllowUserLogin(num2);
                }
                WorldMgr.OnPlayerOffline(num2, consortiaID);
            }
        }
Exemple #10
0
        public static void Save()
        {
            int      onlineCount = LoginMgr.GetOnlineCount();
            int      arg_0B_0    = LogMgr._gameType;
            int      arg_11_0    = LogMgr._serverId;
            DateTime arg_17_0    = DateTime.Now;
            int      arg_1D_0    = LogMgr.RegCount;

            LogMgr.RegCount = 0;
            int arg_29_0 = LogMgr.SaveRecordSecond;

            using (ItemRecordBussiness itemRecordBussiness = new ItemRecordBussiness())
            {
                itemRecordBussiness.LogServerDb(LogMgr.m_LogServer);
            }
        }
Exemple #11
0
    public void RealConnectSvr(TConndSocketEventDelegate successDelegate)
    {
        //Debug.LogError("unity RealConnectSvr");
        if (mGameServerHandler != null)
        {
            //Debug.LogError("unity mGameServerHandler");
            LoginMgr Inst = LoginMgr.Instance;
            //Debuger.LogError("Connect to srv: [ip:] " + Inst.SvrHost + " [port:]" + Inst.Port);
            mGameServerHandler.Connect(Inst.SvrHost, Inst.Port, successDelegate, GameServerSocketErrorCallBack, 30);

            // UI3System.lockScreen(902/*"正在连接..."*/, 10.0f, () => {
            //    UISystemTip.ShowTip(901/*"网络已断开,点击重新连接"*/, ReConnect);
            //   });
        }
        // yield return null;
    }
Exemple #12
0
    void Start()
    {
        instance = this;
        CommonHandler.instance.StopListen(true);
        PlayerInfo.ResetData();
        string records = PlayerPrefs.GetString("loginRecords");

        if (records != "")
        {
            UIManager.instance.ShowPanel(UIPanel.LoginScene.fastLogin);
        }
        else
        {
            UIManager.instance.ShowPanel(UIPanel.LoginScene.registerAndLogin);
        }
    }
Exemple #13
0
        /// <summary>
        /// 定时保存
        /// </summary>
        public static void Save()
        {
            int online = LoginMgr.GetOnlineCount();//在线人数

            object[] info = { _gameType, _serverId, DateTime.Now, online, RegCount };
            //lock (m_LogServer)
            //{
            // m_LogServer.Rows.Add(info);
            //}
            RegCount = 0;


            int interval = SaveRecordSecond;

            using (ItemRecordBussiness db = new ItemRecordBussiness())
            {
                db.LogServerDb(m_LogServer);
            }
        }
Exemple #14
0
        protected void HandleUserOnline(GSPacketIn packet)
        {
            int count = packet.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int playerid    = packet.ReadInt();
                int consortiaID = packet.ReadInt();
                LoginMgr.ClearLoginPlayer(playerid);
                GamePlayer player = WorldMgr.GetPlayerById(playerid);
                if (player != null)
                {
                    GameServer.log.Error("Player hang in server!!!");
                    player.Out.SendKitoff(LanguageMgr.GetTranslation("Game.Server.LoginNext", new object[0]));
                    player.Client.Disconnect();
                }
                WorldMgr.OnPlayerOnline(playerid, consortiaID, 0, false);
            }
        }
Exemple #15
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int result;

            try
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                if (client.Player == null)
                {
                    int    version    = packet.ReadInt();
                    int    clientType = packet.ReadInt();
                    byte[] src        = packet.ReadBytes();
                    try
                    {
                        src = WorldMgr.RsaCryptor.Decrypt(src, false);
                    }
                    //catch (ExecutionEngineException e)
                    //{
                    //	client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError", new object[0]));
                    ///	client.Disconnect();
                    //	GameServer.log.Error("ExecutionEngineException", e);
                    //	result = 0;
                    //	return result;
                    //}
                    catch (Exception ex)
                    {
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError", new object[0]));
                        client.Disconnect();
                        GameServer.log.Error("RsaCryptor", ex);
                        result = 0;
                        return(result);
                    }
                    int fms_key = ((int)src[7] << 8) + (int)src[8];
                    client.SetFsm(fms_key, version);
                    string edition = GameServer.Edition;
                    if (version < int.Parse(GameServer.Edition) || version >= int.Parse(GameServer.Edition) + 1000)
                    {
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.EditionError", new object[0]));
                        GameServer.log.Error("Edition Error");
                        client.Disconnect();
                        result = 0;
                        return(result);
                    }
                    string[] temp = Encoding.UTF8.GetString(src, 9, src.Length - 9).Split(new char[]
                    {
                        ','
                    });

                    if (temp.Length == 2)
                    {
                        string user = temp[0];
                        string pass = temp[1];

                        if (!LoginMgr.ContainsUser(user))
                        {
                            bool         isFirst = false;
                            LSJInterface inter   = LSJInterface.CreateInterface();
                            PlayerInfo   cha     = null;

                            int userID = 0;
                            if (OpenAPIs.ValidateLoginAndGetID(user, pass, ref userID, ref isFirst))
                            {
                                cha = new PlayerInfo
                                {
                                    ID       = userID,
                                    UserName = user
                                };
                            }



                            if (cha != null && cha.ID != 0)
                            {
                                if (cha.ID == -2)
                                {
                                    client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Forbid", new object[0]));
                                    client.Disconnect();
                                    result = 0;
                                    return(result);
                                }
                                if (!isFirst)
                                {
                                    client.Player = new GamePlayer(cha.ID, user, client, cha, this.GetClientType(clientType));
                                    LoginMgr.Add(cha.ID, client);
                                    client.Server.LoginServer.SendAllowUserLogin(cha.ID);
                                    client.Version = version;
                                }
                                else
                                {
                                    client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Register", new object[0]));
                                    client.Disconnect();
                                }
                            }
                            else
                            {
                                client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.OverTime", new object[0]));
                                client.Disconnect();
                            }
                        }
                        else
                        {
                            client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LoginError", new object[0]));
                            client.Disconnect();
                        }
                    }
                    else
                    {
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LengthError", new object[0]));
                        client.Disconnect();
                    }
                }
            }
            catch (Exception ex)
            {
                client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.ServerError", new object[0]));
                client.Disconnect();
                GameServer.log.Error(LanguageMgr.GetTranslation("UserLoginHandler.ServerError", new object[0]), ex);
            }
            result = 1;
            return(result);
        }
Exemple #16
0
        public static void Save()
        {
            if (!TxtRecord)
            {
                return;
            }
            //DateTime dt = DateTime.Now;
            int interval = SaveRecordSecond;

            //dt = dt.AddMinutes(5);
            dt = dt.AddSeconds(interval);

            //int totalM = 0  ; //注册人数(男)
            //int totalF = 0; //注册人数(女)
            //int onlineM = 0; //在线人数(男)
            //int onlineF = 0; //在线人数(女)
            //int paymenM = 0; //付费用户(男)
            //int paymenF = 0; //付费用户(女)
            //int activePaymenM = 0; //活跃付费用户(男)
            //int activePaymenF = 0; //活跃付费用户(女)
            //int activeCustomerM = 0; //活跃消费用户(男)
            //int activeCustomerF = 0; //活跃消费用户(女)

//            新的User日志格式

//#格式:【用户记录】游戏类型,分区,服务器ID,[时间],注册人数(男),注册人数(女),在线人数(男),在线人数(女),登陆用户数(男), 登陆用户数(女),活跃充值用户(男),活跃充值用户(女),活跃消费用户(男),活跃消费用户(女),活跃在线用户(男)、活跃在线用户(女)

            using (ServiceBussiness db = new ServiceBussiness())
            {
                try
                {
                    RecordInfo info   = db.GetRecordInfo(dt, SaveRecordSecond);
                    int        online = LoginMgr.GetOnlineCount();

                    //writer.WriteLine(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}", dt, totalM, totalF, onlineM, onlineF, paymenM, paymenF, activePaymenM, activePaymenF, activeCustomerM, activeCustomerF));
                    if (info == null)
                    {
                        info = new RecordInfo();
                    }
                    _saveLogCache.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13}", _headStr, dt, info.TotalBoy, info.TotalGirl, online, 0,
                                                    info.ExpendBoy, info.ExpendGirl, info.ActviePayBoy, info.ActviePayGirl, info.ActiveExpendBoy, info.ActiveExpendGirl, info.ActiveOnlineBoy, info.ActiveOnlineGirl));

                    string file = string.Format("{0}\\user-{1:D2}{2:D2}{3:D2}-{4:yyyyMMdd}.log", _logPath, _gameType, _areaId, _serverId, dt);
                    using (FileStream fs = File.Open(file, FileMode.Append))
                    {
                        using (StreamWriter writer = new StreamWriter(fs))
                        {
                            while (_saveLogCache.Count != 0)
                            {
                                writer.WriteLine(_saveLogCache[0]);
                                _saveLogCache.RemoveAt(0);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Save log error", ex);
                    }
                }

                try
                {
                    //1,1,2,2009-1-10 0:02:06,0,
                    //游戏类型、代理商、频道、日期、在线用户、注册用户
                    Dictionary <int, int> lines = LoginMgr.GetOnlineForLine();

                    int online = LoginMgr.GetOnlineCount();
                    _onlineLogCache.Add(string.Format("{0},{1},{2},{3},{4},{5}", _gameType, _areaId, 0, dt, online, RegCount));
                    RegCount = 0;

                    string file = string.Format("{0}\\online-{1:D2}{2:D2}{3:D2}-{4:yyyyMMdd}.log", _logPath, _gameType, _areaId, _serverId, dt);
                    using (FileStream fs = File.Open(file, FileMode.Append))
                    {
                        using (StreamWriter writer = new StreamWriter(fs))
                        {
                            while (_onlineLogCache.Count != 0)
                            {
                                writer.WriteLine(_onlineLogCache[0]);
                                _onlineLogCache.RemoveAt(0);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("OnlineForLine log error", ex);
                    }
                }
            }
            //#格式:【用户记录】游戏类型,分区,时间,付费方式(ebank、SMS、Post),男人数,女人数,男付费金额,女付费金额
            //using (PlayerBussiness db = new PlayerBussiness())
            //{
            //    ChargeRecordInfo[] infos = db.GetChargeRecordInfo(dt, SaveRecordSecond);
            //    string file = string.Format("{0}\\pay-{1:D2}{2:D2}{3:D2}-{4:yyyyMMdd}.log", _logPath, _gameType, _areaId, _serverId, dt);
            //    using (FileStream fs = File.Open(file, FileMode.Append))
            //    {
            //        using (StreamWriter writer = new StreamWriter(fs))
            //        {
            //            foreach (ChargeRecordInfo info in infos)
            //            {
            //                writer.WriteLine(string.Format("{0},{1},{2},{3},{4},{5},{6}",
            //                    _headStr, dt, info.PayWay, info.TotalBoy, info.TotalGirl, info.BoyTotalPay, info.GirlTotalPay));
            //            }
            //        }
            //    }
            //}
        }
Exemple #17
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            try
            {
                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.LOGIN);
                pkg.ClientID = packet.ClientID;
                if (client.Player == null)
                {
                    int    version    = packet.ReadInt();
                    int    clientType = packet.ReadInt();
                    byte[] src        = packet.ReadBytes();
                    //解密
                    try
                    {
                        src = WorldMgr.RsaCryptor.Decrypt(src, false);
                    }
                    catch (ExecutionEngineException e)
                    {
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError"));
                        client.Disconnect();
                        GameServer.log.Error("ExecutionEngineException", e);
                        return(0);
                    }
                    catch (Exception ex)
                    {
                        //防止攻击,如果解密出错,直接断开连接
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError"));
                        client.Disconnect();
                        GameServer.log.Error("RsaCryptor", ex);
                        return(0);
                    }
                    //DateTime date = new DateTime(src[0] * 256 + src[1], src[2], src[3], src[4], src[5], src[6]);
                    int fms_key = (src[7] << 8) + src[8];
                    client.SetFsm(fms_key, version);

                    //string edition = GameServer.Instance.Configuration.Edition;
                    string edition = GameServer.Edition;
                    //if (version.ToString() != edition && edition != "0")
                    //{
                    //    client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.EditionError"));
                    //    //client.Out.SendEditionError(LanguageMgr.GetTranslation("UserLoginHandler.EditionError"));
                    //    client.Disconnect();
                    //    return 0;
                    //}

                    string[] temp = Encoding.UTF8.GetString(src, 9, src.Length - 9).Split(',');
                    if (temp.Length == 2)
                    {
                        string user = temp[0];
                        string pass = temp[1];

                        //TimeSpan span = date - DateTime.UtcNow;
                        //if (Math.Abs(span.TotalMinutes) < 5)
                        //{
                        if (!LoginMgr.ContainsUser(user))
                        {
                            bool          isFirst = false;
                            BaseInterface inter   = BaseInterface.CreateInterface();
                            PlayerInfo    cha     = inter.LoginGame(user, pass, ref isFirst);

                            if (cha != null && cha.ID != 0)
                            {
                                if (cha.ID == -2)
                                {
                                    //帐号被禁用
                                    client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Forbid"));
                                    client.Disconnect();
                                    return(0);
                                }

                                if (!isFirst)
                                {
                                    client.Player = new GamePlayer(cha.ID, user, client, cha);
                                    LoginMgr.Add(cha.ID, client);
                                    client.Server.LoginServer.SendAllowUserLogin(cha.ID);
                                    client.Out.SendLoginSuccess2();
                                    client.Version = version;
                                }
                                else
                                {
                                    client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Register"));
                                    client.Disconnect();
                                }
                            }
                            else
                            {
                                //client.Out.SendLoginFailed("用户名密码错误");
                                client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.OverTime"));
                                client.Disconnect();
                            }
                        }
                        else
                        {
                            //避免攻击,有另外的客户端在登陆,则断掉次客户端。
                            client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LoginError"));
                            client.Disconnect();
                        }
                    }
                    else
                    {
                        client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LengthError"));
                        //验证格式错误,端口连接
                        client.Disconnect();
                    }
                }
            }
            catch (Exception ex)
            {
                client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.ServerError"));
                client.Disconnect();
                GameServer.log.Error(LanguageMgr.GetTranslation("UserLoginHandler.ServerError"), ex);
            }

            return(1);
        }
 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     try
     {
         if (client.Player == null)
         {
             int version = packet.ReadInt();
             packet.ReadInt();
             byte[] array  = new byte[8];
             byte[] array2 = packet.ReadBytes();
             try
             {
                 array2 = WorldMgr.RsaCryptor.Decrypt(array2, false);
             }
             catch (ExecutionEngineException exception)
             {
                 client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError", new object[0]));
                 client.Disconnect();
                 GameServer.log.Error("ExecutionEngineException", exception);
                 int result = 0;
                 return(result);
             }
             catch (Exception exception2)
             {
                 client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.RsaCryptorError", new object[0]));
                 client.Disconnect();
                 GameServer.log.Error("RsaCryptor", exception2);
                 int result = 0;
                 return(result);
             }
             string arg_B1_0 = GameServer.Edition;
             for (int i = 0; i < 8; i++)
             {
                 array[i] = array2[i + 7];
             }
             client.setKey(array);
             string[] array3 = Encoding.UTF8.GetString(array2, 15, array2.Length - 15).Split(new char[]
             {
                 ','
             });
             if (array3.Length == 2)
             {
                 string text = array3[0];
                 string pass = array3[1];
                 if (!LoginMgr.ContainsUser(text))
                 {
                     bool          flag          = false;
                     BaseInterface baseInterface = BaseInterface.CreateInterface();
                     PlayerInfo    playerInfo    = baseInterface.LoginGame(text, pass, ref flag);
                     if (playerInfo != null && playerInfo.ID != 0)
                     {
                         if (playerInfo.ID == -2)
                         {
                             client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Forbid", new object[0]));
                             client.Disconnect();
                             int result = 0;
                             return(result);
                         }
                         if (!flag)
                         {
                             client.Player = new GamePlayer(playerInfo.ID, text, client, playerInfo);
                             LoginMgr.Add(playerInfo.ID, client);
                             client.Server.LoginServer.SendAllowUserLogin(playerInfo.ID);
                             client.Version = version;
                         }
                         else
                         {
                             client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Register", new object[0]));
                             client.Disconnect();
                         }
                     }
                     else
                     {
                         client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.OverTime", new object[0]));
                         client.Disconnect();
                     }
                 }
                 else
                 {
                     client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LoginError", new object[0]));
                     client.Disconnect();
                 }
             }
             else
             {
                 client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.LengthError", new object[0]));
                 client.Disconnect();
             }
         }
     }
     catch (Exception exception3)
     {
         client.Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.ServerError", new object[0]));
         client.Disconnect();
         GameServer.log.Error(LanguageMgr.GetTranslation("UserLoginHandler.ServerError", new object[0]), exception3);
     }
     return(1);
 }
Exemple #19
0
 public LoginF()
 {
     InitializeComponent();
     this.Text = Tool.GetFormName("登录");
     loginMgr  = new LoginMgr();
 }