private void OnDisconnect(DisconnectPacket p) { if (Disconnect != null) Disconnect.Invoke(this, new PacketEventArgs<DisconnectPacket>(p)); }
public static void ReadDisconnect(Client client, PacketReader reader) { DisconnectPacket dp = new DisconnectPacket(); dp.Read(reader); if (!reader.Failed) Client.HandlePacketDisconnect(client, dp); }
public static void HandlePacketDisconnect(Client client, DisconnectPacket packet) { client.Logger.Log(Logger.LogLevel.Info, client.Owner.DisplayName + " disconnected: " + packet.Reason); client.Stop(); }
public static void HandlePacketDisconnect(TestClient client, DisconnectPacket dp) { client.Dispose(); using (StreamWriter sw = new StreamWriter(String.Format("disconnect_reason_{0}.log", client.UserName), true)) { sw.WriteLine("{0} - {1}", DateTime.Now, dp.Reason); } }