コード例 #1
0
        public void extractURLs()
        {
            try
            {
                myWebRequest  = WebRequest.Create(getUrl(urlList[index]));
                myWebResponse = myWebRequest.GetResponse();

                Stream responseStream = myWebResponse.GetResponseStream();

                StreamReader sreader = new StreamReader(responseStream);
                String       Rstring = sreader.ReadToEnd();
                var          tarif   = extractTarifFromHtml(Rstring, urlList[index]);

                if (tarif != null && !crud.exists(tarif))
                {
                    crud.AddNewTarif(tarif);
                    Console.WriteLine(tarif.ToString());
                }


                GetNewLinks(Rstring, urlList);
                myWebResponse.Close();
            }
            catch (Exception ex)
            {
                Console.Write("unhandled exception " + ex.Message);
            }
            if (urlList.Count > index + 1)
            {
                index++;
                // if (index <= tarifBreak)
                extractURLs();
            }
        }