All pastes #975822 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-07 20:15 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //string url = "http://www.wowhead.com/?item=";
            string url = "http://eu.wowarmory.com/item-info.xml?i=";
            //string url = "http://localhost/";

            WebClient client = new WebClient();
            client.Headers.Add("user-agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13");
            client.Headers.Add("Accept" , "text/html");

            string s = String.Empty;
            StreamWriter sw = new StreamWriter("itemlist.txt", true);

            for (int i = 0; i < 40000; i++)
            {
                Stream data = client.OpenRead(url+i);
                StreamReader reader = new StreamReader(data);
                s = reader.ReadToEnd();
                //if (s.Length > 13311)
                if (s.Length > 14000)
                {
                    sw.WriteLine(i);
                    sw.Flush();
                }
                Console.WriteLine(i+" - "+s.Length);
                data.Close();
                reader.Close();
            }
            sw.Flush();
            sw.Close();
        }
    }
}