Exemple #1
0
        }         //end main function

        static void getAllData(SqlConnection conn)
        {
            SteamWebAPI.SetGlobalKey("00E30769A6BA27CB7804374A82DBD737");

            //create steam identity
            SteamIdentity[] steamID = new SteamIdentity[] { SteamIdentity.FromSteamID(76561198047886273), //colin
                                                            SteamIdentity.FromSteamID(76561198065588383), //brenden
                                                            SteamIdentity.FromSteamID(76561198018133285), //john
                                                            SteamIdentity.FromSteamID(76561197983072534),
                                                            SteamIdentity.FromSteamID(76561197996591065),
                                                            SteamIdentity.FromSteamID(76561197999979429),
                                                            SteamIdentity.FromSteamID(76561198009844144) };
            populateGameTable(conn);
            foreach (var player in steamID)
            {
                populatePlayerTable(conn, player);
                populateGameOwnedTable(conn, player);
                populateAchievementTable(conn, player);
                populateAchievementOwnedTable(conn, player);
                populateFriendsHaveTable(conn, player);
            }

            //close sql connection and exit
            conn.Close();
            Console.WriteLine("press enter to exit");
            Console.ReadLine();
        }//end of getAllData
Exemple #2
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()));
        }
Exemple #3
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);
        }
Exemple #4
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            _RegisterConsumers();
            // Web API routes
            config.MapHttpAttributeRoutes();
            config.EnableCors(new EnableCorsAttribute("*", "*", "*"));


            SteamWebAPI.SetGlobalKey("5F88169B0962B766917B9766FE1B1372");
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
        }
Exemple #5
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);
        }
        public static void Init(long steamID)
        {
            WC = new WebClient()
            {
                Encoding = Encoding.UTF8
            };
            if (steamID == 0)
            {
                IsSteamProfile = false;
                return;
            }

            SteamWebAPI.SetGlobalKey(GlobalKey);
            SetSteamUser(steamID);

            var json         = WC.DownloadString($"https://api.steampowered.com/ISteamApps/GetAppList/v2?key={GlobalKey}&language=en-us&format=json");
            var parsedObject = JObject.Parse(json);

            AppList = JsonConvert.DeserializeObject <List <App> >(parsedObject["applist"]["apps"].ToString());
        }
Exemple #7
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);
        }
        private static void Main(string[] args)
        {
            SteamWebAPI.SetGlobalKey("put your key here");

            var steamIdQueue = new SteamIdQueue();
            var database     = new CSGOPlayerDatabase();
            var repository   = new DatabaseRepository(database);
            var scanner      = new PlayerScannerEngine(steamIdQueue, database);

            Export(repository); return;

            //ShowStats(repository);return;
            steamIdQueue.Push(76561198029142573);
            scanner.FindFriends(76561198029142573);
            var thread = new Thread(() =>
            {
                while (true)
                {
                    repository.Store();
                }
            });

            thread.Start();

            var thread2 = new Thread(() =>
            {
                while (true)
                {
                    scanner.FindAndLookupPlayers();
                }
            });

            thread2.Start();

            while (true)
            {
            }
        }
Exemple #9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     SteamWebAPI.SetGlobalKey(Resources.api);
 }
Exemple #10
0
 public SteamSerial()
 {
     SteamWebAPI.SetGlobalKey("0B7965E2A44CE9CA6D12923228DDCECC");
 }
Exemple #11
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();
        }
Exemple #12
0
        public static void Connect()
        {
            StreamReader steamapifile = File.OpenText("steamapi.txt");

            SteamWebAPI.SetGlobalKey(steamapifile.ReadToEnd());
        }
Exemple #13
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"));
        }