Ejemplo n.º 1
0
        public ExpectedTankValues GetExpectedTankValues()
        {
            var result = new ExpectedTankValues();

            using (var webClient = new WebClient())
            {
                var json = webClient.DownloadString(Url);
                JObject jobject = JObject.Parse(json);

                result.Version = (int)jobject["header"]["version"];

                var data = (JArray)jobject["data"];
                foreach (JObject dataEntry in data.Children())
                {
                    var idNum = (int)dataEntry["IDNum"];
                    var expFrag = (double)dataEntry["expFrag"];
                    var expDamage = (double)dataEntry["expDamage"];
                    var expSpot = (double)dataEntry["expSpot"];
                    var expDef = (double)dataEntry["expDef"];
                    var expWinRate = (double)dataEntry["expWinRate"];

                    result.Values.Add(new ExpectedTankValue()
                    {
                        IDNum = idNum,
                        expDamage = expDamage,
                        expDef = expDef,
                        expFrag = expFrag,
                        expSpot = expSpot,
                        expWinRate = expWinRate
                    });
                }
            }

            return result;
        }