Snowflake/RPG.Services.Gateserver/Program.cs

30 lines
978 B
C#
Raw Normal View History

2024-01-18 22:13:40 +00:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using RPG.Services.Core.Extensions;
using RPG.Services.Gateserver.Network.Command;
using RPG.Services.Gateserver.Network.Tcp;
using RPG.Services.Gateserver.Options;
2024-01-18 16:18:25 +00:00
2024-01-18 22:13:40 +00:00
namespace RPG.Services.Gateserver;
internal static class Program
2024-01-18 16:18:25 +00:00
{
2024-01-18 22:13:40 +00:00
private const string GatewayOptionsSectionName = "Gateway";
private static async Task Main(string[] args)
2024-01-18 16:18:25 +00:00
{
2024-01-18 22:13:40 +00:00
Console.Title = "Snowflake | Gateserver";
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.SetupRPGService<RPGGateserver, GateserverCommandHandler>();
IConfigurationSection gatewaySection = builder.Configuration.GetRequiredSection(GatewayOptionsSectionName);
builder.Services.Configure<GatewayOptions>(gatewaySection)
.AddSingleton<TcpGateway>();
await builder.Build().RunAsync();
2024-01-18 16:18:25 +00:00
}
}