Get list of DLC function now checks if entered app is actually of type "game"

This commit is contained in:
Jeddunk 2021-01-04 12:27:48 +01:00
parent d71144b1d6
commit 721b5e8e7f
2 changed files with 74 additions and 50 deletions

View File

@ -100,8 +100,12 @@ namespace auto_creamapi.Services
var dlcList = new List<SteamApp>(); var dlcList = new List<SteamApp>();
if (steamApp != null) if (steamApp != null)
{ {
var task = AppDetails.GetAsync(steamApp.AppId); var steamAppDetails = await AppDetails.GetAsync(steamApp.AppId).ConfigureAwait(false);
var steamAppDetails = await task; if (steamAppDetails != null)
{
MyLogger.Log.Debug($"Type for Steam App {steamApp.Name}: \"{steamAppDetails.Type}\"");
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
{
steamAppDetails?.DLC.ForEach(x => steamAppDetails?.DLC.ForEach(x =>
{ {
var result = _cache.FirstOrDefault(y => y.AppId.Equals(x)) ?? var result = _cache.FirstOrDefault(y => y.AppId.Equals(x)) ??
@ -177,6 +181,16 @@ namespace auto_creamapi.Services
} }
} }
else else
{
MyLogger.Log.Error("Could not get DLC: Steam App is not of type: \"Game\"");
}
}
else
{
MyLogger.Log.Error("Could not get DLC...");
}
}
else
{ {
MyLogger.Log.Error("Could not get DLC: Invalid Steam App"); MyLogger.Log.Error("Could not get DLC: Invalid Steam App");
} }

View File

@ -5,6 +5,16 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>auto_creamapi</RootNamespace> <RootNamespace>auto_creamapi</RootNamespace>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<PackageVersion>2.1.3</PackageVersion>
<Title>auto-creamapi</Title>
<Authors>Jeddunk</Authors>
<Company>jeddunk.xyz</Company>
<AssemblyVersion>2.1.3</AssemblyVersion>
<FileVersion>2.1.3</FileVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>