コード例 #1
0
        public async Task <List <SteamGame> > UpdateAndLoadUserSteamInfoFrom64IDAsync(long steamID)
        {
            SteamDataService   SteamData     = new SteamDataService();
            SteamUserContainer SteamUser     = new SteamUserContainer();
            SteamGameContainer SteamGameList = new SteamGameContainer();

            string           steamUserID;
            List <SteamGame> gamesFromAPI;
            List <SteamGame> gamesFromDB;

            //STORE/UPDATE USER'S INFO IN DB
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            SqlCommand cmd = new SqlCommand();

            User steamUser64ID = new User();

            steamUser64ID.username = "******";

            string steamDBID = steamID.ToString();

            AddUserSteamIDToTable(steamUser64ID, steamDBID, cmd);
            cnn.Close();

            try
            {
                //TODO: Put in check if cant get game list from Steam
                //GET USER'S GAMES FROM API CALL
                SteamGameList = await SteamData.GetUsersGames(steamDBID);

                gamesFromAPI = SteamGameList.response.games;

                //STORE/UPDATE GAMES IN DB
                cnn = new SqlConnection(connectionString);
                cnn.Open();
                AddUserGameListToTable(gamesFromAPI, steamDBID, cmd);
                cnn.Close();
            }
            catch (Exception e)
            {
            }

            //GET GAMES FROM DB
            gamesFromDB = GetUserSteamGameInfoFromDB(steamUser64ID);

            return(gamesFromDB);
        }
コード例 #2
0
        public async Task <List <SteamGame> > GetUserSteamGameInfoFromSteamAPI(User user)
        {
            SteamDataService   SteamData     = new SteamDataService();
            SteamUserContainer SteamUser     = new SteamUserContainer();
            SteamGameContainer SteamGameList = new SteamGameContainer();

            string           steamUserID;
            List <SteamGame> games;

            SteamUser = await SteamData.GetSteamUser64IDAsync(user.username);

            steamUserID = SteamUser.response.steamID;

            SteamGameList = await SteamData.GetUsersGames(steamUserID);

            games = SteamGameList.response.games;

            return(games);
        }