Exemple #1
0
 string GetRomoteString(string path)
 {
     try
     {
         CNNWebClient client = new CNNWebClient();
         client.Timeout = 5;
         return(client.DownloadString(path));
     }
     catch
     {
         errorString = "图片地址加载失败 =.=,没福利了";
     }
     return(null);
 }
Exemple #2
0
        public string GetClientSlidePath(string url)
        {
            string str = "";

            try
            {
                //string url = DNTRequest.GetString("url");
                CNNWebClient _WebClient = new CNNWebClient();
                //_WebClient.Timeout = 1;
                _WebClient.Encoding = System.Text.Encoding.UTF8;//定义对象语言

                str = _WebClient.DownloadString(url);
                return(str);
            }
            catch
            {
                return("-1");
            }
        }
Exemple #3
0
        //获取单支股票行情
        private void stockmarket_one(string stock, ref string stockdata)
        {
            string stockurl = "";

            CNNWebClient webClient = new CNNWebClient();    //通过WebClient方式去获取资源文件

            stock_appendurl(stock, ref stockurl, CfgStruct.marketlist_t, false);
            Uri uri = new Uri(stockurl, false);

            try
            {
                stockdata = webClient.DownloadString(uri);
            }
            catch (InvalidCastException e)
            {
                throw (e);
            }

            webClient.Dispose();
        }
Exemple #4
0
        //获取单支股票行情
        private void stockmarket_one(string stock, ref string stockdata)
        {
            string stockurl = "";

            CNNWebClient webClient = new CNNWebClient();    //通过WebClient方式去获取资源文件
            stock_appendurl(stock, ref stockurl, CfgStruct.marketlist_t,false);
            Uri uri = new Uri(stockurl, false);
            try
            {
                stockdata = webClient.DownloadString(uri);
            }
            catch(InvalidCastException e)
            {
                throw (e);
            }

            webClient.Dispose();
        }