Skip to content

Commit

Permalink
Fixed steamwebapi
Browse files Browse the repository at this point in the history
  • Loading branch information
sp0ok3r committed Nov 17, 2019
1 parent e594f6a commit e5fd498
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
6 changes: 5 additions & 1 deletion MercuryBOT/Games/SelectGames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
using MercuryBOT.UserSettings;
using Newtonsoft.Json;
using SteamWebAPI2.Interfaces;
using SteamWebAPI2.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Windows.Forms;
using Win32Interop.Methods;

Expand Down Expand Up @@ -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<PlayerService>(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());
Expand Down
11 changes: 9 additions & 2 deletions MercuryBOT/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -630,16 +633,20 @@ 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<SteamUser>(new HttpClient());

ProgressSpinner_FriendsList.Visible = true;
btn_loadFriends.Enabled = false;
BTN_RemoveFriend.Enabled = false;
FriendsList_Grid.Rows.Clear();
foreach (var f in AccountLogin.Friends)
{
DateTime playerSummaryData;

var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(f.ConvertToUInt64());

if (playerSummaryResponse != null)
{
playerSummaryData = playerSummaryResponse.Data.LastLoggedOffDate;
Expand Down
4 changes: 2 additions & 2 deletions MercuryBOT/MercuryBOT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
<HintPath>..\packages\SteamKit2.2.2.0\lib\netstandard2.0\SteamKit2.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SteamWebAPI2, Version=4.0.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamWebAPI2.4.0.8\lib\netstandard2.0\SteamWebAPI2.dll</HintPath>
<Reference Include="SteamWebAPI2, Version=4.0.9.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamWebAPI2.4.0.9\lib\netstandard2.0\SteamWebAPI2.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion MercuryBOT/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/";

Expand Down
2 changes: 1 addition & 1 deletion MercuryBOT/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<package id="protobuf-net" version="2.4.0" targetFramework="net461" />
<package id="Steam.Models" version="3.0.8" targetFramework="net461" />
<package id="SteamKit2" version="2.2.0" targetFramework="net461" />
<package id="SteamWebAPI2" version="4.0.8" targetFramework="net461" />
<package id="SteamWebAPI2" version="4.0.9" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
Expand Down

0 comments on commit e5fd498

Please sign in to comment.