예제 #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
파일: TestClient.cs 프로젝트: keneo/c-raft
 public static void HandlePacketHandshake(TestClient client, HandshakePacket hp)
 {
     client.SendPacket(new LoginRequestPacket { ProtocolOrEntityId = 19, Username = client.UserName });
 }
예제 #5
0
파일: Client.Recv.cs 프로젝트: TheaP/c-raft
        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
파일: Client.Recv.cs 프로젝트: keneo/c-raft
 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();
 }