Пример #1
0
        /// <summary>
        /// Removes an item by its itemid.
        /// </summary>
        /// <returns><c>false</c> the item was not found in the trade.</returns>
        public bool RemoveItem(ulong itemid, int appid, long contextid, int amount, bool iscurrency)
        {
            int?slot = GetItemSlot(itemid, appid, contextid, amount, iscurrency);

            if (!slot.HasValue)
            {
                return(false);
            }

            bool success;

            if (iscurrency)
            {
                success = RetryWebRequest(() => session.AddCurrencyWebCmd(itemid, 0, appid, contextid));
            }
            else
            {
                success = RetryWebRequest(() => session.RemoveItemWebCmd(itemid, slot.Value, appid, contextid, amount));
            }

            if (success)
            {
                steamMyOfferedItems.Remove(slot.Value);
            }

            return(success);
        }
Пример #2
0
        /// <summary>
        /// Removes an item by its itemid.
        /// </summary>
        /// <returns><c>false</c> the item was not found in the trade.</returns>
        public bool RemoveItem(ulong itemid, int appid = 440, long contextid = 2)
        {
            int?slot = GetItemSlot(itemid);

            if (!slot.HasValue)
            {
                return(false);
            }

            bool success = RetryWebRequest(() => session.RemoveItemWebCmd(itemid, slot.Value, appid, contextid));

            if (success)
            {
                myOfferedItemsLocalCopy.Remove(slot.Value);
            }

            return(success);
        }
Пример #3
0
        /// <summary>
        /// Removes an item by its itemid.
        /// </summary>
        /// <returns><c>false</c> the item was not found in the trade.</returns>
        public bool RemoveItem(ulong itemid)
        {
            int?slot = GetItemSlot(itemid);

            if (!slot.HasValue)
            {
                return(false);
            }

            bool ok = session.RemoveItemWebCmd(itemid, slot.Value);

            if (!ok)
            {
                throw new TradeException("The web command to remove the item failed.");
            }

            myOfferedItems.Remove(slot.Value);

            return(true);
        }