资源简介
C# ftp多线程断点上传下载

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Collections;
using System.IO;
using System.xml;
namespace Common
{
public class AppUpdate
{
private string _updaterUrl;
public string UpdaterUrl
{
set { _updaterUrl = value; }
get { return this._updaterUrl; }
}
public void DownAutoUpdateFile(string downLoadPath)
{
if (!System.IO.Directory.Exists(downLoadPath))
System.IO.Directory.CreateDirectory(downLoadPath);
string serverxmlFile = downLoadPath + @“/UpdateList.xml“;
try
{
WebRequest request = WebRequest.Create(_updaterUrl);
WebResponse response = request.GetResponse();
if (response.ContentLength > 0)
{
WebClient client = new WebClient();
client.DownloadFile(this._updaterUrl serverxmlFile);
}
}
catch
{
return;
}
}
public int CheckForUpdate(string serverxmlFile string localxmlFile out Hashtable updateFileList)
{
updateFileList = new Hashtable();
if (!File.Exists(localxmlFile) || !File.Exists(serverxmlFile))
{
return -1;
}
xmlFiles serverxmlFiles = new xmlFiles(serverxmlFile);
xmlFiles localxmlFiles = new xmlFiles(localxmlFile);
xmlNodeList newNodeList = serverxmlFiles.GetNodeList(“AutoUpdater/Files“);
xmlNodeList oldNodeList = localxmlFiles.GetNodeList(“AutoUpdater/Files“);//5+1+a+s+p+x
int k = 0;
for (int i = 0; i < newNodeList.Count; i++)
{
string[] fileList = new string[3];
string newFileName = newNodeList.Item(i).Attributes[“Name“].Value.Trim();
string newVer = newNodeList.Item(i).Attributes[“Ver“].Value.Trim();
ArrayList oldFileAl = new ArrayList();
for (int j = 0; j < oldNodeList.Count; j++)
{
string oldFileName = oldNodeList.Item(j).Attributes[“Name“].Value.Trim();
string oldVer = oldNodeList.Item(j).Attributes[“Ver“].Value.Trim();
oldFileAl.Add(oldFileName);
oldFileAl.Add(oldVer);
}
int pos = oldFileAl.IndexOf(newFileName);
if (pos == -1)
{
fileList[0] = newFileName;
fileList[1] = newVer;
updateFileList.Add(k fileList);
k++;
}
else if (pos > -1 && newVer.CompareTo(oldFileAl[pos + 1].ToString()) > 0)
{
file
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3230 2008-03-22 14:02 Common\AppUpdate.cs
文件 11264 2010-08-30 09:24 Common\bin\Debug\Common.dll
文件 32256 2010-08-30 09:24 Common\bin\Debug\Common.pdb
文件 5632 2010-08-30 09:24 Common\bin\Debug\Model.dll
文件 19968 2010-08-30 09:24 Common\bin\Debug\Model.pdb
文件 10752 2008-03-29 09:21 Common\bin\Release\Common.dll
文件 38400 2008-03-29 09:21 Common\bin\Release\Common.pdb
文件 5632 2010-08-21 08:37 Common\bin\Release\Model.dll
文件 19968 2010-08-21 08:36 Common\bin\Release\Model.pdb
文件 3879 2008-03-25 15:31 Common\Comm.cs
文件 2949 2008-03-22 12:24 Common\Common.csproj
文件 4892 2008-03-22 10:31 Common\ExtractIcon.cs
文件 2922 2010-08-30 11:14 Common\obj\Debug\Common.csproj.FileListAbsolute.txt
文件 11264 2010-08-30 09:24 Common\obj\Debug\Common.dll
文件 32256 2010-08-30 09:24 Common\obj\Debug\Common.pdb
文件 6656 2008-03-25 17:02 Common\obj\Debug\Refactor\Common.dll
文件 3657 2010-08-30 11:14 Common\obj\Debug\ResolveAssemblyReference.cache
文件 1608 2008-03-25 15:13 Common\obj\Release\Common.csproj.FileListAbsolute.txt
文件 10752 2008-03-29 09:21 Common\obj\Release\Common.dll
文件 38400 2008-03-29 09:21 Common\obj\Release\Common.pdb
文件 6656 2010-08-18 22:35 Common\obj\Release\Refactor\Common.dll
文件 4755 2008-03-29 09:16 Common\obj\Release\ResolveAssemblyReference.cache
文件 1436 2008-03-11 16:27 Common\Properties\AssemblyInfo.cs
文件 1198 2008-03-16 09:36 Common\SerializeClass.cs
文件 1965 2008-03-25 15:31 Common\xm
文件 5632 2010-08-30 09:24 Model\bin\Debug\Model.dll
文件 19968 2010-08-30 09:24 Model\bin\Debug\Model.pdb
文件 5632 2010-08-21 08:37 Model\bin\Release\Model.dll
文件 19968 2010-08-21 08:36 Model\bin\Release\Model.pdb
文件 527 2008-03-25 17:03 Model\BookMark.cs
............此处省略290个文件信息
相关资源
- 操作系统 模拟的 欢迎下载 C#版
- FtpClient 组件和源码(c#)
- 萤石云摄像头自动截图以及FTP上传
- MES系统信息上传
- C#的Ftp客户端+服务端源码
- winform实时获取网卡网速全部源码,获
- ASP.Net文件上传管理源码
- c# winform ftp 文件
- asp.net 大文件上传(带进度条)
- ArcGIS MapServer 要素类
- 数据自动上传
- FTP上传 文件
- 基于webapi的PLC软件控制(softplc)
- MVC图片上传实例58438
- asp.net FileUpload 上传进度条
- 安卓和asp.net通过webservice上传图片到服
- C#多文件打包
- c# 生成 bt种子 文件 bt 源码
- C# 视频播放系统
- C# SFTP文件上传和,有进度条,增加多
- ASP.NET微信开发包括图文上传菜单上传
- 文件上传管理(C# .NET ASP 毕业设计)
- C#仿迅雷程序
- asp.net上传文件预览Excel\\Word\\PDF文件
- winform Ftp 上传小DEMO
- 基于C#的网上书店源码
- C# 通过WebService上传视频文件到服务器
- 迅雷引擎SDK
- 高仿百度文库源码(asp.net)
- 七牛云文件批量上传,C#
评论
共有 条评论