zoukankan      html  css  js  c++  java
  • 图片下载(直接通过网站url 下载图片)

     /// <summary>
            /// 图片下载
            /// </summary>
            /// <param name="imageList"></param>
            /// <param name="FileDir"></param>
            /// <returns></returns>
            private bool DownloadImage(List<string> imageList, string FileDir)
            {
                bool result = true;
                try
                {
                    foreach (string str in imageList)
                    {

                        if (str.IsMatch("(jpg|gif|png)$"))
                        {
                            Uri uri = new Uri(str);
                            FileInfo fi = new FileInfo(FileDir + uri.AbsolutePath);
                            if (!fi.Directory.Exists)
                            {
                                fi.Directory.Create();
                            }
                            //http://i04.c.aliimg.com/img/ibank/2012/618/641/715146816_109741793.jpg
                            if (!fi.Exists)
                            {
                                System.Net.WebClient wc = new System.Net.WebClient();
                                wc.DownloadFile(str, fi.FullName);
                            }

                        }

                    }
                }
                catch
                {
                    result = false;

                }
                finally
                {

                }
                return result;
            }

  • 相关阅读:
    Linux C Socket编程原理及简单实例
    clock_gettime 用法
    Linux未来监控tracing框架——eBPF
    eBPF监控工具bcc系列五工具funccount
    【转】如何测量电源纹波?
    【转】在网页中运行VB6程序
    如何为互阻抗放大器电路选择具有足够带宽的运算放大器
    互阻放大器的稳定工作及其评估
    【原创】OPA857 TEST模式使用
    [转]What you need to know about transimpedance amplifiers – part 1
  • 原文地址:https://www.cnblogs.com/guozhe/p/2997560.html
Copyright © 2011-2022 走看看