using System.Net.Sockets; using DX86; namespace Server.Commands; public class LogoutCommand : ICommand { public string Executor { get; } public LogoutCommand() { Executor = "logout"; } public string Exec(string[] args, TcpClient? client = null, TcpServer? clientSocket = null) { if (clientSocket == null && client == null) return "Please provide a valid client or clientSocket."; if (client != null && clientSocket != null && clientSocket.LoggedInClients.ContainsKey(client)) { clientSocket.LoggedInClients.Remove(client); //clientSocket.SendMessageAsync(client, "Success"); return "Logout successful."; } else { //clientSocket?.SendMessageAsync(client, "Logout failed. You are not logged in."); return "Logout failed. You are not logged in."; } } }