Exemplo n.º 1
0
        static void Visit(StreamData Data)
        {
            Data.VisitRequestStream  = WebRequest.Create(Data.URL);
            Data.VisitResponseStream = Data.VisitRequestStream.GetResponse();

            Stream       streamResponse = Data.VisitResponseStream.GetResponseStream();
            StreamReader sreader        = new StreamReader(streamResponse);

            Data.Response = sreader.ReadToEnd();
            GetVisitContent(Data);


            streamResponse.Close();
            sreader.Close();
            Data.VisitResponseStream.Close();
        }
Exemplo n.º 2
0
        static void GetVisitContent(StreamData Data)
        {
            String       sString = "";
            HtmlDocument d       = new HtmlDocument();
            HtmlDocument doc     = (HtmlDocument)d;

            doc.write(Rstring);

            HtmlElementCollection L = doc.links;

            foreach (HtmlElement links in L)
            {
                sString += links.getAttribute("href", 0);
                sString += "/n";
            }
            return(sString);
        }
Exemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            StreamData Data = new StreamData();

            foreach (string link in Data.URLList)
            {
                Data.URL = link;
                SourceCode(Data);
                //Visit(Data);
                Write(Data);
            }
            Read(Data);
        }
Exemplo n.º 4
0
        static void Write(StreamData Data)
        {
            int x = Console.WindowWidth;

            Console.WriteLine(Data.Response);
            Console.WriteLine();
            Console.WriteLine();
            string outputBreak = "";

            for (int i = x; i > 0; i--)
            {
                outputBreak += "-";
            }
            Console.WriteLine(outputBreak);
            Console.WriteLine();
            Console.WriteLine();
        }
Exemplo n.º 5
0
        static void Res(StreamData Data)
        {
            Data.ResponseStream = (HttpWebResponse)Data.RequestStream.GetResponse();

            if (Data.ResponseStream.StatusCode == HttpStatusCode.OK)
            {
                Stream       receiveStream = Data.ResponseStream.GetResponseStream();
                StreamReader readStream    = null;

                if (Data.ResponseStream.CharacterSet == null)
                {
                    readStream = new StreamReader(receiveStream);
                }
                else
                {
                    readStream = new StreamReader(receiveStream, Encoding.GetEncoding(Data.ResponseStream.CharacterSet));
                }

                Data.Response = readStream.ReadToEnd();

                Data.ResponseStream.Close();
                readStream.Close();
            }
        }
Exemplo n.º 6
0
 static void Req(StreamData Data)
 {
     Data.RequestStream = (HttpWebRequest)WebRequest.Create(Data.URL);
 }
Exemplo n.º 7
0
 static void SourceCode(StreamData Data)
 {
     Req(Data);
     Res(Data);
 }
Exemplo n.º 8
0
 static void Read(StreamData Data)
 {
     Console.Read();
 }