From c852c3834f48f06c650bdb9875f9a0315ce614f3 Mon Sep 17 00:00:00 2001 From: sonic <156506053+sonic998@users.noreply.github.com> Date: Sun, 18 Aug 2024 19:41:47 +0200 Subject: [PATCH] Update Program.cs --- src/Program.cs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index c7a30ca..fd21d9f 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -11,14 +11,12 @@ using System.Net; var builder = WebApplication.CreateBuilder(args); // Add services to the container. -bool ConsoleOptions = builder.Configuration.GetSection("ConsoleOptions").GetValue("Show logs"); -bool GamePromptOptions = builder.Configuration.GetSection("GamePromptOptions").GetValue("Open Game"); -// shows information about loading assets/api stuff -if (ConsoleOptions == true) -{ - VerboseLogging.log(); -} +bool gameOpenEnable = builder.Configuration.GetSection("GamePromptOptions").GetValue("Enabled"); +string ClientPath = builder.Configuration.GetSection("GamePromptOptions").GetValue("ClientPath"); + +// shows that the server is starting +ConsoleFunctions.log("Server Start"); builder.Services.Configure(builder.Configuration.GetSection("AssetServer")); builder.Services.Configure(builder.Configuration.GetSection("ApiServer")); @@ -74,11 +72,21 @@ app.UseAuthorization(); app.MapControllers(); -// Shows message that server started -VerboseLogging.ServerStartedMessage(); -if (GamePromptOptions) +// Shows message that server is running + +ConsoleFunctions.log("Server Running"); + +//asks the user to automally open the game client +if (gameOpenEnable == true) { - OpenGamePrompt.prompt(); + if (ClientPath.EndsWith("exe")) + { + ConsoleFunctions.prompt(ClientPath); + } + else + { + Console.WriteLine("Invalid or empty Configuration value, Check your configuration file appsettings.json ClientPath is incorrect"); + } } -PrintInfo.print(); + app.Run();