Scuffy console command input, good enough for now

This commit is contained in:
Kyle873 2024-05-26 20:10:08 -04:00
parent bc16f0c421
commit ac57ecb939
4 changed files with 21 additions and 19 deletions

View File

@ -18,7 +18,7 @@ public class tESTcOMMAND : Command
string output = string.Empty;
switch (Type.ToLower())
switch (Type?.ToLower())
{
case "encrypt":
output = Crypto.Encrypt(Value, "test");

View File

@ -1,18 +0,0 @@
using Elisa.Commands;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Elisa.Controllers;
[ApiController]
[Route("/")]
public class CommandController : ControllerBase
{
[HttpGet("command")]
public async Task<IResult> Command([FromQuery] string command)
{
CommandHandlerFactory.HandleCommand(command);
return Results.Text("Command executed");
}
}

19
Elisa/InputSystem.cs Normal file
View File

@ -0,0 +1,19 @@
using Elisa.Commands;
namespace Elisa;
public static class InputSystem
{
public static void Start()
{
while (true)
{
string? command = Console.ReadLine();
if (string.IsNullOrEmpty(command))
continue;
CommandHandlerFactory.HandleCommand(command);
}
}
}

View File

@ -36,6 +36,7 @@ internal static class Program
stopwatch.Stop();
Log.Information($"Done! Loaded in {stopwatch.ElapsedMilliseconds}ms");
Task.Run(InputSystem.Start);
Task.Run(Proxy.Start);
Task.Run(GameServer.Start).Wait();
}