Ejemplo n.º 1
0
        public async Task <UserGameListData> ExecuteAsync()
        {
            var client = new SteamApiClient(_apiKey);

            var stats = await client.GetUsersGames(_userSteamId).ConfigureAwait(false);//may need to pass in a different parameter. Temp

            //var results = await client.GetUserInformation(PlayerName).ConfigureAwait(false);
            return(stats);
        }
Ejemplo n.º 2
0
        private async Task GetRandomGame(string apiKey, string userId)
        {
            //var command = new GetUsersGames(apiKey, userId);
            if (_userGameList == null)
            {
                _userGameList = await _steamApiClient.GetUsersGames(userId).ConfigureAwait(false);
            }

            var command2 = new GetGames(apiKey);

            GameData game;
            int      id;

            do
            {
                var appIds = _userGameList.response.games.Select(x => x.appid).ToList();

                //One Route
                int r = rnd.Next(appIds.Count);
                //TODO: Filter results
                id = appIds[r];
                var gameToRemove = _userGameList.response.games.FirstOrDefault(x => x.appid == id);
                command2.SetAppId(id);

                game = await command2.ExecuteAsync().ConfigureAwait(false);

                if (game.game.gameName == null)
                {
                    //REmove app id from list
                    var removed = _userGameList.response.games.Remove(gameToRemove);
                    if (removed)
                    {
                        Console.WriteLine($"INFO: App Id resulted in a null game name. Game Removed From List AppId: {id}");
                    }
                }
                if (game.game.gameName == "")
                {
                    Console.WriteLine($"INFO: App Id resulted in a game name of \"\". Game NOT Removed From List AppId: {id}");
                }
            } while (game.game.gameName == null);


            Console.WriteLine($"Random Game Name - {game.game.gameName} ,app_id - {id}");
        }