From 1bfbc75d3646e658bda45297ac76ddec8099ecd0 Mon Sep 17 00:00:00 2001 From: sonic <156506053+sonic998@users.noreply.github.com> Date: Sun, 18 Aug 2024 19:41:23 +0200 Subject: [PATCH] Add files via upload --- src/Util/ConsoleFunctions.cs | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/Util/ConsoleFunctions.cs diff --git a/src/Util/ConsoleFunctions.cs b/src/Util/ConsoleFunctions.cs new file mode 100644 index 0000000..18223a8 --- /dev/null +++ b/src/Util/ConsoleFunctions.cs @@ -0,0 +1,51 @@ +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc; +using System.Diagnostics; +using System.Configuration; + + +namespace sodoff.Utils; + +public class ConsoleFunctions { + //function to log when the server start and when the server is ready + public static void log(string Option) { + if (Option == "Server Start") + { + Console.WriteLine("Server is starting"); + } + else if (Option == "Server Running") + { + Console.WriteLine("Server is running"); + Console.WriteLine("You can start the game now"); + Console.WriteLine("Press Ctrl + C to close the server"); + } + } + // asks if user wants to automally open the game + public static void prompt(string GamePath) + { + string key; + //asks the user if the game client should be automally opened + Console.WriteLine("Do you want to open the game"); + Console.WriteLine("Y/n"); + //reads the user input + key = Console.ReadLine(); + //allows uppercase + key.ToUpper(); + //checks for y in string then automally opens the game client + if (key.StartsWith("y")) + { + //checks if GamePath isnt null to prevend errors + if (GamePath != null) + { + //starts the game automally + Console.WriteLine("Opening game"); + Process.Start(GamePath); + } + } + //if user wants to open the game manually + else + { + Console.WriteLine("You can manually open the game now"); + } + } +} \ No newline at end of file