Common/DownLoad.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using  System.Net;  

using  System.IO;
using System.Text;
using System.Web;
public class download
{
    public download()
    {

    }
    /// <summary>

    /// 下载文件

    /// </summary>

    /// <param >要下载文件网址</param>

    public static void downloadfile(string URL)
    {
        
        WebClient client = new WebClient();

        int n = URL.LastIndexOf('/');

        string URLAddress = URL.Substring(0, n);  //取得网址

        string fileName = URL.Substring(n + 1, URL.Length - n - 1);  //取得文件名

        string Dir = HttpContext.Current.Server.MapPath("./");  //下载文件存放路径



        string Path = Dir + '\\' + fileName; //下载文件存放完整路径



        Stream stream = client.OpenRead(URL);



        StreamReader reader = new StreamReader(stream);

        byte[] mbyte = new byte[100000];

        int allbyte = (int)mbyte.Length;

        int startbyte = 0;

        while (allbyte > 0)  //循环读取
        {

            int m = stream.Read(mbyte, startbyte, allbyte);

            if (m == 0)

                break;


后面还有 19 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。