示例#1
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;
            }
        }