예제 #1
0
파일: HttpWebClient.cs 프로젝트: dydlegd/DT
    static void Main()
    {
        AppTest a = new AppTest();

        Microshaoft.Utils.HttpWebClient x = new Microshaoft.Utils.HttpWebClient();
        a._K = 10;
        //订阅 DataReceive 事件
        x.DataReceive += new Microshaoft.Utils.HttpWebClient.DataReceiveEventHandler(a.x_DataReceive);
        //订阅 ExceptionOccurrs 事件
        x.ExceptionOccurrs += new Microshaoft.Utils.HttpWebClient.ExceptionEventHandler(a.x_ExceptionOccurrs);
        x.ThreadProcessEnd += new Microshaoft.Utils.HttpWebClient.ThreadProcessEventHandler(a.x_ThreadProcessEnd);
        string F = "http://localhost/download/phpMyAdmin-2.6.1-pl2.zip";

        F    = "http://down6.flashget.com/flashget182cn.exe";
        a._F = F;
        string f = F.Substring(F.LastIndexOf("/") + 1);

        //(new System.Threading.Thread(new System.Threading.ThreadStart(new ThreadProcessState(F, @"E:temp" + f, 10, x).StartThreadProcess))).Start();
        x.DownloadFile(F, @"d:temp" + f, a._K);
        // x.DownloadFileChunk(F, @"E:temp" + f,15,34556);
        System.Console.ReadLine();
        // string uploadfile = "e:\test_local.rar";
        // string str = x.UploadFileEx("http://localhost/phpmyadmin/uploadaction.php", "POST", uploadfile, "file1");
        // System.Console.WriteLine(str);
        // System.Console.ReadLine();
    }
예제 #2
0
    static void Main()
    {
        AppTest a = new AppTest();

        Microshaoft.Utils.HttpWebClient x = new Microshaoft.Utils.HttpWebClient();

        //订阅 DataReceive 事件
        x.DataReceive += new Microshaoft.Utils.HttpWebClient.DataReceiveEventHandler(a.x_DataReceive);
        //订阅 ExceptionOccurrs 事件
        x.ExceptionOccurrs += new Microshaoft.Utils.HttpWebClient.ExceptionEventHandler(a.x_ExceptionOccurrs);

        string F = "http://localhost/download/phpMyAdmin-.6.-pl.zip";

        a._F = F;
        F    = "http://localhost/download/jdk-__0_0-windows-i86-p.aa.exe";
        //F = "http://localhost/download/ReSharper..exe";

        //F = "http://localhost/mywebapplications/WebApplication7/WebForm.aspx";
        //F = "http://*****:*****@"E:\temp\" + f, 0, x).StartThreadProcess))).Start();

        x.DownloadFile(F, @"E:\temp\temp\" + f, 0);
        // x.DownloadFileChunk(F, @"E:\temp\" + f,,6);

        System.Console.ReadLine();
        // Upload 测试
        // string uploadfile = "e:\\test_local.rar";
        // string str = x.UploadFileEx("http://localhost/phpmyadmin/uploadaction.php", "POST", uploadfile, "file");
        // System.Console.WriteLine(str);
        // System.Console.ReadLine();
    }
예제 #3
0
	static void Main()
	{
		AppTest a = new AppTest();
		Microshaoft.Utils.HttpWebClient x = new Microshaoft.Utils.HttpWebClient();

		//订阅 DataReceive 事件
		x.DataReceive += new Microshaoft.Utils.HttpWebClient.DataReceiveEventHandler(a.x_DataReceive);
		//订阅 ExceptionOccurrs 事件
		x.ExceptionOccurrs += new Microshaoft.Utils.HttpWebClient.ExceptionEventHandler(a.x_ExceptionOccurrs);

		string F = "http://localhost/download/phpMyAdmin-.6.-pl.zip";
		a._F = F;
		F = "http://localhost/download/jdk-__0_0-windows-i86-p.aa.exe";
		//F = "http://localhost/download/ReSharper..exe";

		//F = "http://localhost/mywebapplications/WebApplication7/WebForm.aspx";
		//F = "http://*****:*****@"E:\temp\" + f, 0, x).StartThreadProcess))).Start();

		x.DownloadFile(F, @"E:\temp\temp\" + f, 0);
		// x.DownloadFileChunk(F, @"E:\temp\" + f,,6);

		System.Console.ReadLine();
		// Upload 测试
		// string uploadfile = "e:\\test_local.rar";
		// string str = x.UploadFileEx("http://localhost/phpmyadmin/uploadaction.php", "POST", uploadfile, "file");
		// System.Console.WriteLine(str);
		// System.Console.ReadLine();
	}