First Server Test | Next Update: Change Commands to Attributes

This commit is contained in:
SnapixLP | Tim G.
2025-06-05 08:27:40 +02:00
parent 67bfce265c
commit 4be4ee34cb
12 changed files with 148 additions and 26 deletions

View File

@@ -155,6 +155,7 @@ namespace DX86
catch (Exception ex)
{
ms.Error("[DX86] Error handling client: " + ex.Message);
ms.Debug("[DX86] Stack Trace: " + ex.StackTrace);
}
finally
{

View File

@@ -37,6 +37,11 @@ public class MessageSender
}
public async void Debug(string message)
{
Console.ForegroundColor = ConsoleColor.Green;
this.Send($"[{DateTime.Now}] [DEBUG] {message}");
}
public async void Log(string message)
{
Console.ForegroundColor = ConsoleColor.Gray;
@@ -76,6 +81,8 @@ public class MessageSender
int i = 0;
foreach (var s in messageHistory)
{
if (s.Contains("[DEBUG]"))
Console.ForegroundColor = ConsoleColor.Green;
if (s.Contains("[INFO ]"))
Console.ForegroundColor = ConsoleColor.Gray;
if (s.Contains("[WARN ]"))

View File

@@ -12,6 +12,7 @@ public abstract class TcpServer
protected MessageSender ms;
private DX86 dx86;
public List<string> optionsList;
public Dictionary<TcpClient, string> LoggedInClients { get; }
public TcpServer(string address, int port, MessageSender ms)
@@ -26,8 +27,9 @@ public abstract class TcpServer
ms.Log("[DX86] Server Setup Complete.");
_ = RunServer();
}
private async Task RunServer()
{
ms.Log("[DX86] Starting server.");