private void PullFirmList()
        {
            if (Osb_UrlList != null)
            {
                try {
                    FirmService     firmService = null;
                    HtmlPageBuilder builder     = new HtmlPageFromWebBuilder();

                    Parallel.For(0, Osb_UrlList.Count, i =>
                    {
                        firmService = new FirmService(builder, Osb_UrlList[i].Url, Osb_UrlList[i].HtmlTag);

                        IEnumerable <Firm> enumerableFirms = firmService.getFirmList();
                        FirmList.AddRange(enumerableFirms);

                        Console.WriteLine("{0} adresinden bulunan firmalar listeye eklendi", Osb_UrlList[i].Url);
                    });
                }
                catch (Exception e) {
                    PrintConsole.LOG(e.StackTrace, e.Message);
                }
                finally {
                    Console.WriteLine("Bütün Web Adreslerinden Tarama İşlemi Sonlandı");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// hashTable Key = url , Value = tag , verilen hashtable'daki url ve taglar ile bulduğu firma listelerini birleştirerek geri döndürür.
        /// </summary>
        /// <param name="hashTable"></param>
        /// <returns></returns>
        public List <Firm> getFirmList(Hashtable hashTable)
        {
            builder = new HtmlPageFromWebBuilder();

            FirmAdapter adapter;

            List <Firm> firmList = new List <Firm>();

            foreach (DictionaryEntry item in hashTable)
            {
                path    = Convert.ToString(item.Key);
                HtmlTag = Convert.ToString(item.Value);
                LoadHtml();

                adapter = new FirmAdapter(HtmlDocument, HtmlTag);

                List <Firm> list = adapter.GetFirmList();

                foreach (var firma in list)
                {
                    firmList.Add(firma);
                }
            }
            return(firmList);
        }