Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Various fixes #1139

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
99fad87
Merge branch 'Status6Fix'
BlueRaja Mar 31, 2015
9baf27c
Merge branch 'Jessecar96/master'
BlueRaja Apr 1, 2015
076107b
Merge branch 'Jessecar96/master'
BlueRaja Jan 23, 2016
025485f
Merge branch 'UseNugetSteamAuth'
BlueRaja Jan 23, 2016
d6e63a3
Merge remote-tracking branch 'remotes/igeligel/master'
BlueRaja Jan 23, 2016
78a740b
Merge branch 'AccessOfferUpdateWithSteamWebUpdates'
BlueRaja Jan 23, 2016
8f59df7
Merge branch 'UseNugetSteamAuth'
BlueRaja Jan 24, 2016
4af981c
Merge branch 'UseNugetSteamAuth'
BlueRaja Feb 14, 2016
081d586
Merge branch 'Jessecar96/master'
BlueRaja Apr 17, 2016
bfb3444
Merge branch 'Jessecar96/master'
BlueRaja Apr 30, 2016
c89fcf1
Merge remote-tracking branch 'remotes/fjch1997/SteamKitUpgrade'
BlueRaja Jan 8, 2017
f5c6a48
Merge branch 'Jessecar96/master'
BlueRaja Mar 5, 2017
5d568f4
Merge branch 'UpdateDependencies'
BlueRaja Mar 5, 2017
5a604d5
Merge branch 'GenericInventoryAdditions'
BlueRaja Mar 5, 2017
8e04629
Merge branch 'GenericInventoryAdditions'
BlueRaja Mar 5, 2017
4e88e33
Merge remote-tracking branch 'remotes/Jessecar96/master'
BlueRaja Aug 23, 2018
1413f1b
Fix crash when attempting to access inventory before calling GetInven…
BlueRaja Oct 7, 2018
c16778a
Updated version of SteamAuth
BlueRaja Oct 7, 2018
fb70038
Fixed a few crashes, made LoadTask public
BlueRaja Oct 7, 2018
eb13498
Updated SteamAuth again
BlueRaja Oct 7, 2018
7a73d77
Merge remote-tracking branch 'remotes/Jessecar96/master'
BlueRaja Oct 7, 2018
42892d5
Default to 2FA in example program
BlueRaja Oct 7, 2018
96498f8
Update package versions
BlueRaja Oct 8, 2018
3631b8b
Small cleanup
BlueRaja Oct 8, 2018
3ab4c19
BUGFIX: Use https when fetching confirmations
BlueRaja Oct 8, 2018
990167b
Accept upper+lower case hex digits
BlueRaja Dec 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion SteamBot/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public Inventory MyInventory
{
get
{
if (myInventoryTask == null)
{
GetInventory();
}
myInventoryTask.Wait();
return myInventoryTask.Result;
}
Expand Down Expand Up @@ -809,7 +813,7 @@ public void AcceptAllMobileTradeConfirmations()
{
if (SteamGuardAccount.AcceptConfirmation(confirmation))
{
Log.Success("Confirmed {0}. (Confirmation ID #{1})", confirmation.Description, confirmation.ID);
Log.Success("Confirmed {0}. (Confirmation ID #{1})", confirmation.Key, confirmation.ID);
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions SteamBot/ExampleBot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,18 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="protobuf-net, Version=2.0.0.668, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="SteamAuth, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamAuth.2.0.0\lib\net45\SteamAuth.dll</HintPath>
<Private>True</Private>
<Reference Include="SteamAuth, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SteamAuth.3.0.0\lib\net45\SteamAuth.dll</HintPath>
</Reference>
<Reference Include="SteamKit2, Version=1.8.1.0, Culture=neutral, PublicKeyToken=ed3ce47ed5aad940, processorArchitecture=MSIL">
<HintPath>..\packages\SteamKit2.1.8.1\lib\net45\SteamKit2.dll</HintPath>
<Private>True</Private>
<Reference Include="SteamKit2, Version=1.8.3.0, Culture=neutral, PublicKeyToken=ed3ce47ed5aad940, processorArchitecture=MSIL">
<HintPath>..\..\packages\SteamKit2.1.8.3\lib\net45\SteamKit2.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
Expand Down Expand Up @@ -107,4 +104,4 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion SteamBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static void BotMode(int botIndex)
return;
}

Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true, true);
Console.Title = "Bot Manager";
b.StartBot();

Expand Down
2 changes: 1 addition & 1 deletion SteamBot/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="11.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
8 changes: 4 additions & 4 deletions SteamBot/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="protobuf-net" version="2.0.0.668" targetFramework="net451" />
<package id="SteamAuth" version="2.0.0" targetFramework="net45" />
<package id="SteamKit2" version="1.8.1" targetFramework="net45" />
</packages>
<package id="SteamAuth" version="3.0.0" targetFramework="net45" />
<package id="SteamKit2" version="1.8.3" targetFramework="net45" />
</packages>
40 changes: 21 additions & 19 deletions SteamTrade/GenericInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public Dictionary<ulong, Item> items
{
get
{
if (_loadTask == null)
if (LoadTask == null)
return null;
_loadTask.Wait();
LoadTask.Wait();
return _items;
}
}
Expand All @@ -37,9 +37,9 @@ public Dictionary<string, ItemDescription> descriptions
{
get
{
if (_loadTask == null)
if (LoadTask == null)
return null;
_loadTask.Wait();
LoadTask.Wait();
return _descriptions;
}
}
Expand All @@ -48,16 +48,16 @@ public List<string> errors
{
get
{
if (_loadTask == null)
if (LoadTask == null)
return null;
_loadTask.Wait();
LoadTask.Wait();
return _errors;
}
}

public bool isLoaded = false;

private Task _loadTask;
public Task LoadTask { get; private set; }
private Dictionary<string, ItemDescription> _descriptions = new Dictionary<string, ItemDescription>();
private Dictionary<ulong, Item> _items = new Dictionary<ulong, Item>();
private List<string> _errors = new List<string>();
Expand Down Expand Up @@ -113,9 +113,9 @@ public void debug_app_data()
/// </summary>
public ItemDescription getDescription(ulong id)
{
if (_loadTask == null)
if (LoadTask == null)
return null;
_loadTask.Wait();
LoadTask.Wait();

try
{
Expand All @@ -130,7 +130,7 @@ public ItemDescription getDescription(ulong id)
public void load(int appid, IEnumerable<long> contextIds, SteamID steamid)
{
List<long> contextIdsCopy = contextIds.ToList();
_loadTask = Task.Factory.StartNew(() => loadImplementation(appid, contextIdsCopy, steamid));
LoadTask = Task.Factory.StartNew(() => loadImplementation(appid, contextIdsCopy, steamid));
}

public void loadImplementation(int appid, IEnumerable<long> contextIds, SteamID steamid)
Expand Down Expand Up @@ -171,7 +171,7 @@ public void loadImplementation(int appid, IEnumerable<long> contextIds, SteamID
if (!_items.ContainsKey(id))
{
string descriptionid = itemId.classid + "_" + itemId.instanceid;
_items.Add((ulong)itemId.id, new Item(appid, contextId, (ulong)itemId.id, descriptionid));
_items.Add((ulong) itemId.id, new Item(appid, contextId, (ulong) itemId.id, descriptionid));
break;
}
}
Expand All @@ -185,10 +185,10 @@ public void loadImplementation(int appid, IEnumerable<long> contextIds, SteamID
string key = "" + (class_instance.classid ?? '0') + "_" + (class_instance.instanceid ?? '0');
if (!_descriptions.ContainsKey(key))
{
if(class_instance.app_data != null)
if (class_instance.app_data != null)
{
tmpAppData = new Dictionary<string, string>();
foreach(var value in class_instance.app_data)
foreach (var value in class_instance.app_data)
{
tmpAppData.Add("" + value.Name, "" + value.Value);
}
Expand All @@ -203,10 +203,12 @@ public void loadImplementation(int appid, IEnumerable<long> contextIds, SteamID
{
name = class_instance.name,
type = class_instance.type,
marketable = (bool)class_instance.marketable,
tradable = (bool)class_instance.tradable,
classid = long.Parse((string)class_instance.classid),
url = (class_instance.actions != null && class_instance.actions.First["link"] != null ? class_instance.actions.First["link"] : ""),
marketable = (bool) class_instance.marketable,
tradable = (bool) class_instance.tradable,
classid = String.IsNullOrEmpty((string)class_instance.classid) ? -1 : long.Parse((string) class_instance.classid),
url = (class_instance.actions != null && class_instance.actions.First["link"] != null
? class_instance.actions.First["link"]
: ""),
app_data = tmpAppData,
market_fee_app_id = (class_instance.market_fee_app != null ? class_instance.market_fee_app : 0),
}
Expand All @@ -221,11 +223,11 @@ public void loadImplementation(int appid, IEnumerable<long> contextIds, SteamID
{
moreStart = invResponse.more_start;
}
catch (Exception e)
catch (Exception)
{
moreStart = null;
}
} while (!String.IsNullOrEmpty(moreStart) && moreStart.ToLower() != "false");
} while (!String.IsNullOrEmpty(moreStart) && moreStart.ToLower() != "false" && moreStart != "0");
}//end for (contextId)
}//end try
catch (Exception e)
Expand Down
17 changes: 7 additions & 10 deletions SteamTrade/SteamTrade.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,17 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="protobuf-net">
<HintPath>..\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll</HintPath>
</Reference>
<Reference Include="SteamAuth, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SteamAuth.2.0.0\lib\net45\SteamAuth.dll</HintPath>
<Private>True</Private>
<Reference Include="SteamAuth, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SteamAuth.3.0.0\lib\net45\SteamAuth.dll</HintPath>
</Reference>
<Reference Include="SteamKit2, Version=1.8.1.0, Culture=neutral, PublicKeyToken=ed3ce47ed5aad940, processorArchitecture=MSIL">
<HintPath>..\packages\SteamKit2.1.8.1\lib\net45\SteamKit2.dll</HintPath>
<Private>True</Private>
<Reference Include="SteamKit2, Version=1.8.3.0, Culture=neutral, PublicKeyToken=ed3ce47ed5aad940, processorArchitecture=MSIL">
<HintPath>..\..\packages\SteamKit2.1.8.3\lib\net45\SteamKit2.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -82,4 +79,4 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</Project>
</Project>
24 changes: 4 additions & 20 deletions SteamTrade/SteamWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Net.Cache;
using System.Text;
Expand Down Expand Up @@ -464,26 +465,9 @@ private byte[] HexToByte(string hex)
throw new Exception("The binary key cannot have an odd number of digits");
}

byte[] arr = new byte[hex.Length >> 1];
int l = hex.Length;

for (int i = 0; i < (l >> 1); ++i)
{
arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1])));
}

