public static List <String> GetAllFileName(String montherpath, String ext) { int nlenth = montherpath.Length; string urlstr = montherpath.Substring(4, nlenth - 4); string httpPath = MysqlService.getResPath(); string path = string.Format("{0}{1}", httpPath, urlstr); List <String> names = new List <string>(); WebPage page = new WebPage(path); foreach (Link lk in page.Links) { if (lk.Text.EndsWith(ext)) { names.Add(lk.Text); } } return(names); }
public static Image GetNetImage(string url) { int nlenth = url.Length; string urlstr = url.Substring(4, nlenth - 4); string httpPath = MysqlService.getResPath(); WebResponse response = null; Stream stream = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}{1}", httpPath, urlstr)); try { response = request.GetResponse(); stream = response.GetResponseStream(); } catch { return(Image.FromFile("icons/blank.jpg")); } return(new Bitmap(stream)); }
public static Stream GetNetStream(string url) { string httpPath = MysqlService.getResPath(); Stream stream = null; int nlenth = url.Length; string urlstr = url.Substring(4, nlenth - 4); try { WebResponse response = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}{1}", httpPath, urlstr)); response = request.GetResponse(); stream = response.GetResponseStream(); } catch { } return(stream); }