mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-11-10 07:44:37 +00:00
8c6a533918
todo: improve code and finish base structures
42 lines
1.6 KiB
C#
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();
|
|
}
|
|
}
|