private void OnStatusReceived(object sender, MessageReceivedArgs e) { logger.LogDebug( "Status-Nachricht empfangen: {content}", e.Content); if (sessionStartRegex.IsMatch(e.Content)) { SessionStartedEvent?.Invoke( sender: this, e: null); } else { var sessionStatusText = sessionStatusRegex.IsMatch(e.Content) ? sessionStatusRegex.Match(e.Content).Groups[StatusRegexGroupName].Value : default; var sessionStatus = sessionStatusText.GetSessionStatusType(); if (sessionStatus == default) { logger.LogError( "Unbekannte Status-Nachricht empfangen: {content}", e.Content); } else { SendSessionStatus(sessionStatus.Value); } } }
public Session StartSession(int gameId, int actorId) { var session = new Session(gameId, actorId); _sessions.TryAdd(session.Id, session); SessionStartedEvent?.Invoke(session); _logger.LogInformation($"SessionId: {session.Id} for GameId: {gameId}, ActorId: {actorId}"); return(session); }