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);
                });
            }
        }
        private void ThreadRunProcessVerifier()
        {
            try
            {
                GuildWars2Status = Notifier.GuildWars2Status.NotRunning;

                while (IsRunning)
                {
                    if (_scraper == null)
                    {
                        _scraper = new ScrapeHelper(Config.SessionKey);
                    }
                    _scraper.EatCookie(Config.SessionKey);
                    if (_scraper.VerifyKey())
                    {
                        CurrentApi = tradingPostApi;
                        GuildWars2Status = Notifier.GuildWars2Status.FoundKey;
                        IsSessionKeyValid = true;
                        break;
                    }
                    else
                    {
                        CheckGuildWars2Process();
                        if (_keyHelper == null)
                        {
                            _keyHelper = new SessionKeyReader.KeyHelper();
                        }

                        if (GuildWars2Running && !_keyHelper.Running)
                        {
                            GuildWars2Status = Notifier.GuildWars2Status.SearchingKey;
                            _keyHelper.UriFound -= new EventHandler<SessionKeyReader.UriFoundEventArgs>(keyHelper_UriFound);
                            _keyHelper.UriFound += new EventHandler<SessionKeyReader.UriFoundEventArgs>(keyHelper_UriFound);
                            _keyHelper.FindKey();
                        }
                    }
                    Thread.Sleep(10000);
                }
            }
            catch (ThreadInterruptedException)
            {
                IsRunning = false;
            }
        }
Пример #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<Crawler.Event.ScrapeFinishedEventArgs>(s_Finished);
         s.Finished += new EventHandler<Crawler.Event.ScrapeFinishedEventArgs>(s_Finished);
         s.CrawlString(uri, DataId, DataId, 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<Crawler.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);
                });
            }
        }
Пример #5
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<Crawler.Event.ScrapeFinishedEventArgs>(sSearch_Finished);
             s.Finished += new EventHandler<Crawler.Event.ScrapeFinishedEventArgs>(sSearch_Finished);
             s.CrawlString(uri, DataId, DataId, HotItemController.CurrentApi);
         }
     }
 }