public static void openCache(IYahooDownloadStream downloadStream, string path) { using (System.IO.FileStream fs = File.Open(path, FileMode.Open)) { string sLine = ""; StreamReader objReader = new StreamReader(fs); while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null) { downloadStream.downloadStreamParser(sLine); } } } }
public static void download(IYahooDownloadStream downloadStream) { //sURL = "http://www.microsoft.com"; //sURL = "https://www.google.com"; string sURL = downloadStream.getURL(); WebRequest wrGETURL = WebRequest.Create(sURL); //WebProxy myProxy = new WebProxy("myproxy", 80); //myProxy.BypassProxyOnLocal = true; //wrGETURL.Proxy = WebProxy.GetDefaultProxy(); string sLine = ""; Stream objStream = wrGETURL.GetResponse().GetResponseStream(); StreamReader objReader = new StreamReader(objStream); while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null) { downloadStream.downloadStreamParser(sLine); } } }