예제 #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;
 }
        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
        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
        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);
        }