This commit is contained in:
JustArchi
2016-06-30 18:13:22 +02:00
parent 686c0aaf8b
commit 831856cf15
2 changed files with 13 additions and 14 deletions

View File

@@ -64,7 +64,7 @@ namespace ArchiSteamFarm {
}
int index = hashName.IndexOf('-');
if (index < 1) {
if (index <= 0) {
return 0;
}
@@ -124,7 +124,7 @@ namespace ArchiSteamFarm {
SteamID = steamID;
string sessionID = Convert.ToBase64String(Encoding.UTF8.GetBytes(SteamID.ToString()));
string sessionID = Convert.ToBase64String(Encoding.UTF8.GetBytes(steamID.ToString()));
// Generate an AES session key
byte[] sessionKey = SteamKit2.CryptoHelper.GenerateRandomBlock(32);
@@ -151,7 +151,7 @@ namespace ArchiSteamFarm {
try {
authResult = iSteamUserAuth.AuthenticateUser(
steamid: SteamID,
steamid: steamID,
sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedSessionKey, 0, cryptedSessionKey.Length)),
encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedLoginKey, 0, cryptedLoginKey.Length)),
method: WebRequestMethods.Http.Post,
@@ -892,7 +892,6 @@ namespace ArchiSteamFarm {
}
string request = SteamCommunityURL + "/my/badges?l=english&p=" + page;
return await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);
}
@@ -907,7 +906,6 @@ namespace ArchiSteamFarm {
}
string request = SteamCommunityURL + "/my/gamecards/" + appID + "?l=english";
return await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);
}
@@ -917,7 +915,6 @@ namespace ArchiSteamFarm {
}
string request = SteamCommunityURL + "/my/inventory";
return await WebBrowser.UrlHeadRetry(request).ConfigureAwait(false);
}

View File

@@ -63,15 +63,17 @@ namespace ArchiSteamFarm.JSON {
set {
if (string.IsNullOrEmpty(value)) {
Logging.LogNullError(nameof(value));
return;
}
uint result;
if (!uint.TryParse(value, out result)) {
uint appID;
if (!uint.TryParse(value, out appID) || (appID == 0)) {
Logging.LogNullError(nameof(appID));
return;
}
AppID = result;
AppID = appID;
}
}
@@ -86,15 +88,17 @@ namespace ArchiSteamFarm.JSON {
set {
if (string.IsNullOrEmpty(value)) {
Logging.LogNullError(nameof(value));
return;
}
ulong result;
if (!ulong.TryParse(value, out result)) {
ulong contextID;
if (!ulong.TryParse(value, out contextID) || (contextID == 0)) {
Logging.LogNullError(nameof(contextID));
return;
}
ContextID = result;
ContextID = contextID;
}
}
@@ -212,7 +216,6 @@ namespace ArchiSteamFarm.JSON {
internal sealed class TradeOffer { // REF: https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#CEcon_TradeOffer
// Constructed from code
[SuppressMessage("ReSharper", "UnusedMember.Global")]
internal enum ETradeOfferState : byte {
Unknown,
@@ -230,7 +233,6 @@ namespace ArchiSteamFarm.JSON {
}
internal readonly ulong TradeOfferID;
internal readonly ETradeOfferState State;
internal readonly HashSet<Item> ItemsToGive = new HashSet<Item>();
internal readonly HashSet<Item> ItemsToReceive = new HashSet<Item>();