Pushok

Bash parser

May 13th, 2011
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1.     private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
  2.                  try
  3.                  {
  4.                      WebRequest^ Request = WebRequest::Create("http://bash.org.ru/rss/");
  5.                      WebResponse^ Response = Request->GetResponse();
  6.                      Stream^ S = Response->GetResponseStream();
  7.                      StreamReader^ sr = gcnew StreamReader(S, Encoding::GetEncoding(1251));
  8.  
  9.                      for each(String^ s in sr->ReadToEnd()->Split(gcnew array<String^>(2) {"<item>", "</item>"}, StringSplitOptions::None))
  10.                      {
  11.                          if(s->Contains("http://bash.org.ru/quote/"))
  12.                          {
  13.                              String^ str = nullptr;
  14.                              str = s->Split(gcnew array<String^>(2){"<title>", "</title>"}, StringSplitOptions::None)[1] + "\n\n" + s->Split(gcnew array<String^>(2){ "<![CDATA[", "]]>" }, StringSplitOptions::None)[1]->Replace("<br>", "\n")->Replace("&quot", "") + "\n============\n";
  15.                              richTextBox1->Text += str;
  16.                          }
  17.                      }
  18.  
  19.  
  20.  
  21.                  }
  22.  
  23.                  catch(...)
  24.                  {
  25.                  }
  26.              }
Advertisement
Add Comment
Please, Sign In to add comment