private void OnHandshake(HandshakePacket p) { if (Handshake != null) Handshake.Invoke(this, new PacketEventArgs<HandshakePacket>(p)); }
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(); }
public static void ReadHandshake(Client client, PacketReader reader) { HandshakePacket hp = new HandshakePacket(); hp.Read(reader); if (!reader.Failed) Client.HandlePacketHandshake(client, hp); }
public static void HandlePacketHandshake(TestClient client, HandshakePacket hp) { client.SendPacket(new LoginRequestPacket { ProtocolOrEntityId = 19, Username = client.UserName }); }
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); } }
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(); }