示例#1
0
        private static void Handle_RegisterGameServer(GameConnection net, PacketReader reader)
        {
            byte id = reader.ReadByte();
            short port = reader.ReadInt16();

            string ip = reader.ReadDynamicString();
            string password = reader.ReadDynamicString();

            bool success = GameServerController.RegisterGameServer(id, password, net, port, ip);
            net.SendAsync(new NET_GameRegistrationResult(success));
        }
示例#2
0
        private static void Handle_AccountInfoReceived(LoginConnection net, PacketReader reader)
        {
            //Set Account Info
            Account account = new Account();
            account.AccountId = reader.ReadInt32();
            account.AccessLevel = reader.ReadByte();
            account.Membership = reader.ReadByte();
            account.Name = reader.ReadDynamicString();
            //account.Password = reader.ReadDynamicString();
            account.Session = reader.ReadInt32();
            account.LastEnteredTime = reader.ReadInt64();
            account.LastIp = reader.ReadDynamicString();

            Console.WriteLine(account.Session);
            if (ClientConnection.CurrentAccounts.ContainsKey(account.Session))
            {
                //Already
                Account acc = ClientConnection.CurrentAccounts[account.Session];
                if (acc.Connection != null)
                {
                    acc.Connection.Dispose(); //Disconenct
                    Logger.Trace("Account " + acc.Name + " Was Forcibly Disconnected");
                }
                else
                {
                    ClientConnection.CurrentAccounts.Remove(account.Session);
                }
            }
            else
            {
                Logger.Trace("Account {0}: Authorized", account.Name);
                ClientConnection.CurrentAccounts.Add(account.Session, account);
            }
        }