diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 7648c80aa..b536b531e 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -536,8 +536,8 @@ namespace ArchiSteamFarm { [PublicAPI] public async Task UrlPostToHtmlDocumentWithSession(string host, string request, Dictionary 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 UrlPostToJsonObjectWithSession(string host, string request, Dictionary 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 UrlPostToJsonObjectWithSession(string host, string request, List> 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 UrlPostWithSession(string host, string request, Dictionary 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 {