diff --git a/SteamBot/Bot.cs b/SteamBot/Bot.cs
index 2a371cad7..c797c1e54 100644
--- a/SteamBot/Bot.cs
+++ b/SteamBot/Bot.cs
@@ -134,6 +134,10 @@ public Inventory MyInventory
{
get
{
+ if (myInventoryTask == null)
+ {
+ GetInventory();
+ }
myInventoryTask.Wait();
return myInventoryTask.Result;
}
@@ -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);
}
}
}
diff --git a/SteamBot/ExampleBot.csproj b/SteamBot/ExampleBot.csproj
index f8c02e19b..4445c9a0c 100644
--- a/SteamBot/ExampleBot.csproj
+++ b/SteamBot/ExampleBot.csproj
@@ -39,21 +39,18 @@
true
-
- ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
- True
+
+ ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
False
..\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll
-
- ..\packages\SteamAuth.2.0.0\lib\net45\SteamAuth.dll
- True
+
+ ..\..\packages\SteamAuth.3.0.0\lib\net45\SteamAuth.dll
-
- ..\packages\SteamKit2.1.8.1\lib\net45\SteamKit2.dll
- True
+
+ ..\..\packages\SteamKit2.1.8.3\lib\net45\SteamKit2.dll
@@ -107,4 +104,4 @@
-
+
\ No newline at end of file
diff --git a/SteamBot/Program.cs b/SteamBot/Program.cs
index 6246ce039..cb85b2e0b 100644
--- a/SteamBot/Program.cs
+++ b/SteamBot/Program.cs
@@ -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();
diff --git a/SteamBot/app.config b/SteamBot/app.config
index 505627df2..b003b7f94 100644
--- a/SteamBot/app.config
+++ b/SteamBot/app.config
@@ -8,7 +8,7 @@
-
+
diff --git a/SteamBot/packages.config b/SteamBot/packages.config
index 2456b3bb8..799f35ac9 100644
--- a/SteamBot/packages.config
+++ b/SteamBot/packages.config
@@ -1,7 +1,7 @@
-
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/SteamTrade/GenericInventory.cs b/SteamTrade/GenericInventory.cs
index 9a346874c..a689ef2e5 100644
--- a/SteamTrade/GenericInventory.cs
+++ b/SteamTrade/GenericInventory.cs
@@ -26,9 +26,9 @@ public Dictionary items
{
get
{
- if (_loadTask == null)
+ if (LoadTask == null)
return null;
- _loadTask.Wait();
+ LoadTask.Wait();
return _items;
}
}
@@ -37,9 +37,9 @@ public Dictionary descriptions
{
get
{
- if (_loadTask == null)
+ if (LoadTask == null)
return null;
- _loadTask.Wait();
+ LoadTask.Wait();
return _descriptions;
}
}
@@ -48,16 +48,16 @@ public List 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 _descriptions = new Dictionary();
private Dictionary _items = new Dictionary();
private List _errors = new List();
@@ -113,9 +113,9 @@ public void debug_app_data()
///
public ItemDescription getDescription(ulong id)
{
- if (_loadTask == null)
+ if (LoadTask == null)
return null;
- _loadTask.Wait();
+ LoadTask.Wait();
try
{
@@ -130,7 +130,7 @@ public ItemDescription getDescription(ulong id)
public void load(int appid, IEnumerable contextIds, SteamID steamid)
{
List 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 contextIds, SteamID steamid)
@@ -171,7 +171,7 @@ public void loadImplementation(int appid, IEnumerable 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;
}
}
@@ -185,10 +185,10 @@ public void loadImplementation(int appid, IEnumerable 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();
- foreach(var value in class_instance.app_data)
+ foreach (var value in class_instance.app_data)
{
tmpAppData.Add("" + value.Name, "" + value.Value);
}
@@ -203,10 +203,12 @@ public void loadImplementation(int appid, IEnumerable 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),
}
@@ -221,11 +223,11 @@ public void loadImplementation(int appid, IEnumerable 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)
diff --git a/SteamTrade/SteamTrade.csproj b/SteamTrade/SteamTrade.csproj
index 52347259c..1876df77e 100644
--- a/SteamTrade/SteamTrade.csproj
+++ b/SteamTrade/SteamTrade.csproj
@@ -37,20 +37,17 @@
false
-
- ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
- True
+
+ ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
..\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll
-
- ..\packages\SteamAuth.2.0.0\lib\net45\SteamAuth.dll
- True
+
+ ..\..\packages\SteamAuth.3.0.0\lib\net45\SteamAuth.dll
-
- ..\packages\SteamKit2.1.8.1\lib\net45\SteamKit2.dll
- True
+
+ ..\..\packages\SteamKit2.1.8.3\lib\net45\SteamKit2.dll
@@ -82,4 +79,4 @@
-
+
\ No newline at end of file
diff --git a/SteamTrade/SteamWeb.cs b/SteamTrade/SteamWeb.cs
index 806a13038..76cf89b46 100644
--- a/SteamTrade/SteamWeb.cs
+++ b/SteamTrade/SteamWeb.cs
@@ -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;
@@ -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;
- }
-
- ///
- /// Get the Hex value as int out of an char.
- ///
- /// Input parameter.
- /// A Hex Value as int.
- 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();
}
///
diff --git a/SteamTrade/TradeWebAPI/TradeSession.cs b/SteamTrade/TradeWebAPI/TradeSession.cs
index e5255b69c..c7c9ac188 100644
--- a/SteamTrade/TradeWebAPI/TradeSession.cs
+++ b/SteamTrade/TradeWebAPI/TradeSession.cs
@@ -12,7 +12,7 @@ namespace SteamTrade.TradeWebAPI
///
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;
diff --git a/SteamTrade/app.config b/SteamTrade/app.config
index 05d974bf6..701f86759 100644
--- a/SteamTrade/app.config
+++ b/SteamTrade/app.config
@@ -4,7 +4,7 @@
-
+
diff --git a/SteamTrade/packages.config b/SteamTrade/packages.config
index 2456b3bb8..799f35ac9 100644
--- a/SteamTrade/packages.config
+++ b/SteamTrade/packages.config
@@ -1,7 +1,7 @@
-
+
-
-
-
+
+
+
\ No newline at end of file