Esempio n. 1
0
        public static void FindWordIds()
        {
            var words = Resources.words.Split('\n');

            using (StreamWriter sw = File.AppendText("wordids.txt"))
            {
                MainForm.mf.totalIds.Maximum = words.Length;
                foreach (var word in words)
                {
                    try
                    {
                        if (word.Length >= 3)
                        {
                            var result = SteamWebAPI.General().ISteamUser().ResolveVanityURL(word).GetResponse();
                            if (result.Data.Message == "No match")
                            {
                                sw.WriteLine(word);
                                sw.Flush();
                            }
                        }
                        MainForm.mf.totalIds.Value++;
                    }
                    catch (Exception)
                    {
                        MessageBox.Show(word);
                    }
                }
            }
            if (MessageBox.Show("Complete! Want to open the file?", "Complete!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                File.Open("wordids.txt", FileMode.Open);
            }
        }
        public bool HasMw2OrMw3(long steamId)
        {
            SteamIdentity        identity     = SteamIdentity.FromSteamID(steamId);
            GetOwnedGamesBuilder gamesBuilder = SteamWebAPI.General().IPlayerService().GetOwnedGames(identity);

            try
            {
                GetOwnedGamesResponse response = gamesBuilder.GetResponse();
                if (response != null && response.Data != null)
                {
                    if (response.Data.Games != null)
                    {
                        var mw2AndMw3 = response.Data.Games.FirstOrDefault(x => x.AppID == 10180 || x.AppID == 42690);
                        if (mw2AndMw3 != null)
                        {
                            return(true);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }
Esempio n. 3
0
        static void populateGameOwnedTable(SqlConnection conn, SteamIdentity person)
        {
            //POPULATE GameOwned TABLE
            //define sql command

            string gameOwnedStatement = "INSERT INTO GameOwned(steamId, gameId, playTimeTwoWeek, playTimeForever) VALUES(@SteamId, @GameId, @PlayTimeTwoWeek, @PlayTimeForever)";

            SqlCommand gameOwnedCommand = new SqlCommand(gameOwnedStatement, conn);

            gameOwnedCommand.Parameters.Add("@SteamId", SqlDbType.BigInt);
            gameOwnedCommand.Parameters.Add("@GameId", SqlDbType.Int);
            gameOwnedCommand.Parameters.Add("@PlayTimeTwoWeek", SqlDbType.Int);
            gameOwnedCommand.Parameters.Add("@PlayTimeForever", SqlDbType.Int);

            //get all the games owned
            var gameOwnedInfo = SteamWebAPI.General().IPlayerService().GetOwnedGames(person).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var gameOwned in gameOwnedInfo.Data.Games)
            {
                gameOwnedCommand.Parameters["@SteamId"].Value         = person.SteamID;
                gameOwnedCommand.Parameters["@GameId"].Value          = gameOwned.AppID;
                gameOwnedCommand.Parameters["@PlayTimeTwoWeek"].Value = gameOwned.PlayTime2Weeks.TotalMinutes;
                gameOwnedCommand.Parameters["@PlayTimeForever"].Value = gameOwned.PlayTimeTotal.TotalMinutes;

                gameOwnedCommand.ExecuteNonQuery();
            }
        }
        public TimeSpan IsCsgoInstalled(long steamId)
        {
            SteamIdentity        identity     = SteamIdentity.FromSteamID(steamId);
            GetOwnedGamesBuilder gamesBuilder = SteamWebAPI.General().IPlayerService().GetOwnedGames(identity);

            try
            {
                GetOwnedGamesResponse response = gamesBuilder.GetResponse();
                if (response != null && response.Data != null)
                {
                    if (response.Data.Games != null)
                    {
                        var csgo = response.Data.Games.FirstOrDefault(x => x.AppID == 730);
                        if (csgo != null)
                        {
                            return(csgo.PlayTimeTotal);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(TimeSpan.Zero);
        }
Esempio n. 5
0
        }//end of getAllData

        static void populatePlayerTable(SqlConnection conn, SteamIdentity person)
        {
            //POPULATE PLAYER TABLE
            //define sql command
            string playerStatement = "INSERT INTO Player(steamId, personName, profileURL, lastLogOff) VALUES(@SteamId, @PersonName, @ProfileURL, @LastLogOff)";

            SqlCommand playerCommand = new SqlCommand(playerStatement, conn);

            playerCommand.Parameters.Add("@SteamId", SqlDbType.BigInt);
            playerCommand.Parameters.Add("@PersonName", SqlDbType.VarChar, 30);
            playerCommand.Parameters.Add("@ProfileURL", SqlDbType.VarChar, 75);
            playerCommand.Parameters.Add("@LastLogOff", SqlDbType.DateTime);

            //get the game info on the currently defined player
            var playerInfo = SteamWebAPI.General().ISteamUser().GetPlayerSummaries(person).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var player in playerInfo.Data.Players)
            {
                playerCommand.Parameters["@SteamId"].Value    = person.SteamID;
                playerCommand.Parameters["@PersonName"].Value = player.PersonaName;
                playerCommand.Parameters["@ProfileURL"].Value = player.ProfileUrl;
                playerCommand.Parameters["@LastLogOff"].Value = player.LastLogOff;

                playerCommand.ExecuteNonQuery();
            }
        }
        public BanType GetBanType(long steamId)
        {
            SteamIdentity        identity       = SteamIdentity.FromSteamID(steamId);
            GetPlayerBansBuilder summaryBuilder = SteamWebAPI.General().ISteamUser().GetPlayerBans(identity);

            try
            {
                GetPlayerBansResponse response = summaryBuilder.GetResponse();
                if (response != null && response.Players != null)
                {
                    GetPlayerBansResponsePlayer player = response.Players.FirstOrDefault();
                    if (player != null)
                    {
                        if (player.VACBanned)
                        {
                            // Ignore MW2/3 vac bans
                            bool hasMw2OrMw3 = HasMw2OrMw3(steamId);
                            return(hasMw2OrMw3 ? BanType.None : BanType.VAC);
                        }
                        else if (player.CommunityBanned)
                        {
                            return(BanType.Community);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(BanType.None);
        }
Esempio n. 7
0
        // GET api/values
        public IEnumerable <string> Get()
        {
            SteamWebAPI.SetGlobalKey("0");
            var    list  = SteamWebAPI.General().ISteamApps().GetAppList().GetResponse();
            string list2 = ""; // TODO: stworzyć listę, która pobiera te pierdoły w taki sposób w jaki pobierane są w tej fajoskiej bibliotece, np. PortableSteamExtension.GetAppDetails().GetResponse();

            return(list.Data.Apps.Select(x => x.AppID.ToString() + " - " + x.Name.ToString()));
        }
Esempio n. 8
0
        public static void testFunction(string _parameter, Channel _channel, DiscordClient _client, User _user)
        {
            var    steamIdentity   = SteamIdentity.FromSteamID(Convert.ToInt64(_parameter));
            string steamUserVanity = SteamWebAPI.General().ISteamUser().ResolveVanityURL(_parameter).GetResponseString();
            string friendsList     = SteamWebAPI.General().ISteamUser().GetFriendList(steamIdentity, RelationshipType.Friend).GetResponseString(RequestFormat.XML);

            _channel.SendMessage(steamUserVanity);
            _channel.SendMessage("Steam ID: " + friendsList);
        }
Esempio n. 9
0
 public static void FindNumberIds(int count)
 {
     if (count == 2)
     {
         using (StreamWriter sw = File.AppendText("2numberids.txt"))
         {
             MainForm.mf.totalIds.Maximum = 26 * 26;
             for (int i = 0; i <= 9; i++)
             {
                 for (int j = 0; j <= 9; j++)
                 {
                     var result = SteamWebAPI.General().ISteamUser().ResolveVanityURL($"{i}{j}").GetResponse();
                     if (result.Data.Message == "No match")
                     {
                         sw.WriteLine($"{i}{j}");
                         sw.Flush();
                     }
                     MainForm.mf.totalIds.Value++;
                 }
             }
         }
         if (MessageBox.Show("Complete! Want to open the file?", "Complete!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             File.Open("2numberids.txt", FileMode.Open);
         }
     }
     else if (count == 3)
     {
         using (StreamWriter sw = File.AppendText("3numberids.txt"))
         {
             MainForm.mf.totalIds.Maximum = 26 * 26 * 26;
             for (int i = 0; i <= 9; i++)
             {
                 for (int j = 0; j <= 9; j++)
                 {
                     for (int k = 0; k <= 9; k++)
                     {
                         var result = SteamWebAPI.General().ISteamUser().ResolveVanityURL($"{i}{j}{k}").GetResponse();
                         if (result.Data.Message == "No match")
                         {
                             sw.WriteLine($"{i}{j}{k}");
                             sw.Flush();
                         }
                         MainForm.mf.totalIds.Value++;
                     }
                 }
             }
         }
         if (MessageBox.Show("Complete! Want to open the file?", "Complete!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             File.Open("3numberids.txt", FileMode.Open);
         }
     }
 }
Esempio n. 10
0
 public void downloadSteamAppList(bool force)
 {
     if (!File.Exists("./steamapps.txt") || force)
     {
         var          ret    = SteamWebAPI.General().ISteamApps().GetAppList().GetResponse();
         StreamWriter stream = File.CreateText("./steamapps.txt");
         foreach (var app in ret.Data.Apps)
         {
             stream.WriteLine(app.AppID + "=" + app.Name);
         }
     }
 }
Esempio n. 11
0
        public static void Init(long steamID)
        {
            if (steamID == 0)
            {
                IsSteamProfile = false;
                return;
            }

            SteamWebAPI.SetGlobalKey("1E5E3956484C372C2D9AE6D58EFA4F69");
            var appListResponse = SteamWebAPI.General().ISteamApps().GetAppList().GetResponse();

            AppList = appListResponse.Data.Apps;
            SteamID = steamID;
            User    = SteamIdentity.FromSteamID(steamID);
        }
Esempio n. 12
0
        public static List <Game> GetOwnedGames()
        {
            List <Game> gamesList = new List <Game>();

            var gameListResponse = SteamWebAPI.General().IPlayerService().GetOwnedGames(User).GetResponse();
            List <GetOwnedGamesResponseGame> gameList = gameListResponse.Data.Games;

            foreach (GetOwnedGamesResponseGame g in gameList)
            {
                var game = AppList.Find(x => x.AppID == g.AppID);
                if (game != null)
                {
                    gamesList.Add(new Game(g.AppID, game.Name));
                }
            }

            return(gamesList);
        }
Esempio n. 13
0
        public List <string> getFriends(long steamID)
        {
            SteamWebAPI.SetGlobalKey("2E063F9BD27D3C9AED847FAB0D876E01");
            var name    = SteamIdentity.FromSteamID(steamID);
            var game    = SteamWebAPI.General().ISteamUser().GetFriendList(name, RelationshipType.All).GetResponse();
            var friends = SteamWebAPI.General().ISteamUser().GetFriendList(name, RelationshipType.All).GetResponse();

            List <string> result = new List <String>();

            List <String> friendNames = new List <string>();

            foreach (var friend in friends.Data.Friends)
            {
                var level = SteamWebAPI.General().IPlayerService().GetSteamLevel(friend.Identity).GetResponse();
                result.Add(friend.Identity.SteamID + " is level: " + level.Data.PlayerLevel.ToString());
            }
            return(result);
        }
Esempio n. 14
0
        static void populateAchievementOwnedTable(SqlConnection conn, SteamIdentity person)
        {
            //POPULATE ACHIEVEMENT OWNED TABLE
            //define sql command
            string achievementStatement = "INSERT INTO AchievementOwned(playerId, gameId, name) VALUES(@PlayerId, @GameId, @Name)";

            SqlCommand achievementCommand = new SqlCommand(achievementStatement, conn);

            achievementCommand.Parameters.Add("@PlayerId", SqlDbType.BigInt);
            achievementCommand.Parameters.Add("@GameId", SqlDbType.Int);
            achievementCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            //get all the games owned
            var gameOwnedInfo = SteamWebAPI.General().IPlayerService().GetOwnedGames(person).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var gameOwned in gameOwnedInfo.Data.Games)
            {
                //get the achievement info on the currently defined player
                var achievementInfo = SteamWebAPI.General().ISteamUserStats().GetPlayerAchievements(gameOwned.AppID, person).GetResponse();

                //the try for see if there Achievements
                try
                {
                    //cycle through the returned data and execute each command
                    foreach (var achievement in achievementInfo.Data.Achievements)
                    {
                        achievementCommand.Parameters["@PlayerId"].Value = person.SteamID;
                        achievementCommand.Parameters["@GameId"].Value   = gameOwned.AppID;
                        achievementCommand.Parameters["@Name"].Value     = achievement.APIName;


                        achievementCommand.ExecuteNonQuery();
                    }
                }
                catch
                {
                    //Console.WriteLine("can't");
                }
            }
        }
Esempio n. 15
0
        public static bool DoIHaveDayZ(long steamId)
        {
            SteamWebAPI.SetGlobalKey("26DF222A39656E4F4B38BA61B7E57744");

            var me =
                SteamIdentity.FromSteamID(steamId);

            var myGames =
                SteamWebAPI
                .General()
                .IPlayerService()
                .GetOwnedGames(me)
                .GetResponse().Data
                .Games;

            if (myGames != null && myGames.Any(g => g.AppID == DayZAppId))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 16
0
        static void populateGameTable(SqlConnection conn)
        {
            //POPULATE GAME TABLE
            //define sql command
            string gameStatement = "INSERT INTO Game(gameId, name) VALUES(@GameID, @Name)";

            SqlCommand gameCommand = new SqlCommand(gameStatement, conn);

            gameCommand.Parameters.Add("@GameID", SqlDbType.Int);
            gameCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);

            //get the game info on the currently defined player
            var gameInfo = SteamWebAPI.General().ISteamApps().GetAppList().GetResponse();

            //cycle through the returned data and execute each command
            foreach (var game in gameInfo.Data.Apps)
            {
                gameCommand.Parameters["@GameID"].Value = game.AppID;
                gameCommand.Parameters["@Name"].Value   = game.Name;

                gameCommand.ExecuteNonQuery();
            }
        }
Esempio n. 17
0
        static void populateFriendsHaveTable(SqlConnection conn, SteamIdentity person)
        {
            string friendStatement = "INSERT INTO FriendHave(friendOne, friendTwo, friendSince) VALUES(@FriendOne, @FriendTwo, @FriendSince)";

            SqlCommand friendCommand = new SqlCommand(friendStatement, conn);

            friendCommand.Parameters.Add("@FriendOne", SqlDbType.BigInt);
            friendCommand.Parameters.Add("@FriendTwo", SqlDbType.BigInt);
            friendCommand.Parameters.Add("@FriendSince", SqlDbType.DateTime);

            //get all the games owned
            var friendInfo = SteamWebAPI.General().ISteamUser().GetFriendList(person, RelationshipType.Friend).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var friend in friendInfo.Data.Friends)
            {
                friendCommand.Parameters["@FriendOne"].Value   = person.SteamID;
                friendCommand.Parameters["@FriendTwo"].Value   = friend.Identity.SteamID;
                friendCommand.Parameters["@FriendSince"].Value = friend.FriendSince;

                friendCommand.ExecuteNonQuery();
            }
        }
        public string GetName(long steamId)
        {
            SteamIdentity             identity       = SteamIdentity.FromSteamID(steamId);
            GetPlayerSummariesBuilder summaryBuilder = SteamWebAPI.General().ISteamUser().GetPlayerSummaries(identity);

            try
            {
                GetPlayerSummariesResponse response = summaryBuilder.GetResponse();
                if (response != null && response.Data != null)
                {
                    GetPlayerSummariesResponsePlayer player = response.Data.Players.FirstOrDefault();
                    if (player != null)
                    {
                        return(player.PersonaName);
                    }
                }
            }
            catch (Exception)
            {
            }

            return("");
        }
        public void FindFriends(long steamId)
        {
            SteamIdentity        identity      = SteamIdentity.FromSteamID(steamId);
            GetFriendListBuilder friendBuilder = SteamWebAPI.General().ISteamUser().GetFriendList(identity, RelationshipType.Friend);

            try
            {
                var response = friendBuilder.GetResponse();
                if (response != null && response.Data != null)
                {
                    List <Friend> friends = response.Data.Friends.ToList();

                    foreach (Friend friend in friends)
                    {
                        _queue.Push(friend.Identity.SteamID);
                    }

                    Console.WriteLine("Found friends for {0} (found {1}), queue: {2}", steamId, friends.Count, _queue.Count);
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 20
0
        static void Main(string[] args)
        {
//OPEN CONNECTION AND DEFINE TARGET PLAYER
            //open the sql connection by finding the server on the currently used computer
            SqlConnection conn = new SqlConnection("Server=COLINREILLY\\SQLEXPRESS;" +
                                                   "Database=steamDb;" +
                                                   "Integrated Security=true");

            conn.Open();

            //define target player cridentials
            //long[] steamID = new long[] { 76561198065588383, 76561198047886273 };
            SteamWebAPI.SetGlobalKey("00E30769A6BA27CB7804374A82DBD737");

            //create steam identity
            var colin   = SteamIdentity.FromSteamID(76561198047886273);
            var brenden = SteamIdentity.FromSteamID(76561198065588383);

//POPULATE GAME TABLE
            //define sql command
            string gameStatement = "INSERT INTO Game(gameId, name) VALUES(@GameID, @Name)";

            SqlCommand gameCommand = new SqlCommand(gameStatement, conn);

            gameCommand.Parameters.Add("@GameID", SqlDbType.Int);
            gameCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);

            //get the game info on the currently defined player
            var gameInfo = SteamWebAPI.General().ISteamApps().GetAppList().GetResponse();

            //cycle through the returned data and execute each command
            foreach (var game in gameInfo.Data.Apps)
            {
                Console.WriteLine(game.Name);
                Console.WriteLine(game.AppID);
                gameCommand.Parameters["@GameID"].Value = game.AppID;
                gameCommand.Parameters["@Name"].Value   = game.Name;

                gameCommand.ExecuteNonQuery();
                if (game.AppID > 300)
                {
                    break;
                }
            }

//POPULATE PLAYER TABLE
            //define sql command
            string playerStatement = "INSERT INTO Player(steamId, personName, profileURL, lastLogOff) VALUES(@SteamId, @PersonName, @ProfileURL, @LastLogOff)";

            SqlCommand playerCommand = new SqlCommand(playerStatement, conn);

            playerCommand.Parameters.Add("@SteamId", SqlDbType.BigInt);
            playerCommand.Parameters.Add("@PersonName", SqlDbType.VarChar, 30);
            playerCommand.Parameters.Add("@ProfileURL", SqlDbType.VarChar, 75);
            playerCommand.Parameters.Add("@LastLogOff", SqlDbType.DateTime);

            //get the game info on the currently defined player
            var playerInfo = SteamWebAPI.General().ISteamUser().GetPlayerSummaries(colin).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var player in playerInfo.Data.Players)
            {
                Console.WriteLine(colin.SteamID);
                Console.WriteLine(player.PersonaName);
                Console.WriteLine(player.ProfileUrl);
                Console.WriteLine(player.LastLogOff);
                playerCommand.Parameters["@SteamId"].Value    = colin.SteamID;
                playerCommand.Parameters["@PersonName"].Value = player.PersonaName;
                playerCommand.Parameters["@ProfileURL"].Value = player.ProfileUrl;
                playerCommand.Parameters["@LastLogOff"].Value = player.LastLogOff;

                playerCommand.ExecuteNonQuery();
            }

//POPULATE ACHIEVEMENT TABLE
            //define sql command
            string achievementStatement = "INSERT INTO Achievement(Name, gameId) VALUES(@Name, @GameId)";

            SqlCommand achievementCommand = new SqlCommand(achievementStatement, conn);

            achievementCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            achievementCommand.Parameters.Add("@GameId", SqlDbType.Int);

            //get the game info on the currently defined player
            var achievementInfo = SteamWebAPI.General().ISteamUserStats().GetPlayerAchievements(440, colin).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var achievement in achievementInfo.Data.Achievements)
            {
                Console.WriteLine(achievement.APIName);
                Console.WriteLine(440);
                achievementCommand.Parameters["@Name"].Value   = achievement.APIName;
                achievementCommand.Parameters["@GameId"].Value = 440;

                achievementCommand.ExecuteNonQuery();
            }

            //close sql connection and exit
            conn.Close();
            Console.WriteLine("press enter to exit");
            Console.ReadLine();
        }
Esempio n. 21
0
        static void populateAchievementTable(SqlConnection conn, SteamIdentity person)
        {
            //POPULATE ACHIEVEMENT TABLE
            //define sql command
            string achievementStatement = "INSERT INTO Achievement(name, gameId) VALUES(@Name, @GameId)";

            SqlCommand achievementCommand = new SqlCommand(achievementStatement, conn);

            achievementCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            achievementCommand.Parameters.Add("@GameId", SqlDbType.Int);

            //get all the games owned
            var gameOwnedInfo = SteamWebAPI.General().IPlayerService().GetOwnedGames(person).GetResponse();

            //cycle through the returned data and execute each command
            foreach (var gameOwned in gameOwnedInfo.Data.Games)
            {
                //Colins nightmare
                //Steam put a fake game into there data base and its to big to take in
                //This probablem is only on this one game and the error likes in avaible games states
                //Location
                //http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=00E30769A6BA27CB7804374A82DBD737&appid=240
                //http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=00E30769A6BA27CB7804374A82DBD737&appid=730
                bool  bad    = false;
                int[] badIds = new int[] { 240, 730, 223220, 221910, 35450, 236830, 317950, 104320, 224780 };
                foreach (var badId in badIds)
                {
                    if (badId == gameOwned.AppID)
                    {
                        bad = true;
                    }
                }
                if (bad == true)
                {
                    continue;
                }


                //get the achievement info on a game
                try
                {
                    var achievementInfo = SteamWebAPI.General().ISteamUserStats().GetSchemaForGame(gameOwned.AppID).GetResponse();

                    //the try for see if there Achievements
                    try
                    {
                        //if there already in the table
                        try
                        {   //cycle through the returned data and execute each command
                            foreach (var achievement in achievementInfo.Data.AvailableGameStats.Achievements)
                            {
                                achievementCommand.Parameters["@Name"].Value   = achievement.Name;
                                achievementCommand.Parameters["@GameId"].Value = gameOwned.AppID;

                                achievementCommand.ExecuteNonQuery();
                            }
                        }
                        catch
                        {
                        }
                    }
                    catch
                    {
                        //example of a game that has no schema
                        //http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=00E30769A6BA27CB7804374A82DBD737&appid=3910
                        //Console.WriteLine(gameOwned.AppID);
                        //Console.WriteLine("could't get the value");
                    }
                }
                catch
                {
                    Console.WriteLine(gameOwned.AppID);
                }
            }
        }
Esempio n. 22
0
        // GET: GameLists/Create
        public ActionResult Create()
        {
            string          currentUserID = User.Identity.GetUserId();
            ApplicationUser currentUser   = Database.Users.Find(currentUserID);
            string          providerKey   = currentUser.Logins.First().ProviderKey;

            providerKey = providerKey.Substring(providerKey.Length - 17);

            SteamWebAPI.SetGlobalKey(Security.apiKey);

            var identity = SteamIdentity.FromSteamID(Int64.Parse(providerKey));

            //JSON response from Steam
            var response = SteamWebAPI.General().IPlayerService().GetOwnedGames(identity).IncludeAppInfo().GetResponse();

            //Iterate through each item and add it to database
            foreach (var res in response.Data.Games)
            {
                TimeSpan timeSpan = res.PlayTimeTotal;

                int totalHours = (int)timeSpan.TotalHours;

                TagList tagList = new TagList()
                {
                    appID  = res.AppID,
                    userID = currentUserID
                };

                GameDescrip gameDesc = new GameDescrip()
                {
                    appID            = res.AppID,
                    playtime_forever = totalHours,
                    userId           = currentUserID,
                    visible          = true, //True by default for now.
                    Tags             = tagList
                };

                Game game = new Game();

                if (res.Name != null)
                {
                    game.name = res.Name;
                }
                else
                {
                    game.name = res.AppID.ToString();
                }
                game.appID          = res.AppID;
                game.img_header_url = "http://cdn.akamai.steamstatic.com/steam/apps/" + res.AppID + "/header.jpg";
                game.img_icon_url   = "http://media.steampowered.com/steamcommunity/public/images/apps/" + res.AppID + "/" + res.IconUrl + ".jpg";
                game.img_logo_url   = "http://media.steampowered.com/steamcommunity/public/images/apps/" + res.AppID + "/" + res.LogoUrl + ".jpg";

                //Ensure User entry for game doesn't exist in table
                bool doesLibraryExist = (Database.GDescriptions.Any(u => u.userId.Equals(gameDesc.userId)) &&
                                         Database.GDescriptions.Any(a => a.appID.Equals(game.appID))); //AppID
                //Ensure Game doesn't already exist in game table
                bool doesGameExist = Database.Games.Any(a => a.appID.Equals(game.appID));

                if (doesLibraryExist)
                {
                    // Do nothing
                }
                else
                {
                    if (doesGameExist)
                    {
                        //Add existing game object
                        gameDesc.Game = Database.Games.Where(a => a.appID == game.appID).SingleOrDefault();
                    }
                    else
                    {
                        //add newly created game object
                        gameDesc.Game = game;
                        Database.Games.Add(game);
                    }
                    //Add User Record for game
                    Database.GDescriptions.Add(gameDesc);
                }
            }
            currentUser.GameCount = response.Data.GameCount;
            Database.SaveChanges();

            return(RedirectToAction("Index"));
        }