mirror of
https://git.battle-of-pip.de/root/vpr-mitarbeiterverwaltung.git
synced 2025-06-20 15:53:16 +02:00
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Net.Sockets;
|
|
using DX86.Modules;
|
|
|
|
namespace Server;
|
|
|
|
public class BackendServer : DX86.TcpServer
|
|
{
|
|
CommandManager _CommandManager;
|
|
public BackendServer(string address, int port, MessageSender ms) : base(address, port, ms)
|
|
{
|
|
ms.Log("[BACKENDSERVER] Setting up server.");
|
|
_CommandManager = new CommandManager();
|
|
ms.Log("[BACKENDSERVER] Server Setup Complete.");
|
|
}
|
|
|
|
public override string ToggleOption(string option, string value)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override List<List<string>> ConfigureOptions(string option)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
protected override void ClientConnectEvent(TcpClient client)
|
|
{
|
|
ms.Log("[BACKENDSERVER] Client connected: " + client.Client.RemoteEndPoint);
|
|
}
|
|
|
|
protected override void MessageReceivedEvent(TcpClient client, string message)
|
|
{
|
|
ms.Log("[BACKENDSERVER] Message received from client: " + message);
|
|
if (message.StartsWith("."))
|
|
{
|
|
handleCommand(cmd: message, client: client);
|
|
|
|
}
|
|
}
|
|
|
|
protected override void ClientDisconnectEvent(TcpClient client)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
private void handleCommand(string cmd, TcpClient client)
|
|
{
|
|
string[] args = cmd.Split(' ');
|
|
string command = args[0].Substring(1); // Remove the leading dot
|
|
string[] commandArgs = args.Skip(1).ToArray(); // Get the arguments after the command
|
|
|
|
|
|
}
|
|
} |