/// <summary> /// Initializes a new instance of the <see cref="GameServerContainer" /> class. /// </summary> /// <param name="loggerFactory">The logger factory.</param> /// <param name="servers">The servers.</param> /// <param name="gameServers">The game servers.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="connectServerContainer">The connect server container.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="friendServer">The friend server.</param> /// <param name="ipResolver">The ip resolver.</param> /// <param name="plugInManager">The plug in manager.</param> public GameServerContainer( ILoggerFactory loggerFactory, IList <IManageableServer> servers, IDictionary <int, IGameServer> gameServers, IPersistenceContextProvider persistenceContextProvider, ConnectServerContainer connectServerContainer, IGuildServer guildServer, ILoginServer loginServer, IFriendServer friendServer, IIpAddressResolver ipResolver, PlugInManager plugInManager) { this.loggerFactory = loggerFactory; this.servers = servers; this.gameServers = gameServers; this.persistenceContextProvider = persistenceContextProvider; this.connectServerContainer = connectServerContainer; this.guildServer = guildServer; this.loginServer = loginServer; this.friendServer = friendServer; this.ipResolver = ipResolver; this.plugInManager = plugInManager; this.logger = this.loggerFactory.CreateLogger <GameServerContainer>(); }
/// <summary> /// Initializes a new instance of the <see cref="GameServer" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="friendServer">The friend server.</param> /// <param name="stateObserver">The state observer.</param> public GameServer( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IPersistenceContextProvider persistenceContextProvider, IFriendServer friendServer, IServerStateObserver stateObserver) { this.Id = gameServerDefinition.ServerID; this.Description = gameServerDefinition.Description; this.stateObserver = stateObserver; try { var mapInitializer = new GameServerMapInitializer(gameServerDefinition, this.Id, stateObserver); this.gameContext = new GameServerContext(gameServerDefinition, guildServer, loginServer, friendServer, persistenceContextProvider, stateObserver, mapInitializer); } catch (Exception ex) { Logger.Fatal(ex); throw; } this.ServerInfo = new GameServerInfoAdapter(this, gameServerDefinition.ServerConfiguration); }
/// <summary> /// Initializes a new instance of the <see cref="GameServer" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="friendServer">The friend server.</param> /// <param name="loggerFactory">The logger factory.</param> /// <param name="plugInManager">The plug in manager.</param> public GameServer( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IPersistenceContextProvider persistenceContextProvider, IFriendServer friendServer, ILoggerFactory loggerFactory, PlugInManager plugInManager) { this.Id = gameServerDefinition.ServerID; this.Description = gameServerDefinition.Description; this.ConfigurationId = gameServerDefinition.GetId(); this.logger = loggerFactory.CreateLogger <GameServer>(); try { var mapInitializer = new GameServerMapInitializer(gameServerDefinition, loggerFactory.CreateLogger <GameServerMapInitializer>()); this.gameContext = new GameServerContext(gameServerDefinition, guildServer, loginServer, friendServer, persistenceContextProvider, mapInitializer, loggerFactory, plugInManager); this.gameContext.GameMapCreated += (sender, e) => this.OnPropertyChanged(nameof(this.Context)); this.gameContext.GameMapRemoved += (sender, e) => this.OnPropertyChanged(nameof(this.Context)); mapInitializer.PlugInManager = this.gameContext.PlugInManager; } catch (Exception ex) { this.logger.LogCritical(ex, "Error during map initialization"); throw; } this.ServerInfo = new GameServerInfoAdapter(this, gameServerDefinition.ServerConfiguration ?? throw new InvalidOperationException("GameServerDefinition requires a ServerConfiguration")); }
/// <summary> /// Initializes a new instance of the <see cref="GameServer" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="friendServer">The friend server.</param> public GameServer( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IPersistenceContextProvider persistenceContextProvider, IFriendServer friendServer) { this.Id = gameServerDefinition.ServerID; this.Description = gameServerDefinition.Description; this.ConfigurationId = gameServerDefinition.GetId(); try { var mapInitializer = new GameServerMapInitializer(gameServerDefinition, this.Id); this.gameContext = new GameServerContext(gameServerDefinition, guildServer, loginServer, friendServer, persistenceContextProvider, mapInitializer); this.gameContext.GameMapCreated += (sender, e) => this.OnPropertyChanged(nameof(this.Context)); this.gameContext.GameMapRemoved += (sender, e) => this.OnPropertyChanged(nameof(this.Context)); mapInitializer.PlugInManager = this.gameContext.PlugInManager; } catch (Exception ex) { Logger.Fatal(ex); throw; } this.ServerInfo = new GameServerInfoAdapter(this, gameServerDefinition.ServerConfiguration); }
/// <summary> /// Initializes a new instance of the <see cref="GameServer"/> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="repositoryManager">The repository manager.</param> /// <param name="friendServer">The friend server.</param> public GameServer( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IRepositoryManager repositoryManager, IFriendServer friendServer) { this.Id = gameServerDefinition.ServerID; this.Description = gameServerDefinition.Description; try { this.gameContext = new GameServerContext(gameServerDefinition, guildServer, loginServer, friendServer, repositoryManager); } catch (Exception ex) { Logger.Fatal(ex); throw; } this.freePlayerIds = new ConcurrentBag <ushort>( Enumerable.Range( gameServerDefinition.ServerConfiguration.MaximumNPCs + 1, gameServerDefinition.ServerConfiguration.MaximumPlayers).Select(id => (ushort)id)); this.ServerInfo = new GameServerInfoAdapter(this, gameServerDefinition.ServerConfiguration); }
public LoginManager(LoginClient client, ILoginServer server, IDatabase database) { _client = client; _server = server; _database = database; _client.OnPacketArrived += Client_OnPacketArrived; }
public AuthenticationHandler(ILoginServer server, ILoginPacketFactory loginPacketFactory, IDatabase database, IPasswordHasher <DbUser> passwordHasher, UserManager <DbUser> userManager) { _server = server; _loginPacketFactory = loginPacketFactory; _database = database; _passwordHasher = passwordHasher; _userManager = userManager; }
/// <summary> /// Initializes the current <see cref="LoginClient"/> instance. /// </summary> /// <param name="loginServer">Parent login server.</param> /// <param name="logger">Logger.</param> /// <param name="handlerInvoker">Handler invoker.</param> /// <param name="loginPacketFactory">Login packet factory.</param> public void Initialize(ILoginServer loginServer, ILogger <LoginClient> logger, IHandlerInvoker handlerInvoker, ILoginPacketFactory loginPacketFactory) { _loginServer = loginServer; _logger = logger; _handlerInvoker = handlerInvoker; loginPacketFactory.SendWelcome(this, SessionId); }
/// <summary> /// Creates a new <see cref="LoginHandler"/> instance. /// </summary> /// <param name="logger">Logger.</param> /// <param name="loginConfiguration">Login server configuration.</param> /// <param name="loginServer">Login server instance.</param> /// <param name="database">Database service.</param> /// <param name="coreServer">Core server.</param> /// <param name="loginPacketFactory">Login server packet factory.</param> public LoginHandler(ILogger <LoginHandler> logger, IOptions <LoginConfiguration> loginConfiguration, ILoginServer loginServer, IRhisisDatabase database, ICoreServer coreServer, ILoginPacketFactory loginPacketFactory) { _logger = logger; _loginConfiguration = loginConfiguration.Value; _loginServer = loginServer; _database = database; _coreServer = coreServer; _loginPacketFactory = loginPacketFactory; }
/// <summary> /// Initializes a new instance of the <see cref="GameServerContext" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="friendServer">The friend server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="mapInitializer">The map initializer.</param> public GameServerContext( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IFriendServer friendServer, IPersistenceContextProvider persistenceContextProvider, IMapInitializer mapInitializer) : base(gameServerDefinition.GameConfiguration, persistenceContextProvider, mapInitializer) { this.Id = gameServerDefinition.ServerID; this.GuildServer = guildServer; this.LoginServer = loginServer; this.FriendServer = friendServer; this.ServerConfiguration = gameServerDefinition.ServerConfiguration; }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoginServer loginServer) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapHub <ISHub>("/inter_server"); }); loginServer.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="GameServerContext"/> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="friendServer">The friend server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> public GameServerContext( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IFriendServer friendServer, IPersistenceContextProvider persistenceContextProvider) : base(gameServerDefinition.GameConfiguration, persistenceContextProvider) { this.Id = gameServerDefinition.ServerID; this.GuildServer = guildServer; this.LoginServer = loginServer; this.FriendServer = friendServer; this.ServerConfiguration = gameServerDefinition.ServerConfiguration; this.PacketHandlers = gameServerDefinition.ServerConfiguration.SupportedPacketHandlers.Select(m => new ConfigurableMainPacketHandler(m, this)).ToArray <IMainPacketHandler>(); this.GuildCache = new GuildCache(this, new GuildInfoSerializer()); }
/// <summary> /// Initializes a new instance of the <see cref="GameServerContext" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="friendServer">The friend server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="mapInitializer">The map initializer.</param> /// <param name="loggerFactory">The logger factory.</param> /// <param name="plugInManager">The plug in manager.</param> public GameServerContext( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IFriendServer friendServer, IPersistenceContextProvider persistenceContextProvider, IMapInitializer mapInitializer, ILoggerFactory loggerFactory, PlugInManager plugInManager) : base(gameServerDefinition.GameConfiguration ?? throw new InvalidOperationException("GameServerDefinition requires a GameConfiguration"), persistenceContextProvider, mapInitializer, loggerFactory, plugInManager) { this.gameServerDefinition = gameServerDefinition; this.Id = gameServerDefinition.ServerID; this.GuildServer = guildServer; this.LoginServer = loginServer; this.FriendServer = friendServer; this.ServerConfiguration = gameServerDefinition.ServerConfiguration ?? throw new InvalidOperationException("GameServerDefinition requires a ServerConfiguration"); }
/// <summary> /// Initializes a new instance of the <see cref="GameServerContext" /> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="friendServer">The friend server.</param> /// <param name="persistenceContextProvider">The persistence context provider.</param> /// <param name="stateObserver">The state observer.</param> /// <param name="mapInitializer">The map initializer.</param> public GameServerContext( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IFriendServer friendServer, IPersistenceContextProvider persistenceContextProvider, IServerStateObserver stateObserver, IMapInitializer mapInitializer) : base(gameServerDefinition.GameConfiguration, persistenceContextProvider, new ServerStateToGameStateObserverAdapter(stateObserver, gameServerDefinition.ServerID), mapInitializer) { this.Id = gameServerDefinition.ServerID; this.GuildServer = guildServer; this.LoginServer = loginServer; this.FriendServer = friendServer; this.ServerConfiguration = gameServerDefinition.ServerConfiguration; this.PacketHandlers = gameServerDefinition.ServerConfiguration.SupportedPacketHandlers.Select(m => new ConfigurableMainPacketHandler(m, this)).ToArray <IMainPacketHandler>(); }
/// <inheritdoc /> public void Run() { var logger = DependencyContainer.Instance.Resolve <ILogger <LoginServerStartup> >(); this._server = DependencyContainer.Instance.Resolve <ILoginServer>(); try { logger.LogInformation("Starting LoginServer..."); this._server.Start(); } catch (Exception e) { logger.LogCritical(e, $"An unexpected error occured in LoginServer."); #if DEBUG Console.ReadLine(); #endif } }
/// <summary> /// Initializes a new instance of the <see cref="GameServer"/> class. /// </summary> /// <param name="gameServerDefinition">The game server definition.</param> /// <param name="guildServer">The guild server.</param> /// <param name="loginServer">The login server.</param> /// <param name="repositoryManager">The repository manager.</param> /// <param name="friendServer">The friend server.</param> public GameServer( GameServerDefinition gameServerDefinition, IGuildServer guildServer, ILoginServer loginServer, IRepositoryManager repositoryManager, IFriendServer friendServer) { this.Id = gameServerDefinition.ServerID; this.Description = gameServerDefinition.Description; try { this.gameContext = new GameServerContext(gameServerDefinition, guildServer, loginServer, friendServer, repositoryManager); } catch (Exception ex) { Logger.Fatal(ex); throw; } this.ServerInfo = new GameServerInfoAdapter(this, gameServerDefinition.ServerConfiguration); }
public SelectServerHandler(ILoginServer server, ILoginPacketFactory loginPacketFactory) { _server = server; _loginPacketFactory = loginPacketFactory; }
public LoginService(ILoginServer server) { this.server = server; }
public LoginPacketFactory(ILoginServer server) { _server = server; }
/// <summary> /// Creates a new <see cref="LoginClient"/> instance. /// </summary> /// <param name="server">The parent login server.</param> /// <param name="socket">The accepted socket.</param> public LoginClient(ILoginServer server, Socket socket, ILogger logger) : base(server, socket) { _logger = logger; }
public LoginController() { _ILoginServer = new LoginServer(); }
public SwgServer(ILoginServer loginServer, ILogger logger) { _loginServer = loginServer; _logger = logger; }
public LoginController(ILoginServer LoginServer) { _ILoginServer = LoginServer; }
/// <summary> /// Creates a new <see cref="LoginClient"/> instance. /// </summary> /// <param name="server">The parent login server.</param> /// <param name="socket">The accepted socket.</param> public LoginClient(ILoginServer server, Socket socket) : base(server, socket) { this.logger = DependencyContainer.Instance.Resolve <ILogger <LoginClient> >(); }
/// <summary> /// Creates a new <see cref="LoginClient"/> instance. /// </summary> public LoginClient() { this.SessionId = RandomHelper.GenerateSessionKey(); this._logger = DependencyContainer.Instance.Resolve <ILogger <LoginClient> >(); this._loginServer = DependencyContainer.Instance.Resolve <ILoginServer>(); }
public LoginManager CreateLoginManager(LoginClient client, ILoginServer server) { var scope = _provider.CreateScope(); return(new LoginManager(client, server, scope.ServiceProvider.GetRequiredService <IDatabase>())); }
/// <summary> /// Creates a new <see cref="LoginServerService"/> instance. /// </summary> /// <param name="logger">Logger.</param> /// <param name="loginServer">Login Server instance.</param> public LoginServerService(ILogger <LoginServerService> logger, ILoginServer loginServer) { _logger = logger; _loginServer = loginServer; }