コード例 #1
0
        static void Main()
        {
            AppTest       a = new AppTest();
            HttpWebClient x = new HttpWebClient();

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

            a._F = F;
            F    = "http://localhost/download/jdk-1_5_0_01-windows-i586-p.aa.exe";
            //F = "http://localhost/download/ReSharper1.5.exe";
            //F = "http://localhost/mywebapplications/WebApplication7/WebForm1.aspx";
            //F = "http://*****:*****@"E:\temp\" + f, 10, x).StartThreadProcess))).Start();
            x.DownloadFile(F, @"E:\temp\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();
            HttpWebClient x = new HttpWebClient();

            a._K = 10;
            //订阅 DataReceive 事件
            x.DataReceive += new HttpWebClient.DataReceiveEventHandler(a.x_DataReceive);
            //订阅 ExceptionOccurrs 事件
            x.ExceptionOccurrs += new HttpWebClient.ExceptionEventHandler(a.x_ExceptionOccurrs);
            x.ThreadProcessEnd += new HttpWebClient.ThreadProcessEventHandler(a.x_ThreadProcessEnd);
            string F = "http://localhost/download/phpMyAdmin-2.6.1-pl2.zip";
            a._F = F;
            F = "http://localhost/download/jdk-1_5_0_01-windows-i586-p.aa.exe";
            //F = "http://localhost/download/ReSharper1.5.exe";
            //F = "http://localhost/mywebapplications/WebApplication7/WebForm1.aspx";
            //F = "http://*****:*****@"E:\temp\" + f, 10, x).StartThreadProcess))).Start();
            x.DownloadFile(F, @"E:\temp\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();
        }