Exemplo n.º 1
0
        public static void GetPersonSummaries(Player[] nameNeeded, string param)
        {
            if (nameNeeded == null || nameNeeded.Length < 1)
            {
                return;
            }
            // string ids = "";

            string queryURL = App.GetPlayerSummariesURL + "?key=" + App.SteamAPIKey + "&steamids=" + param;
            string json     = APIConnection.GetHttpResponse(queryURL);

            JObject jObj = JObject.Parse(json);

            for (int i = 0; i < nameNeeded.Length; i++)
            {
                //  nameNeeded[i].PersonName = (string)jObj["response"]["players"][i]["personaname"];
                foreach (JToken token in jObj["response"]["players"].Children())
                {
                    string idInJson = token.Value <string>("steamid");
                    if (nameNeeded[i].SteamId == idInJson)
                    {
                        nameNeeded[i].PersonName = token.Value <string>("personaname");
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 调用该构造函数后就生成了已查询过的Players(Player[])
        /// </summary>
        /// <param name="url">以英文逗号,分隔的多个个人主页链接字符串</param>
        public BanCheck(string url)
        {
            PlayerPersonalURL = url;
            // string playerID = GetIDFromPersonalURL(PlayerPersonalURL);
            string apiRequestURL = "";
            // toCheck = new Player(playerID);
            string steamids = APIConnection.SpiltURLtoAPIParam(url);

            apiRequestURL = App.GetPlayerBansAPIURL + "?key=" + App.SteamAPIKey + "&steamids=" + steamids;

            playerCount = GetPlayerCountFromInputURL(url);

            // string jsonFile = GetHttpResponse(apiRequestURL);
            string jsonFile = APIConnection.GetHttpResponse(apiRequestURL);


            Players = GetMultiResults(playerCount, jsonFile);
            Player.GetPersonSummaries(Players, steamids);
        }