public async Task RunAsync() { await _mapInstanceProvider.InitializeAsync().ConfigureAwait(false); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SUCCESSFULLY_LOADED)); _events.ForEach(e => { Observable.Interval(e.Delay).Subscribe(_ => e.ExecutionAsync()); }); AppDomain.CurrentDomain.ProcessExit += (s, e) => { var eventSaveAll = new SaveAll(_logger); _ = eventSaveAll.ExecutionAsync(); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.CHANNEL_WILL_EXIT)); Thread.Sleep(30000); }; try { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console.Title += $@" - Port : {_worldConfiguration.Value.Port} - WebApi : {_worldConfiguration.Value.WebApi}"; } _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LISTENING_PORT), _worldConfiguration.Value.Port); await Task.WhenAny(_channelHttpClient.ConnectAsync(), _networkManager.RunServerAsync()).ConfigureAwait(false); } catch { Console.ReadKey(); } }
public async Task RunAsync() { try { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console.Title += $@" - Port : {Convert.ToInt32(_loginConfiguration.Value.Port)}"; } try { await _context.Database.MigrateAsync(); await _context.Database.GetDbConnection().OpenAsync(); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.DATABASE_INITIALIZED)); } catch (Exception ex) { _logger.Error("Database Error", ex); _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.DATABASE_NOT_UPTODATE)); throw; } _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LISTENING_PORT), _loginConfiguration.Value.Port); await Task.WhenAny(_channelHttpClient.ConnectAsync(), _networkManager.RunServerAsync()).ConfigureAwait(false); } catch { Console.ReadKey(); } }
public async Task RunAsync() { if (_worldConfiguration == null) { return; } await _mapInstanceProvider.InitializeAsync().ConfigureAwait(false); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SUCCESSFULLY_LOADED)); _events.ForEach(e => { Observable.Interval(e.Delay).Subscribe(_ => e.ExecutionAsync()); }); AppDomain.CurrentDomain.ProcessExit += (s, e) => { var eventSaveAll = new SaveAll(_logger); eventSaveAll.ExecutionAsync().Forget(); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.CHANNEL_WILL_EXIT)); Thread.Sleep(30000); }; try { try { Console.Title += $@" - Port : {_worldConfiguration.Port} - WebApi : {_worldConfiguration.WebApi}"; } catch (PlatformNotSupportedException) { _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.PLATFORM_UNSUPORTED_CONSOLE_TITLE)); } _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LISTENING_PORT), _worldConfiguration.Port); await Task.WhenAny(_channelHttpClient.ConnectAsync(), _networkManager.RunServerAsync()).ConfigureAwait(false); } catch { Console.ReadKey(); } }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await _mapInstanceGeneratorService.InitializeAsync().ConfigureAwait(false); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.SUCCESSFULLY_LOADED)); AppDomain.CurrentDomain.ProcessExit += (s, e) => { var eventSaveAll = new SaveAll(_logger); _ = eventSaveAll.ExecuteAsync(); _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.CHANNEL_WILL_EXIT)); Thread.Sleep(30000); }; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Console.Title += $@" - Port : {_worldConfiguration.Value.Port} - WebApi : {_worldConfiguration.Value.WebApi}"; } _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LISTENING_PORT), _worldConfiguration.Value.Port); await Task.WhenAny(_clock.Run(stoppingToken), _channelHttpClient.ConnectAsync(), _networkManager.RunServerAsync()).ConfigureAwait(false); }
public async Task RunAsync() { try { try { Console.Title += $@" - Port : {Convert.ToInt32(_loginConfiguration.Port)}"; } catch (PlatformNotSupportedException) { _logger.Warning(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.PLATFORM_UNSUPORTED_CONSOLE_TITLE)); } _logger.Information(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.LISTENING_PORT), _loginConfiguration.Port); await Task.WhenAny(_channelHttpClient.ConnectAsync(), _networkManager.RunServerAsync()).ConfigureAwait(false); } catch { Console.ReadKey(); } }