public TradeOfferManager(string apiKey, SteamWeb steamWeb)
        {
            if (apiKey == null)
                throw new ArgumentNullException("apiKey");

            webApi = new TradeOfferWebAPI(apiKey, steamWeb);
            session = new OfferSession(webApi, steamWeb);
        }
Example #2
0
 /// <summary>
 /// Constructor to initialize our variables
 /// </summary>
 /// <param name="_mobileHelper"></param>
 /// <param name="_botInfo"></param>
 /// <param name="_steamWeb"></param>
 /// <param name="_logger"></param>
 public TradeOfferHelperClass(MobileHelper _mobileHelper, BotInfo _botInfo, SteamWeb _steamWeb, Logger.Logger _logger)
 {
     m_mobileHelper     = _mobileHelper;
     m_tradeOfferWebAPI = new TradeOfferWebAPI(m_steamWeb, m_logger);
     m_botInfo          = _botInfo;
     m_steamWeb         = _steamWeb;
     m_logger           = _logger;
 }
Example #3
0
        public OfferSession(TradeOfferWebAPI webApi, SteamWeb steamWeb)
        {
            this.webApi = webApi;
            this.steamWeb = steamWeb;

            JsonSerializerSettings = new JsonSerializerSettings();
            JsonSerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.None;
            JsonSerializerSettings.Formatting = Formatting.None;
        }
        public TradeOfferManager(string apiKey, SteamWeb steamWeb)
        {
            if (apiKey == null)
                throw new ArgumentNullException("apiKey");

            LastTimeCheckedOffers = DateTime.MinValue;
            webApi = new TradeOfferWebAPI(apiKey, steamWeb);
            session = new OfferSession(webApi, steamWeb);
            unhandledTradeOfferUpdates = new Queue<Offer>();
        }
Example #5
0
        public OfferSession(string sessionId, string token, string tokensecure, TradeOfferWebAPI webApi)
        {
            Cookies.Add(new Cookie("sessionid", sessionId, String.Empty, "steamcommunity.com"));
            Cookies.Add(new Cookie("steamLogin", token, String.Empty, "steamcommunity.com"));
            Cookies.Add(new Cookie("steamLoginSecure", tokensecure, String.Empty, "steamcommunity.com"));

            SessionId = sessionId;
            SteamLogin = token;
            SteamLoginSecure = tokensecure;
            this.WebApi = webApi;

            JsonSerializerSettings = new JsonSerializerSettings();
            JsonSerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.None;
            JsonSerializerSettings.Formatting = Formatting.None;
        }
Example #6
0
        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);
        }
Example #7
0
        public TradeOfferManager(string apiKey, string sessionId, string token, string tokensecure)
        {
            if (apiKey == null)
                throw new ArgumentNullException("apiKey");

            if (sessionId == null)
                throw new ArgumentNullException("sessionId");

            if (token == null)
                throw new ArgumentNullException("token");

            if (tokensecure == null)
                throw new ArgumentNullException("tokensecure");

            this.apiKey = apiKey;
            this.sessionId = sessionId;
            this.token = token;
            this.tokensecure = tokensecure;

            webApi = new TradeOfferWebAPI(this.apiKey);
            session = new OfferSession(this.sessionId, this.token, this.tokensecure, webApi);
        }