From af015ca56553efafb2e98e629e614f0beeb7c5d3 Mon Sep 17 00:00:00 2001 From: Josef Nemec Date: Fri, 19 Oct 2018 17:23:01 +0200 Subject: [PATCH] Fix: Metadata download not working properly for Steam games --- .../SteamLibrary/Services/SteamApiClient.cs | 52 ++++++++----------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/source/Plugins/SteamLibrary/Services/SteamApiClient.cs b/source/Plugins/SteamLibrary/Services/SteamApiClient.cs index 24fc4d28b..983fc0dee 100644 --- a/source/Plugins/SteamLibrary/Services/SteamApiClient.cs +++ b/source/Plugins/SteamLibrary/Services/SteamApiClient.cs @@ -141,9 +141,30 @@ public void Logout() public async Task GetProductInfo(uint id) { - if (IsLoggedIn == false) + if (!IsConnected) { - throw new Exception("Steam not loggin in."); + var connect = await Connect(); + if (connect != EResult.OK) + { + connect = await Connect(); + if (connect != EResult.OK) + { + throw new Exception("Failed to connect to Steam " + connect); + } + } + + isConnected = true; + } + + if (!IsLoggedIn) + { + var logon = await Login(); + if (logon != EResult.OK) + { + throw new Exception("Failed to logon to Steam " + logon); + } + + isLoggedIn = true; } try @@ -174,32 +195,5 @@ public async Task GetProductInfo(uint id) throw new Exception("Failed to get product info for app " + id + ". " + e.Message); } } - - public async Task GetProductInfo(int id) - { - if (!IsConnected) - { - var connect = await Connect(); - if (connect != EResult.OK) - { - connect = await Connect(); - if (connect != EResult.OK) - { - throw new Exception("Failed to connect to Steam " + connect); - } - } - } - - if (!IsLoggedIn) - { - var logon = await Login(); - if (logon != EResult.OK) - { - throw new Exception("Failed to logon to Steam " + logon); - } - } - - return await GetProductInfo(Convert.ToUInt32(id)); - } } }