Exemplo n.º 1
0
        public void SearchTransactions(TransactionType transactionType)
        {
            if (HotItemController.CurrentApi.IsTransactionApiSupported)
            {
                var f = new TaskFactory();
                var t = f.StartNew(() =>
                {
                    //int count = 10;
                    //int offset = page * 10;
                    ScrapeHelper transactionScraper = new ScrapeHelper(HotItemController.Config.SessionKey)
                    {
                        TransactionType = transactionType
                    };
                    transactionScraper.Finished += new EventHandler <ScrapeFinishedEventArgs>(transactionScraper_Finished);

                    String uri = HotItemController.CurrentApi.UriTransaction(transactionType, 0, HotItemController.Config.TransactionLimit);

                    transactionScraper.CrawlString(uri, 0, 0, HotItemController.CurrentApi);
                });
            }
        }
        public void Search(int page, SearchFilters filters)
        {
            if (SearchFinished != null)
            {
                this.CurrentSearchFilters = filters;
                TaskFactory f = new TaskFactory();
                var t = f.StartNew(() =>
                {
                    int count = HotItemController.CurrentApi.ItemsPerPage;
                    int offset = (page) * HotItemController.CurrentApi.ItemsPerPage;

                    ScrapeHelper searchScraper = new ScrapeHelper(Config.SessionKey);
                    searchScraper.Finished += new EventHandler<DataProvider.Event.ScrapeFinishedEventArgs>(searchScraper_Finished);

                    string sortingMode = filters.SortingMode.ToString();
                    if (filters.SortingMode == SortingMode.none)
                    {
                        sortingMode = null;
                    }
                    IsSearchInProgress = true;
                    String uri = HotItemController.CurrentApi.UriSearch(
                        filters.QueryString, offset, count, filters.TypeId, filters.SubTypeId, filters.Rarity, filters.LevelMin, filters.LevelMax, sortingMode, filters.DescendingSorting); //h.UseSearchApi().Add("text", query).Add("offset", offset.ToString()).Add("count", count.ToString()).Generate();
                    searchScraper.CrawlString(uri, 0, filters.QueryString, HotItemController.CurrentApi);
                });
            }
        }
Exemplo n.º 3
0
 public virtual void Crawl()
 {
     DataId = DataId;
     using (var s = new ScrapeHelper(HotItemController.Config.SessionKey))
     {
         String uri = HotItemController.CurrentApi.UriListingItem(DataId); //new UriHelper().UseListingApi().AddId(DataId.ToString()).Generate();
         s.Finished -= new EventHandler<DataProvider.Event.ScrapeFinishedEventArgs>(s_Finished);
         s.Finished += new EventHandler<DataProvider.Event.ScrapeFinishedEventArgs>(s_Finished);
         s.CrawlString(uri, DataId, DataId, HotItemController.CurrentApi);
     }
 }
Exemplo n.º 4
0
 public virtual void BuildItem(bool force)
 {
     if (!ItemBuildDone || force)
     {
         using (var s = new ScrapeHelper(HotItemController.Config.SessionKey))
         {
             ItemBuildDone = true;
             String uri = HotItemController.CurrentApi.UriBuildItem(DataId); //new UriHelper().UseSearchApi().Add("ids", DataId.ToString()).Generate();
             s.Finished -= new EventHandler<DataProvider.Event.ScrapeFinishedEventArgs>(sSearch_Finished);
             s.Finished += new EventHandler<DataProvider.Event.ScrapeFinishedEventArgs>(sSearch_Finished);
             s.CrawlString(uri, DataId, DataId, HotItemController.CurrentApi);
         }
     }
 }
        public void SearchTransactions(TransactionType transactionType)
        {
            if (HotItemController.CurrentApi.IsTransactionApiSupported)
            {
                var f = new TaskFactory();
                var t = f.StartNew(() =>
                {
                    //int count = 10;
                    //int offset = page * 10;
                    ScrapeHelper transactionScraper = new ScrapeHelper(HotItemController.Config.SessionKey) { TransactionType = transactionType };
                    transactionScraper.Finished += new EventHandler<ScrapeFinishedEventArgs>(transactionScraper_Finished);

                    String uri = HotItemController.CurrentApi.UriTransaction(transactionType, 0, HotItemController.Config.TransactionLimit);

                    transactionScraper.CrawlString(uri, 0, 0, HotItemController.CurrentApi);
                });
            }
        }