This commit is contained in:
JustArchi
2019-03-03 16:00:54 +01:00
parent 4bc70b5bfe
commit 2e160b444a

View File

@@ -536,8 +536,8 @@ namespace ArchiSteamFarm {
[PublicAPI]
public async Task<HtmlDocument> UrlPostToHtmlDocumentWithSession(string host, string request, Dictionary<string, string> data = null, string referer = null, ESession session = ESession.Lowercase, bool checkSessionPreemptively = true, byte maxTries = WebBrowser.MaxTries) {
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request));
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request) || !Enum.IsDefined(typeof(ESession), session)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request) + " || " + nameof(session));
return null;
}
@@ -601,6 +601,10 @@ namespace ArchiSteamFarm {
case ESession.Lowercase:
sessionName = "sessionid";
break;
case ESession.PascalCase:
sessionName = "SessionID";
break;
default:
Bot.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(session), session));
@@ -644,8 +648,8 @@ namespace ArchiSteamFarm {
[PublicAPI]
public async Task<T> UrlPostToJsonObjectWithSession<T>(string host, string request, Dictionary<string, string> data = null, string referer = null, ESession session = ESession.Lowercase, bool checkSessionPreemptively = true, byte maxTries = WebBrowser.MaxTries) where T : class {
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request));
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request) || !Enum.IsDefined(typeof(ESession), session)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request) + " || " + nameof(session));
return null;
}
@@ -709,6 +713,10 @@ namespace ArchiSteamFarm {
case ESession.Lowercase:
sessionName = "sessionid";
break;
case ESession.PascalCase:
sessionName = "SessionID";
break;
default:
Bot.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(session), session));
@@ -752,8 +760,8 @@ namespace ArchiSteamFarm {
[PublicAPI]
public async Task<T> UrlPostToJsonObjectWithSession<T>(string host, string request, List<KeyValuePair<string, string>> data = null, string referer = null, ESession session = ESession.Lowercase, bool checkSessionPreemptively = true, byte maxTries = WebBrowser.MaxTries) where T : class {
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request));
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request) || !Enum.IsDefined(typeof(ESession), session)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request) + " || " + nameof(session));
return null;
}
@@ -817,6 +825,10 @@ namespace ArchiSteamFarm {
case ESession.Lowercase:
sessionName = "sessionid";
break;
case ESession.PascalCase:
sessionName = "SessionID";
break;
default:
Bot.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(session), session));
@@ -863,8 +875,8 @@ namespace ArchiSteamFarm {
[PublicAPI]
public async Task<bool> UrlPostWithSession(string host, string request, Dictionary<string, string> data = null, string referer = null, ESession session = ESession.Lowercase, bool checkSessionPreemptively = true, byte maxTries = WebBrowser.MaxTries) {
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request));
if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(request) || !Enum.IsDefined(typeof(ESession), session)) {
Bot.ArchiLogger.LogNullError(nameof(host) + " || " + nameof(request) + " || " + nameof(session));
return false;
}
@@ -928,6 +940,10 @@ namespace ArchiSteamFarm {
case ESession.Lowercase:
sessionName = "sessionid";
break;
case ESession.PascalCase:
sessionName = "SessionID";
break;
default:
Bot.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(session), session));
@@ -2655,7 +2671,8 @@ namespace ArchiSteamFarm {
public enum ESession : byte {
None,
Lowercase,
CamelCase
CamelCase,
PascalCase
}
private enum ESteamApiKeyState : byte {