예제 #1
0
 private Dictionary <int?, double?> GetAdjustedPrices()
 {
     return(ApiExtension.GetAll(index => new MarketApi().GetMarketsPricesAsyncWithHttpInfo()).Result.ToDictionary(x => x.TypeId, x => x.AdjustedPrice));
 }
예제 #2
0
        private async Task GetOrdersAsync(bool refreshCitadelData)
        {
            // var structureId = new SearchApi().GetCharactersCharacterIdSearchWithHttpInfo(new List<string>() { "structure" }, _charInfo.CharacterID, "1DQ");
            var filePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Resources\\onedq.json"));

            if (refreshCitadelData)
            {
                _allCitadelOrders =
                    new LazyAsync <List <GetMarketsStructuresStructureId200Ok> >(async() => await ApiExtension.GetAll(
                                                                                     index => _marketApi.GetMarketsStructuresStructureIdAsyncWithHttpInfo(1022734985679, page: index)));
                File.WriteAllText(filePath, JsonConvert.SerializeObject(await _allCitadelOrders.Value));
                return;
            }

            using (var file = File.OpenText(filePath))
            {
                var serializer = new JsonSerializer();

                _allCitadelOrders = new LazyAsync <List <GetMarketsStructuresStructureId200Ok> >(async() =>
                                                                                                 (List <GetMarketsStructuresStructureId200Ok>)serializer.Deserialize(file,
                                                                                                                                                                     typeof(List <GetMarketsStructuresStructureId200Ok>)));
                await _allCitadelOrders.Value;
            }
        }