mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 16:28:50 -07:00
Update Program.cs
This commit is contained in:
parent
1bfbc75d36
commit
c852c3834f
@ -11,14 +11,12 @@ using System.Net;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
bool ConsoleOptions = builder.Configuration.GetSection("ConsoleOptions").GetValue<bool>("Show logs");
|
||||
bool GamePromptOptions = builder.Configuration.GetSection("GamePromptOptions").GetValue<bool>("Open Game");
|
||||
|
||||
// shows information about loading assets/api stuff
|
||||
if (ConsoleOptions == true)
|
||||
{
|
||||
VerboseLogging.log();
|
||||
}
|
||||
bool gameOpenEnable = builder.Configuration.GetSection("GamePromptOptions").GetValue<bool>("Enabled");
|
||||
string ClientPath = builder.Configuration.GetSection("GamePromptOptions").GetValue<string>("ClientPath");
|
||||
|
||||
// shows that the server is starting
|
||||
ConsoleFunctions.log("Server Start");
|
||||
|
||||
builder.Services.Configure<AssetServerConfig>(builder.Configuration.GetSection("AssetServer"));
|
||||
builder.Services.Configure<ApiServerConfig>(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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user