mirror of
https://git.battle-of-pip.de/root/vpr-mitarbeiterverwaltung.git
synced 2025-06-20 15:53:16 +02:00
30 lines
927 B
C#
30 lines
927 B
C#
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.";
|
|
}
|
|
}
|
|
} |