public void addpage(string input, int pagedepth, Page previous) { if (input == "==Error occured==") return; if ((input.IndexOf("http://") == -1) && (input.IndexOf("https://") == -1)) { if (input[0] != '/') input=input.Insert(0, "/"); input=input.Insert(0, domain); } pages.Add(new Page(input, pagedepth, previous)); }
public Page(string input, int pagedepth, Page prev) { motherpage = prev; url = input; depth = pagedepth; try { WebRequest request = WebRequest.Create(url); WebResponse responce = request.GetResponse(); Stream data = responce.GetResponseStream(); StreamReader read = new StreamReader(data); content = read.ReadToEnd(); responce.Close(); data.Close(); read.Close(); request.Abort(); } catch { links.Add(new Link("==Error occured==")); return; } search(content); }