国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#實現支持斷點續傳多線程下載客戶端工具類

2024-09-07 17:05:32
字體:
來源:轉載
供稿:網友
代碼如下:
/* .Net/C#: 實現支持斷點續傳多線程下載的 Http Web 客戶端工具類 (C# DIY HttpWebClient)
* Reflector 了一下 System.Net.WebClient ,改寫或增加了若干:
* DownLoad、Upload 相關方法!
* DownLoad 相關改動較大!
* 增加了 DataReceive、ExceptionOccurrs 事件!
* 了解服務器端與客戶端交互的 HTTP 協議參閱:
* 使文件下載的自定義連接支持 FlashGet 的斷點續傳多線程鏈接下載! JSP/Servlet 實現!
* http://blog.csdn.net/playyuer/archive/2004/08/02/58430.aspx
* 使文件下載的自定義連接支持 FlashGet 的斷點續傳多線程鏈接下載! C#/ASP.Net 實現!
* http://blog.csdn.net/playyuer/archive/2004/08/02/58281.aspx
*/
//2005-03-14 修訂:
/* .Net/C#: 實現支持斷點續傳多線程下載的工具類
* Reflector 了一下 System.Net.WebClient ,改寫或增加了若干:
* DownLoad、Upload 相關方法!
* 增加了 DataReceive、ExceptionOccurrs 事件
*/
namespace Microshaoft.Utils
{
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Security;
using System.Threading;
using System.Collections.Specialized;
/// <summary>
/// 記錄下載的字節位置
/// </summary>
public class DownLoadState
{
private string _FileName;
private string _AttachmentName;
private int _Position;
private string _RequestURL;
private string _ResponseURL;
private int _Length;
private byte[] _Data;
public string FileName
{
get
{
return _FileName;
}
}
public int Position
{
get
{
return _Position;
}
}
public int Length
{
get
{
return _Length;
}
}
public string AttachmentName
{
get
{
return _AttachmentName;
}
}
public string RequestURL
{
get
{
return _RequestURL;
}
}
public string ResponseURL
{
get
{
return _ResponseURL;
}
}
public byte[] Data
{
get
{
return _Data;
}
}
internal DownLoadState(string RequestURL, string ResponseURL, string FileName, string AttachmentName, int Position, int Length, byte[] Data)
{
this._FileName = FileName;
this._RequestURL = RequestURL;
this._ResponseURL = ResponseURL;
this._AttachmentName = AttachmentName;
this._Position = Position;
this._Data = Data;
this._Length = Length;
}
internal DownLoadState(string RequestURL, string ResponseURL, string FileName, string AttachmentName, int Position, int Length, ThreadCallbackHandler tch)
{
this._RequestURL = RequestURL;
this._ResponseURL = ResponseURL;
this._FileName = FileName;
this._AttachmentName = AttachmentName;
this._Position = Position;
this._Length = Length;
this._ThreadCallback = tch;
}
internal DownLoadState(string RequestURL, string ResponseURL, string FileName, string AttachmentName, int Position, int Length)
{
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 通河县| 滦南县| 沁水县| 宁夏| 惠州市| 泉州市| 合作市| 玉龙| 平顺县| 衡山县| 炉霍县| 平塘县| 衡东县| 木兰县| 大同县| 大兴区| 盈江县| 巴马| 南召县| 永济市| 瑞丽市| 明星| 城口县| 江阴市| 安康市| 故城县| 重庆市| 报价| 屏东县| 商水县| 西平县| 芜湖市| 辽中县| 陵川县| 天水市| 通许县| 富源县| 启东市| 兴宁市| 西平县| 新郑市|