Пример #1
0
 private void OnHandshake(HandshakePacket p)
 {
     if (Handshake != null) Handshake.Invoke(this, new PacketEventArgs<HandshakePacket>(p));
 }
Пример #2
0
 public static void HandlePacketHandshake(Client client, HandshakePacket packet)
 {
     client.Owner.Username = Regex.Replace(packet.UsernameOrHash, Chat.DISALLOWED, "");
     client.Owner.DisplayName = client.Owner.Username;
     client.SendHandshake();
 }
Пример #3
0
        public static void ReadHandshake(Client client, PacketReader reader)
        {
            HandshakePacket hp = new HandshakePacket();
            hp.Read(reader);

            if (!reader.Failed)
                Client.HandlePacketHandshake(client, hp);
        }
Пример #4
0
 public static void HandlePacketHandshake(TestClient client, HandshakePacket hp)
 {
     client.SendPacket(new LoginRequestPacket { ProtocolOrEntityId = 19, Username = client.UserName });
 }
Пример #5
0
        public static void HandlePacketHandshake(Client client, HandshakePacket packet)
        {
            client.Username = packet.Username;
            if (!client.CheckUsername(packet.Username))
                client.Kick("Inconsistent username");
            if (packet.ProtocolVersion < ProtocolVersion)
                client.Kick("Outdated client");
            else
            {
                client.Host = packet.ServerHost + ":" + packet.ServerPort;

                if (client.Server.EncryptionEnabled)
                    client.SendEncryptionRequest();
                else if (IsAuthenticated(client))
                    Task.Factory.StartNew(client.SendLoginSequence);

            }
        }
Пример #6
0
 public static void HandlePacketHandshake(Client client, HandshakePacket packet)
 {
     var usernameHost = Regex.Replace(packet.UsernameAndIpOrHash, Chat.DISALLOWED, "").Split(';');
     client.Username = usernameHost[0];
     client.Host = usernameHost[1];
     client.SendHandshake();
 }