Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ParserBash
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private string StringRepeat(char Ch, int Rep)
- {
- string Str = null;
- for(int i=0;i<Rep;i++)
- Str += Ch;
- return Str;
- }
- private void OnFormLoaded(object sender, EventArgs e)
- {
- WebRequest Request = WebRequest.Create(@"http://bash.org.ru/rss/");
- StreamReader StrReader = new StreamReader(Request.GetResponse().GetResponseStream(), Encoding.GetEncoding(1251));
- string text = StrReader.ReadToEnd();
- foreach(string str in text.Split(new string[] {"<item>", "</item>"}, StringSplitOptions.None))
- {
- if (str.Contains(@"http://bash.org.ru/quote/"))
- {
- richTextBox1.Text += str.Split(new string[] { "<title>", "</title>" }, StringSplitOptions.None)[1] + "\n\n" + str.Split(new string[] { "<![CDATA[", "]]>" }, StringSplitOptions.None)[1].Replace("<br>", "\n").Replace(""", "") + "\n" + StringRepeat('=',10) + "\n";
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment