91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 39KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-04
  • 語言: C#
  • 標簽:

資源簡介

Asp.net多線程下載示例源碼Asp.net多線程下載示例源碼

資源截圖

代碼片段和文件信息

using?System;
using?System.Data;
using?System.Configuration;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
using?System.Diagnostics;
using?AjaxPro;
using?System.Threading;
using?System.IO;
using?DownLoadComponent;


///?
///?Author:?[?ChengKing(ZhengJian)?]?
///?Blog:???Http://blog.csdn.net/ChengKing
//該源碼下載自www.51aspx.com(51aspx.com)
///?擴展如下功能:?
///???1.?解決一些線程相關的Bug;?
///???2.擴展用控制文件實現斷點續傳功能.
///?

public?partial?class?_Default?:?System.Web.UI.Page?
{????
????//全局變量
????private?static?object?_SyncLockobject?=?new?object();

????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????Utility.RegisterTypeForAjax(typeof(_Default));
????????this.TextBox1.Text?=?“http://download.csdn.net/filedown/aHR0cDovL2Rvd25sb2FkMS5jc2RuLm5ldC9kb3duMy8yMDA3MDQxOS8xOTE1NTU0NzgwMS5yYXI=!169105“;
????????
???????????}
????protected?void?btOK_Click(object?sender?EventArgs?e)
????{
????????this.Label1.Text?=?“狀態:?正在下載...“;
????????
????????DownLoadComponent.HttpWebClient?x?=?new?DownLoadComponent.HttpWebClient();

????????//注冊?DataReceive 事件
????????x.DataReceive?+=?new?DownLoadComponent.HttpWebClient.DataReceiveEventHandler(this.x_DataReceive);
????????//注冊?ExceptionOccurrs 事件
????????x.ExceptionOccurrs?+=?new?DownLoadComponent.HttpWebClient.ExceptionEventHandler(this.x_ExceptionOccurrs);

????????string?Source?=?this.TextBox1.Text.Trim();
????????string?FileName?=?Source.Substring(Source.LastIndexOf(“/“)?+?1);
????????string?Location=?System.IO.Path.Combine(?this.TextBox2.Text.Trim()??FileName);
????????
????????//F:?源服務器文件;??_f:?保存路徑;??10:?自設定一個文件有幾個線程下載.
????????x.DownloadFile(SourceLocation??int.Parse(this.TextBox3.Text));

????????//Response.Write(“正在下載文件...“);
????????this.btOK.Enabled?=?false;
????????this.btCancel.Enabled?=?true;
????}

????private?void?x_DataReceive(DownLoadComponent.HttpWebClient?Sender?DownLoadComponent.DownLoadEventArgs?e)
????{

????????string?f?=?e.DownloadState.FileName;
????????if?(e.DownloadState.AttachmentName?!=?null)
????????????f?=?System.IO.Path.GetDirectoryName(f)?+?@“\“?+?e.DownloadState.AttachmentName;???????
????????
????????using?(System.IO.FileStream?sw?=?new?System.IO.FileStream(f?System.IO.FileMode.OpenOrCreate?System.IO.FileAccess.ReadWrite?System.IO.FileShare.ReadWrite))
????????{
????????????sw.Position?=?e.DownloadState.Position;????????????????
????????????sw.Write(e.DownloadState.Data?0?e.DownloadState.Data.Length);?
????????????sw.Close();
????????}????????????
????}???

????private?void?x_ExceptionOccurrs(DownLoadComponent.HttpWebClient?Sender?DownLoadComponent.ExceptionEventArgs?e)
????{
????????System.Console.WriteLine(e.Exception.Message);
????????//發生異常重新下載相當于斷點續傳你可以自己自行選擇處理方式或自行處理
????????DownLoadComponent.HttpWebClient?x?=?new?DownLoadComponent.HttpWebClient();

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1809??2007-06-22?14:11??51aspx源碼必讀.txt

?????文件???????3766??2007-06-22?14:14??Default.aspx

?????文件???????6284??2007-06-22?14:14??Default.aspx.cs

?????文件???????1748??2007-05-30?19:45??Web.config

?????文件????????125??2007-03-27?14:33??最新Asp.Net源碼下載.url

?????文件??????38119??2007-06-22?14:15??App_Code\DownLoadState.cs

?????目錄??????????0??2007-06-22?11:46??App_Code

?????文件??????81920??2005-11-04?11:59??Bin\AjaxPro.dll

?????文件????????246??2007-05-30?18:56??Bin\AjaxPro.dll.refresh

?????目錄??????????0??2007-06-22?11:46??Bin

-----------?---------??----------?-----??----

???????????????134017????????????????????10


評論

共有 條評論

相關資源