return arr;
}

/// <summary>
/// Get the Hex value as int out of an char.
/// </summary>
/// <param name="hex">Input parameter.</param>
/// <returns>A Hex Value as int.</returns>
private int GetHexVal(char hex)
{
int val = hex;
return val - (val < 58 ? 48 : 55);
return Enumerable.Range(0, hex.Length / 2)
.Select(x => Convert.ToByte(hex.Substring(x*2, 2), 16))
.ToArray();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion SteamTrade/TradeWebAPI/TradeSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SteamTrade.TradeWebAPI
/// </summary>
public class TradeSession
{
private const string SteamTradeUrl = "http://steamcommunity.com/trade/{0}/";
private const string SteamTradeUrl = "https://steamcommunity.com/trade/{0}/";

private string sessionIdEsc;
private string baseTradeURL;
Expand Down
2 changes: 1 addition & 1 deletion SteamTrade/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="11.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
8 changes: 4 additions & 4 deletions SteamTrade/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="protobuf-net" version="2.0.0.668" targetFramework="net451" />
<package id="SteamAuth" version="2.0.0" targetFramework="net45" />
<package id="SteamKit2" version="1.8.1" targetFramework="net45" />
</packages>
<package id="SteamAuth" version="3.0.0" targetFramework="net45" />
<package id="SteamKit2" version="1.8.3" targetFramework="net45" />
</packages>