From e5fd49859a3c00e201e1b2727bfada2e1769f2b5 Mon Sep 17 00:00:00 2001 From: sp0ok3r Date: Sun, 17 Nov 2019 20:22:30 +0000 Subject: [PATCH] Fixed steamwebapi --- MercuryBOT/Games/SelectGames.cs | 6 +++++- MercuryBOT/Main.cs | 11 +++++++++-- MercuryBOT/MercuryBOT.csproj | 4 ++-- MercuryBOT/Program.cs | 2 +- MercuryBOT/packages.config | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/MercuryBOT/Games/SelectGames.cs b/MercuryBOT/Games/SelectGames.cs index d765c62..06108fc 100644 --- a/MercuryBOT/Games/SelectGames.cs +++ b/MercuryBOT/Games/SelectGames.cs @@ -12,6 +12,7 @@ using MercuryBOT.UserSettings; using Newtonsoft.Json; using SteamWebAPI2.Interfaces; +using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; @@ -19,6 +20,7 @@ using System.IO; using System.Linq; using System.Net; +using System.Net.Http; using System.Windows.Forms; using Win32Interop.Methods; @@ -74,9 +76,11 @@ private void SelectGames_Load(object sender, EventArgs e) public async void GET_ALL_GAMES() { + var webInterfaceFactory = new SteamWebInterfaceFactory(apikey); + var InterfacePlayerService = webInterfaceFactory.CreateSteamWebInterface(new HttpClient()); + WebClient wc = new WebClient(); - var InterfacePlayerService = new PlayerService(apikey); var OwnedGames = await InterfacePlayerService.GetOwnedGamesAsync(AccountLogin.CurrentSteamID, true, false); // check if correct progreeBar_GatherGames.Maximum = Int32.Parse(OwnedGames.Data.GameCount.ToString()); diff --git a/MercuryBOT/Main.cs b/MercuryBOT/Main.cs index 264b83e..86691d3 100644 --- a/MercuryBOT/Main.cs +++ b/MercuryBOT/Main.cs @@ -18,6 +18,8 @@ using MetroFramework.Controls; using Newtonsoft.Json; using Steam4NET; +using SteamWebAPI2.Interfaces; +using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; using System.Diagnostics; @@ -26,6 +28,7 @@ using System.Linq; using System.Media; using System.Net; +using System.Net.Http; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -630,8 +633,10 @@ private async void btn_loadFriends_Click(object sender, EventArgs e) Utils.gatherWebApiKey(); return; } - - var steamInterface = new SteamWebAPI2.Interfaces.SteamUser(apikey); + + var webInterfaceFactory = new SteamWebInterfaceFactory(apikey); + var steamInterface = webInterfaceFactory.CreateSteamWebInterface(new HttpClient()); + ProgressSpinner_FriendsList.Visible = true; btn_loadFriends.Enabled = false; BTN_RemoveFriend.Enabled = false; @@ -639,7 +644,9 @@ private async void btn_loadFriends_Click(object sender, EventArgs e) foreach (var f in AccountLogin.Friends) { DateTime playerSummaryData; + var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(f.ConvertToUInt64()); + if (playerSummaryResponse != null) { playerSummaryData = playerSummaryResponse.Data.LastLoggedOffDate; diff --git a/MercuryBOT/MercuryBOT.csproj b/MercuryBOT/MercuryBOT.csproj index 72949d5..d6f6f83 100644 --- a/MercuryBOT/MercuryBOT.csproj +++ b/MercuryBOT/MercuryBOT.csproj @@ -96,8 +96,8 @@ ..\packages\SteamKit2.2.2.0\lib\netstandard2.0\SteamKit2.dll True - - ..\packages\SteamWebAPI2.4.0.8\lib\netstandard2.0\SteamWebAPI2.dll + + ..\packages\SteamWebAPI2.4.0.9\lib\netstandard2.0\SteamWebAPI2.dll True diff --git a/MercuryBOT/Program.cs b/MercuryBOT/Program.cs index 0b4f565..0e38e1a 100644 --- a/MercuryBOT/Program.cs +++ b/MercuryBOT/Program.cs @@ -24,7 +24,7 @@ static class Program public static readonly Process[] CurrentProcesses = Process.GetProcesses(); public static readonly string BOTNAME = "MercuryBOT"; - public static readonly string Version = "4.0.0beta6.3b";//4.0.0 + public static readonly string Version = "4.0.0beta6.3c";//4.0.0 public static readonly string spkDomain = "http://sp0ok3r.tk/Mercury/"; diff --git a/MercuryBOT/packages.config b/MercuryBOT/packages.config index c5b237e..ecf41b7 100644 --- a/MercuryBOT/packages.config +++ b/MercuryBOT/packages.config @@ -15,7 +15,7 @@ - +