diff --git a/ArchiSteamFarm.sln.DotSettings b/ArchiSteamFarm.sln.DotSettings
index 5066784fd..5e7032060 100644
--- a/ArchiSteamFarm.sln.DotSettings
+++ b/ArchiSteamFarm.sln.DotSettings
@@ -117,7 +117,7 @@
False
END_OF_LINE
1
- 0
+ 1
END_OF_LINE
TOGETHER_SAME_LINE
Tab
diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs
index 05b2d02ee..e3ec90a0f 100644
--- a/ArchiSteamFarm/ArchiHandler.cs
+++ b/ArchiSteamFarm/ArchiHandler.cs
@@ -336,6 +336,7 @@ namespace ArchiSteamFarm {
[SuppressMessage("ReSharper", "UnusedMember.Global")]
Unknown = 0,
Trading = 1,
+
// Only custom below, different than ones available as user_notification_type
Items = 254
}
diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs
index 7b33bb18b..43d552257 100644
--- a/ArchiSteamFarm/ArchiWebHandler.cs
+++ b/ArchiSteamFarm/ArchiWebHandler.cs
@@ -50,10 +50,12 @@ namespace ArchiSteamFarm {
// We must use HTTPS for SteamCommunity, as http would make certain POST requests failing (trades)
private const string SteamCommunityHost = "steamcommunity.com";
+
private const string SteamCommunityURL = "https://" + SteamCommunityHost;
// We could (and should) use HTTPS for SteamStore, but that would make certain POST requests failing
private const string SteamStoreHost = "store.steampowered.com";
+
private const string SteamStoreURL = "http://" + SteamStoreHost;
private static readonly SemaphoreSlim InventorySemaphore = new SemaphoreSlim(1);
@@ -177,7 +179,7 @@ namespace ArchiSteamFarm {
}
KeyValue response = null;
- for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) {
+ for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) {
await Task.Run(() => {
using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) {
iEconService.Timeout = Timeout;
@@ -196,7 +198,7 @@ namespace ArchiSteamFarm {
}
if (response == null) {
- Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries));
+ Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxTries));
}
}
@@ -228,7 +230,7 @@ namespace ArchiSteamFarm {
}
KeyValue response = null;
- for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) {
+ for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) {
await Task.Run(() => {
using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) {
iEconService.Timeout = Timeout;
@@ -249,7 +251,7 @@ namespace ArchiSteamFarm {
}
if (response == null) {
- Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries));
+ Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxTries));
return null;
}
@@ -625,7 +627,7 @@ namespace ArchiSteamFarm {
}
KeyValue response = null;
- for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) {
+ for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) {
await Task.Run(() => {
using (dynamic iPlayerService = WebAPI.GetInterface(IPlayerService, steamApiKey)) {
iPlayerService.Timeout = Timeout;
@@ -644,7 +646,7 @@ namespace ArchiSteamFarm {
}
if (response == null) {
- Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries));
+ Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxTries));
return null;
}
@@ -664,7 +666,7 @@ namespace ArchiSteamFarm {
internal async Task GetServerTime() {
KeyValue response = null;
- for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) {
+ for (byte i = 0; (i < WebBrowser.MaxTries) && (response == null); i++) {
await Task.Run(() => {
using (dynamic iTwoFactorService = WebAPI.GetInterface(ITwoFactorService)) {
iTwoFactorService.Timeout = Timeout;
@@ -685,7 +687,7 @@ namespace ArchiSteamFarm {
return response["server_time"].AsUnsignedInteger();
}
- Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries));
+ Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxTries));
return 0;
}
diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs
index 66f89c5a7..ea597f883 100755
--- a/ArchiSteamFarm/Bot.cs
+++ b/ArchiSteamFarm/Bot.cs
@@ -1276,7 +1276,7 @@ namespace ArchiSteamFarm {
// This is pretty rare, but SK2 SteamFriends handler and this handler could execute at the same time
// So we wait for nickname to be registered (with timeout of 5 tries/seconds)
string nickname = SteamFriends.GetPersonaName();
- for (byte i = 0; (i < WebBrowser.MaxRetries) && (string.IsNullOrEmpty(nickname) || nickname.Equals("[unassigned]")); i++) {
+ for (byte i = 0; (i < WebBrowser.MaxTries) && (string.IsNullOrEmpty(nickname) || nickname.Equals("[unassigned]")); i++) {
await Task.Delay(1000).ConfigureAwait(false);
nickname = SteamFriends.GetPersonaName();
}
diff --git a/ArchiSteamFarm/OS.cs b/ArchiSteamFarm/OS.cs
index 9a717272f..ff70df1e3 100644
--- a/ArchiSteamFarm/OS.cs
+++ b/ArchiSteamFarm/OS.cs
@@ -94,8 +94,6 @@ namespace ArchiSteamFarm {
internal enum EExecutionState : uint {
Error = 0,
SystemRequired = 0x00000001,
- //DisplayRequired = 0x00000002,
- //UserPresent = 0x00000004,
AwayModeRequired = 0x00000040,
Continuous = 0x80000000
}
diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs
index f1bf1784f..8f4c836be 100644
--- a/ArchiSteamFarm/Program.cs
+++ b/ArchiSteamFarm/Program.cs
@@ -330,12 +330,12 @@ namespace ArchiSteamFarm {
switch (GlobalConfig.OptimizationMode) {
case GlobalConfig.EOptimizationMode.MinMemoryUsage:
foreach (Task task in tasks) {
- await Task.WhenAny(task, Task.Delay(WebBrowser.MaxRetries * 1000)).ConfigureAwait(false);
+ await Task.WhenAny(task, Task.Delay(WebBrowser.MaxTries * 1000)).ConfigureAwait(false);
}
break;
default:
- await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(Bot.Bots.Count * WebBrowser.MaxRetries * 1000)).ConfigureAwait(false);
+ await Task.WhenAny(Task.WhenAll(tasks), Task.Delay(Bot.Bots.Count * WebBrowser.MaxTries * 1000)).ConfigureAwait(false);
break;
}
diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs
index 1ea3b2971..0b09307a8 100644
--- a/ArchiSteamFarm/Trading.cs
+++ b/ArchiSteamFarm/Trading.cs
@@ -32,7 +32,7 @@ using ArchiSteamFarm.Localization;
namespace ArchiSteamFarm {
internal sealed class Trading : IDisposable {
- internal const byte MaxItemsPerTrade = 150; // This is due to limit on POST size in WebBrowser
+ internal const byte MaxItemsPerTrade = byte.MaxValue; // This is due to limit on POST size in WebBrowser
internal const byte MaxTradesPerAccount = 5; // This is limit introduced by Valve
private readonly Bot Bot;
diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs
index 377a15bb2..3eef908ae 100644
--- a/ArchiSteamFarm/WebBrowser.cs
+++ b/ArchiSteamFarm/WebBrowser.cs
@@ -35,11 +35,11 @@ using Newtonsoft.Json.Linq;
namespace ArchiSteamFarm {
internal sealed class WebBrowser {
- internal const byte MaxRetries = 5; // Defines maximum number of retries, UrlRequest() does not handle retry by itself (it's app responsibility)
+ internal const byte MaxTries = 5; // Defines maximum number of recommended tries for a single request
- private const byte ExtendedTimeoutMultiplier = 10; // Multiplier for WebBrowsers dealing with huge data
- private const byte MaxConnections = ServicePointManager.DefaultNonPersistentConnectionLimit; // Defines maximum number of connections per ServicePoint. Be careful, as it also defines maximum number of sockets in CLOSE_WAIT state
- private const byte MaxIdleTime = 15; // In seconds, how long socket is allowed to stay in CLOSE_WAIT state after there are no connections to it
+ private const byte ExtendedTimeoutMultiplier = 10; // Defines multiplier of timeout for WebBrowsers dealing with huge data (ASF update)
+ private const byte MaxConnections = 10; // Defines maximum number of connections per ServicePoint. Be careful, as it also defines maximum number of sockets in CLOSE_WAIT state
+ private const byte MaxIdleTime = 15; // Defines in seconds, how long socket is allowed to stay in CLOSE_WAIT state after there are no connections to it
internal readonly CookieContainer CookieContainer = new CookieContainer();
@@ -95,7 +95,7 @@ namespace ArchiSteamFarm {
}
byte[] result = null;
- for (byte i = 0; (i < MaxRetries) && (result == null); i++) {
+ for (byte i = 0; (i < MaxTries) && (result == null); i++) {
result = await UrlGetToBytes(request, referer).ConfigureAwait(false);
}
@@ -103,7 +103,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -115,7 +115,7 @@ namespace ArchiSteamFarm {
}
HtmlDocument result = null;
- for (byte i = 0; (i < MaxRetries) && (result == null); i++) {
+ for (byte i = 0; (i < MaxTries) && (result == null); i++) {
result = await UrlGetToHtmlDocument(request, referer).ConfigureAwait(false);
}
@@ -123,7 +123,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -135,7 +135,7 @@ namespace ArchiSteamFarm {
}
JObject result = null;
- for (byte i = 0; (i < MaxRetries) && (result == null); i++) {
+ for (byte i = 0; (i < MaxTries) && (result == null); i++) {
result = await UrlGetToJObject(request, referer).ConfigureAwait(false);
}
@@ -143,7 +143,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -179,7 +179,7 @@ namespace ArchiSteamFarm {
}
XmlDocument result = null;
- for (byte i = 0; (i < MaxRetries) && (result == null); i++) {
+ for (byte i = 0; (i < MaxTries) && (result == null); i++) {
result = await UrlGetToXML(request, referer).ConfigureAwait(false);
}
@@ -187,7 +187,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -199,7 +199,7 @@ namespace ArchiSteamFarm {
}
bool result = false;
- for (byte i = 0; (i < MaxRetries) && !result; i++) {
+ for (byte i = 0; (i < MaxTries) && !result; i++) {
result = await UrlHead(request, referer).ConfigureAwait(false);
}
@@ -207,7 +207,7 @@ namespace ArchiSteamFarm {
return true;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return false;
}
@@ -219,7 +219,7 @@ namespace ArchiSteamFarm {
}
Uri result = null;
- for (byte i = 0; (i < MaxRetries) && (result == null); i++) {
+ for (byte i = 0; (i < MaxTries) && (result == null); i++) {
result = await UrlHeadToUri(request, referer).ConfigureAwait(false);
}
@@ -227,7 +227,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -250,7 +250,7 @@ namespace ArchiSteamFarm {
}
bool result = false;
- for (byte i = 0; (i < MaxRetries) && !result; i++) {
+ for (byte i = 0; (i < MaxTries) && !result; i++) {
result = await UrlPost(request, data, referer).ConfigureAwait(false);
}
@@ -258,7 +258,7 @@ namespace ArchiSteamFarm {
return true;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return false;
}
@@ -334,7 +334,7 @@ namespace ArchiSteamFarm {
}
string result = null;
- for (byte i = 0; (i < MaxRetries) && string.IsNullOrEmpty(result); i++) {
+ for (byte i = 0; (i < MaxTries) && string.IsNullOrEmpty(result); i++) {
result = await UrlGetToContent(request, referer).ConfigureAwait(false);
}
@@ -342,7 +342,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -466,7 +466,7 @@ namespace ArchiSteamFarm {
}
string result = null;
- for (byte i = 0; (i < MaxRetries) && string.IsNullOrEmpty(result); i++) {
+ for (byte i = 0; (i < MaxTries) && string.IsNullOrEmpty(result); i++) {
result = await UrlPostToContent(request, data, referer).ConfigureAwait(false);
}
@@ -474,7 +474,7 @@ namespace ArchiSteamFarm {
return result;
}
- ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries));
+ ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
return null;
}
@@ -488,7 +488,7 @@ namespace ArchiSteamFarm {
return null;
}
- private async Task UrlRequest(Uri requestUri, HttpMethod httpMethod, ICollection> data = null, string referer = null, byte maxRedirections = MaxRetries) {
+ private async Task UrlRequest(Uri requestUri, HttpMethod httpMethod, ICollection> data = null, string referer = null, byte maxRedirections = MaxTries) {
if ((requestUri == null) || (httpMethod == null)) {
ArchiLogger.LogNullError(nameof(requestUri) + " || " + nameof(httpMethod));
return null;