Supercell.GUT/Supercell.GUT.Server/Program.cs
BreadDEV ad23f95319 [v0.0.1] very early state server
only basic messages, wip.
2024-03-04 20:19:32 +07:00

42 lines
1.6 KiB
C#

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Supercell.GUT.Logic.Message;
using Supercell.GUT.Server.Debugging;
using Supercell.GUT.Server.Network;
using Supercell.GUT.Server.Network.Connection;
using Supercell.GUT.Server.Network.Options;
using Supercell.GUT.Server.Network.Tcp;
using Supercell.GUT.Server.Protocol;
using Supercell.GUT.Server.Protocol.Extensions;
using Supercell.GUT.Titan.Debugging;
using Supercell.GUT.Titan.Message;
namespace Supercell.GUT.Server;
internal static class Program
{
private const string GatewayOptionsSection = "Gateway";
private static async Task Main(string[] args)
{
Console.Title = "Battle Buddies Server Emulator";
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.Configure<GatewayOptions>(builder.Configuration.GetRequiredSection(GatewayOptionsSection));
builder.Services.AddHandlers();
builder.Services.AddSingleton<IDebuggerListener, ServerDebuggerListener>();
builder.Services.AddSingleton<IServerGateway, TcpGateway>();
builder.Services.AddSingleton<IGatewayEventListener, ClientConnectionManager>();
builder.Services.AddScoped<ClientConnection>();
builder.Services.AddScoped<IConnectionListener, Messaging>();
builder.Services.AddSingleton<LogicMessageFactory, GUTMessageFactory>();
builder.Services.AddScoped<MessageManager>();
builder.Services.AddHostedService<GUTServer>();
await builder.Build().RunAsync();
}
}