/// <summary> /// Checks if sessionId and token cookies are still valid. /// Sets cookie flag if they are invalid. /// </summary> /// <returns>true if cookies are valid; otherwise false</returns> bool CheckCookies() { // We still haven't re-authenticated if (cookiesAreInvalid) { return(false); } try { if (!SteamWeb.VerifyCookies()) { // Cookies are no longer valid Log.Warn("Cookies are invalid. Need to re-authenticate."); cookiesAreInvalid = true; SteamUser.RequestWebAPIUserNonce(); return(false); } } catch { // Even if exception is caught, we should still continue. Log.Warn("Cookie check failed. http://steamcommunity.com is possibly down."); } return(true); }
public bool Autenticate() { web = new SteamWeb(); web.Authenticate(cookies); if (!web.VerifyCookies()) { return(false); } api = new TradeOfferWebAPI(apiKey, web); manager = new TradeOfferManager(apiKey, web); session = new OfferSession(api, web); SteamID = new SteamID(76561198043356049); TradeOfferCheckingLoop(); return(true); }
public static bool CheckCookies() { if (cookiesAreInvalid) { return(false); } try { if (!steamWeb.VerifyCookies()) { Console.WriteLine("[" + Program.BOTNAME + "] - Cookies are invalid. Need to re-authenticate."); cookiesAreInvalid = true; steamUser.RequestWebAPIUserNonce(); return(false); } } catch { Console.WriteLine("[" + Program.BOTNAME + "] - Cookie check failed. http://steamcommunity.com is possibly down."); } IsWebLoggedIn = true; return(true); }