Add files via upload

This commit is contained in:
sonic 2024-08-18 19:41:23 +02:00 committed by GitHub
parent 5a1ed9e2f9
commit 1bfbc75d36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");
}
}
}