コード例 #1
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);
        }
コード例 #2
0
 public TradeOffer(OfferSession session, SteamID partnerSteamdId)
 {
     Items               = new TradeStatus();
     IsOurOffer          = true;
     OfferState          = TradeOfferState.TradeOfferStateUnknown;
     this.Session        = session;
     this.PartnerSteamId = partnerSteamdId;
 }
コード例 #3
0
        public TradeOfferManager(string apiKey, SteamWeb steamWeb)
        {
            if (apiKey == null)
                throw new ArgumentNullException("apiKey");

            webApi = new TradeOfferWebAPI(apiKey, steamWeb);
            session = new OfferSession(webApi, steamWeb);
        }
コード例 #4
0
ファイル: TradeOffer.cs プロジェクト: Cimera42/SteamBot
        public TradeOffer(OfferSession session, Offer offer)
        {
            var myAssets           = new List <TradeStatusUser.TradeAsset>();
            var myMissingAssets    = new List <TradeStatusUser.TradeAsset>();
            var theirAssets        = new List <TradeStatusUser.TradeAsset>();
            var theirMissingAssets = new List <TradeStatusUser.TradeAsset>();

            if (offer.ItemsToGive != null)
            {
                foreach (var asset in offer.ItemsToGive)
                {
                    var tradeAsset = new TradeStatusUser.TradeAsset();
                    //todo: for currency items we need to check descriptions for currency bool and use the appropriate method
                    tradeAsset.CreateItemAsset(Convert.ToInt64(asset.AppId), Convert.ToInt64(asset.ContextId),
                                               Convert.ToInt64(asset.AssetId), Convert.ToInt64(asset.Amount));
                    //todo: for missing assets we should store them somewhere else? if offer state is active we shouldn't be here though
                    if (!asset.IsMissing)
                    {
                        myAssets.Add(tradeAsset);
                    }
                    else
                    {
                        myMissingAssets.Add(tradeAsset);
                    }
                }
            }
            if (offer.ItemsToReceive != null)
            {
                foreach (var asset in offer.ItemsToReceive)
                {
                    var tradeAsset = new TradeStatusUser.TradeAsset();
                    tradeAsset.CreateItemAsset(Convert.ToInt64(asset.AppId), Convert.ToInt64(asset.ContextId),
                                               Convert.ToInt64(asset.AssetId), Convert.ToInt64(asset.Amount));
                    if (!asset.IsMissing)
                    {
                        theirAssets.Add(tradeAsset);
                    }
                    else
                    {
                        theirMissingAssets.Add(tradeAsset);
                    }
                }
            }
            this.Session = session;
            //assume public individual
            PartnerSteamId = new SteamID(Convert.ToUInt32(offer.AccountIdOther), EUniverse.Public, EAccountType.Individual);
            TradeOfferId   = offer.TradeOfferId;
            OfferState     = offer.TradeOfferState;
            IsOurOffer     = offer.IsOurOffer;
            ExpirationTime = offer.ExpirationTime;
            TimeCreated    = offer.TimeCreated;
            TimeUpdated    = offer.TimeUpdated;
            TradeID        = offer.TradeID;
            Message        = offer.Message;
            Items          = new TradeStatus(myAssets, theirAssets);
        }
コード例 #5
0
        public TradeOfferManager(string apiKey, SteamWeb steamWeb)
        {
            if (apiKey == null)
            {
                throw new ArgumentNullException("apiKey");
            }

            webApi  = new TradeOfferWebAPI(apiKey, steamWeb);
            session = new OfferSession(webApi, steamWeb);
        }
コード例 #6
0
        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>();
        }
コード例 #7
0
        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>();
        }
コード例 #8
0
ファイル: TradeOfferManager.cs プロジェクト: jaymad/SteamBot
        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);
        }