Beispiel #1
0
        public static string GetTextFromUrlRetry(string Url, string UserAgent)
        {
            string Html = "";

            for (int i = 0, i2 = 10; i < i2; i++)
            {
                try
                {
                    Html = CNet.GetTextFromUrl(Url, UserAgent);
                    break;
                }
                catch (Exception)
                {
                    if ((i + 1) == i2)
                    {
                        throw new Exception("can't get Html");
                    }
                    else
                    {
                        Thread.Sleep(10000);
                    }
                }
            }

            return(Html);
        }
Beispiel #2
0
        public void SaveInternetFileToCache(string Url)
        {
            string FullPathTemp = CFile.GetTempFileName();
            CNet   Net          = new CNet();

            Net.DownloadFile(Url, FullPathTemp, true);

            if (this.mUseAdo)
            {
                SaveToCacheRs(Url, FullPathTemp);
            }
            else
            {
                SaveToCacheDt(Url, FullPathTemp);
            }
        }