Пример #1
0
        public PricingService()
        {
            WebClient webClient = new WebClient();
            string    json      = webClient.DownloadString("https://tenno.zone/data/");
            var       data      = TennoZoneData.FromJson(json);

            foreach (var part in data.Parts)
            {
                var itemPrice = new ItemPrice {
                    Name = part.Name, DucatsPrice = part.Ducats ?? 0
                };

                var price = data.Prices.FirstOrDefault(x => x.PartId == part.Id);
                if (price != null)
                {
                    itemPrice.PlatinumPrice = price.PriceInfo.Median;
                    itemPrices.Add(part.Name, itemPrice);
                }
            }
        }
Пример #2
0
 public static string ToJson(this TennoZoneData self) => JsonConvert.SerializeObject(self, Converter.Settings);