下载资源到本地源码,将html下载到本地 CyberWinApp-SAAS 本地化及未来之窗行业应用跨平台架构

一离线本地的好处

**以下是对上述内容的归纳总结**:

网页下载到本地,犹如为您的网络世界开启了一扇神奇之门。

它的优点令人瞩目:
其一,访问速度似闪电,瞬间呈现精彩内容,让您告别漫长等待,就像在信息高速公路上驾驶着超级跑车,一路畅行无阻。
其二,摆脱网络束缚,不受网络状况干扰,仿佛拥有了专属的时空隧道,无论外界环境如何变幻,都能稳定前行。
其三,在上千万客户端访问时,为服务器大幅“瘦身”,降低 90%的压力,好似为负重累累的巨人卸下了沉重的包袱,使其轻松应对汹涌的访问浪潮。
其四,由于离线到本地,可以实现客户端差异化,相同行业能依照不同需求运行不同规则,做到千人千面。好比一场盛大的舞会,每个人都能根据自己的喜好和节奏翩翩起舞。

例如,当网络拥堵时,别人还在艰难踱步,您却能凭借本地下载的网页飞速驰骋;服务器不再像不堪重负的老牛,而是能轻装上阵,高效运转;而不同需求的用户,也能在这场网络盛宴中,找到属于自己的独特舞台,展现个性风采。 

二、差异化加载

要实现根据客户端差异加载,就得在架构中放入下载模块代码

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;
        
using System.Windows.Forms;     
using System.IO;      
//
using System.Text.RegularExpressions;
        
//using CardIO;
using System.Net;
       
namespace CyberPHP_Dynamic
{
    class APP
    {
         
     public string start(NameValueCollection obj){
        
         NameValueCollection d=obj;

	// OpenFileDialog op = new OpenFileDialog();
           // if (op.ShowDialog() == DialogResult.OK)
          //  {
                System.IO.Directory.CreateDirectory("D:/网络任务/");
                StreamReader sr = new StreamReader("D:/网络任务/xz.csv", Encoding.Default);
                String line;
                while ((line = sr.ReadLine()) != null)
                {
                    Console.WriteLine(line.ToString());
                    // textBox2.Text = textBox2.Text + line.ToString() + "分行";
                    string all_d = line.ToString();
                    string[] all_da = all_d.Split(',');

                    try
                    {
                        string url = all_da[3];



                        string savep = "D:/网络任务/" + all_da[0] + "_" + all_da[1] + "_" + all_da[2] + ".jpg";
                        try
                        {
                            HttpDownloadFile(url, savep);
                        }
                        catch (Exception ex)
                        {
                            CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinOutput.Log.Cyber_Logger.write_log("网路任务", "下载失败", savep);
                        }
                    }
                    catch (Exception ex)
                    {
                        CyberWin.CSHARP.YNWLZC.WebFrame.CyberPHP.CyberWinOutput.Log.Cyber_Logger.write_log("网路任务", "数据残缺", all_d);
                    }
                }
          //  }
       
          
		 
		 
        
         string ret = "";
         return ret;//"身份证读取";
     }
       /// <summary>
        /// Http下载文件
        /// </summary>
        public static string HttpDownloadFile(string url, string path)
        {
            // 设置参数
            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            //发送请求并获取相应回应数据
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            //直到request.GetResponse()程序才开始向目标网页发送Post请求
            Stream responseStream = response.GetResponseStream();
            //创建本地文件写入流
            Stream stream = new FileStream(path, FileMode.Create);
            byte[] bArr = new byte[1024];
            int size = responseStream.Read(bArr, 0, (int)bArr.Length);
            while (size > 0)
            {
                stream.Write(bArr, 0, size);
                size = responseStream.Read(bArr, 0, (int)bArr.Length);
            }
            stream.Close();
            responseStream.Close();
            return path;
        }
	 
 
             
     }
}

有了下载模块技术,那么在不同客户端,不用用户就可以加载不同模块

  • 9
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值