private Image downloadmap(string src) { Image img = null; try { //strImgsvrUrl = "http://mt3.google.cn/vt/lyrs=t@126,r@139&hl=zh-CN&gl=cn&"; HttpProc.WebClient client = new HttpProc.WebClient(); Stream stream = client.DownloadData(strImgsvrUrl + src); byte[] buff = new byte[stream.Length]; stream.Read(buff, 0, (int)stream.Length); //byte[] buff = webClient.DownloadData(strImgsvrUrl + src); if (buff != null && buff.Length > 0) { img = Bitmap.FromStream(new MemoryStream(buff)); db.Set(new MapClass(mapType + src, buff)); db.Commit(); } } catch { } finally { } return img; }
private Image downloadmap(string src) { Image img = null; string url = "cookie=" + opt_authtoken + "&" + src; Uri strU = new Uri(strImgsvrUrl + src); try { //strImgsvrUrl = "http://khm1.google.cn/kh/v=80&"; //webClient = new System.Net.WebClient(); //byte[] buff = webClient.DownloadData(strImgsvrUrl + url); HttpProc.WebClient client = new HttpProc.WebClient(); Stream stream = client.DownloadData(strImgsvrUrl + url); byte[] buff = new byte[stream.Length]; stream.Read(buff, 0, (int)stream.Length); if (buff != null && buff.Length > 0) { img = Bitmap.FromStream(new MemoryStream(buff)); db.Set(new MapClass(mapType + src, buff)); db.Commit(); } } catch (Exception err) { } finally { } return(img); }
private Image downloadmap(string src) { Image img = null; try { //strImgsvrUrl = "http://mt3.google.cn/vt/lyrs=t@126,r@139&hl=zh-CN&gl=cn&"; HttpProc.WebClient client = new HttpProc.WebClient(); Stream stream = client.DownloadData(strImgsvrUrl + src); byte[] buff = new byte[stream.Length]; stream.Read(buff, 0, (int)stream.Length); //byte[] buff = webClient.DownloadData(strImgsvrUrl + src); if (buff != null && buff.Length > 0) { img = Bitmap.FromStream(new MemoryStream(buff)); db.Set(new MapClass(mapType + src, buff)); db.Commit(); } } catch { } finally { } return(img); }
private Image downloadmap(string src) { Image img = null; try { HttpProc.WebClient client = new HttpProc.WebClient(); Stream stream = client.DownloadData(strImgsvrUrl + src); byte[] buff = new byte[stream.Length]; stream.Read(buff, 0, (int)stream.Length); if (buff != null && buff.Length > 0) { img = Bitmap.FromStream(new MemoryStream(buff)); db.Set(new MapClass(mapType + src, buff)); db.Commit(); } //byte[] buff = webClient.DownloadData(strImgsvrUrl + src); //if (buff != null && buff.Length > 0) //{ // img = Bitmap.FromStream(new MemoryStream(buff)); // db.Set(new MapClass(mapType + src, buff)); //} } catch { }finally{} return(img); }
private Image downloadmap(string src) { Image img = null; try { HttpProc.WebClient client = new HttpProc.WebClient(); Stream stream = client.DownloadData(strImgsvrUrl + src); byte[] buff = new byte[stream.Length]; stream.Read(buff, 0, (int)stream.Length); if (buff != null && buff.Length > 0) { img = Bitmap.FromStream(new MemoryStream(buff)); db.Set(new MapClass(mapType + src, buff)); db.Commit(); } //byte[] buff = webClient.DownloadData(strImgsvrUrl + src); //if (buff != null && buff.Length > 0) //{ // img = Bitmap.FromStream(new MemoryStream(buff)); // db.Set(new MapClass(mapType + src, buff)); //} } catch { }finally{} return img; }