Exemple #1
0
        public async Task <string> GetGameName(ILogger Log)
        {
            string game;

            if (string.IsNullOrWhiteSpace(this.GameId))
            {
                game = DefaultGame;
            }
            else
            {
                try
                {
                    game = (await TwitchClient.GetGame(this.GameId, Log)).Name;
                }
                catch (Exception e)
                {
                    Log.LogError($"Failed to get game. GameId {this.GameId}: {e.Message}: {e.StackTrace}");
                    game = DefaultGame;
                }
                if (string.IsNullOrWhiteSpace(game))
                {
                    Log.LogError($"GetGame returned null. GameId {this.GameId}");
                    game = DefaultGame;
                }
            }
            return(game);
        }