public async Task GetActualDataAsync()
        {
            _logger.LogInformation("Start integration session with Steam API");
            var steamWebInterfaceFactory = new SteamWebInterfaceFactory(_steamApiKey);
            var steamApps = steamWebInterfaceFactory.CreateSteamWebInterface <SteamApps>();

            var ids = _appDBContext.IntegrationInfos
                      .Where(ii => ii.ExternalSystemDescriptor.Equals(ExternalSystemDescriptor))
                      .Select(ii => ii.ExternalGameId);

            var listResponse = await steamApps.GetAppListAsync();

            var appInfoList = listResponse.Data.Where(a => !ids.Any(id => id == a.AppId));

            var appsCountStr    = Startup.Configuration["IntegrationSettings:SteamIntegrationSettings:MaxPacketSize"];
            var appsCount       = 0;
            var isMaxSizeExists = false;

            if (appsCountStr != null)
            {
                appsCount       = Convert.ToInt32(appsCountStr);
                isMaxSizeExists = true;
            }
            var steamStoreInterface = steamWebInterfaceFactory.CreateSteamStoreInterface();
            var lang = "russian";

            foreach (var app in appInfoList)
            {
                StoreAppDetailsDataModel appDetails = null;
                try
                {
                    appDetails = await steamStoreInterface.GetStoreAppDetailsAsync(app.AppId, lang);
                }
                catch (NullReferenceException)
                {
                    _logger.LogError("Не удалось получить информацию о приложении {0}({1})", app.Name, app.AppId);
                    continue;
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "Произошла непредвиденная ошибка: ");
                    continue;
                }
                // Skip DLC
                if (appDetails.Type.Equals("game"))
                {
                    AppDetails.Add(appDetails);
                    if (isMaxSizeExists && AppDetails.Count >= appsCount)
                    {
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        private async void LoadApp()
        {
            _appStoreInfo = await _applicationData.GetAppInfoAsync(_appId);

            if (_appStoreInfo == null)
            {
                ApplicationConstants.MessageAppNotAvailable();
                return;
            }

            LoadTextAppData();

            Show();
        }