Beispiel #1
0
        public async Task RegisterUserToDBAsync(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);

            SteamGameList = await SteamData.GetUsersGames(SteamUser.response.steamID);

            steamUserID = SteamUser.response.steamID;
            games       = SteamGameList.response.games;

            cnn = new SqlConnection(connectionString);
            cnn.Open();
            SqlCommand cmd = new SqlCommand();

            //AddUserCredentialsToTable(user, cmd);

            //AddUserSteamIDToTable(user, steamUserID, cmd);

            AddUserGameListToTable(games, steamUserID, cmd);

            cnn.Close();
        }
Beispiel #2
0
        public async Task <List <SteamGame> > UpdateAndLoadUserSteamInfoAsync(User user)
        {
            SteamDataService   SteamData     = new SteamDataService();
            SteamUserContainer SteamUser     = new SteamUserContainer();
            SteamGameContainer SteamGameList = new SteamGameContainer();

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

            //TODO: Put in check if cant get steam user id from username
            //GET USER'S STEAM 64 ID FROM USERNAME
            SteamUser = await SteamData.GetSteamUser64IDAsync(user.username);

            steamUserID = SteamUser.response.steamID;

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

            AddUserSteamIDToTable(user, steamUserID, 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(steamUserID);

                gamesFromAPI = SteamGameList.response.games;

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

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

            return(gamesFromDB);
        }
Beispiel #3
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);
        }