Supercell.GUT/Supercell.GUT.Server/Program.cs
BreadDEV 8c6a533918 [v0.0.2] you can enter menu now. but still early state
todo: improve code and finish base structures
2024-03-05 17:37:18 +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.Logic.Debug;
using Supercell.GUT.Titan.Logic.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();
}
}