获得指定的UML的源文件

来源:互联网 发布:神探夏洛克第五季 知乎 编辑:程序博客网 时间:2024/05/20 23:59
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;

namespace GetWebSourceCode
{
    class Program
    {
        static void Main(string[] args)
        {
            string remoteUML;
            System.Console.WriteLine("Please Input UML:");
            remoteUML ="http://"+ System.Console.ReadLine();
           
            //Build WebClient Instance
            WebClient myWebClient = new WebClient();
            //Download Page Data
            System.Console.WriteLine("Download Page Data By :{0}",remoteUML);
            //Download Data Save Buffer
            try
            {
                byte[] myDataBuffer = myWebClient.DownloadData(remoteUML);
                //Print Webpage Source Code
                string myCode = Encoding.UTF8.GetString(myDataBuffer);
                System.Console.Write(myCode);
            }
            catch (Exception e)
            {

                System.Console.WriteLine("DownLoad faild from {0}" + e.Message.ToString(), remoteUML);
            }
            finally
            {
                System.Console.ReadKey();
            }
        }
    }
}
 
原创粉丝点击