Ejemplo n.º 1
0
        public static ListingInfo FromListing(Listing listing, MeRequest.ListingType type)
        {
            ListingInfo info = new ListingInfo();

            switch (type)
            {
            case MeRequest.ListingType.BUY:
                info.Type = ListingInfo.ListingType.BUY;
                break;

            case MeRequest.ListingType.SELL:
                info.Type = ListingInfo.ListingType.SELL;
                break;

            default:
                break;
            }

            info.ListingId     = listing.ListingId;
            info.ItemId        = listing.DataId;
            info.ItemName      = listing.Name;
            info.ItemLevel     = listing.Level;
            info.ItemRarity    = SpidyData.GetRarityNameFromId(listing.Rarity);
            info.Quantity      = listing.Quantity;
            info.Price         = listing.UnitPrice;
            info.ListingTime   = listing.Created;
            info.FulfilledTime = listing.Purchased;

            return(info);
        }
Ejemplo n.º 2
0
        private static IDictionary <long, ListingInfo> resultsToListingDictionary(IList <MeResponse> results, MeRequest.ListingType type)
        {
            IDictionary <long, ListingInfo> listings = new Dictionary <long, ListingInfo>();

            foreach (MeResponse response in results)
            {
                foreach (Listing listing in response.Listings)
                {
                    ListingInfo info = ListingInfo.FromListing(listing, type);
                    listings[info.ListingId] = info;
                }
            }

            return(listings);
        }
Ejemplo n.º 3
0
        public static ListingInfo FromListing(Listing listing, MeRequest.ListingType type)
        {
            ListingInfo info = new ListingInfo();

            switch (type)
            {
                case MeRequest.ListingType.BUY:
                    info.Type = ListingInfo.ListingType.BUY;
                    break;
                case MeRequest.ListingType.SELL:
                    info.Type = ListingInfo.ListingType.SELL;
                    break;
                default:
                    break;
            }

            info.ListingId = listing.ListingId;
            info.ItemId = listing.DataId;
            info.ItemName = listing.Name;
            info.ItemLevel = listing.Level;
            info.ItemRarity = SpidyData.GetRarityNameFromId(listing.Rarity);
            info.Quantity = listing.Quantity;
            info.Price = listing.UnitPrice;
            info.ListingTime = listing.Created;
            info.FulfilledTime = listing.Purchased;

            return info;
        }