public string DownloadString(Uri u) { var w = new StringBuilder(); try { var url = new java.net.URL(u.ToString()); var i = new java.io.InputStreamReader(url.openStream(), "UTF-8"); var reader = new java.io.BufferedReader(i); // can't we just read to the end? var line = reader.readLine(); while (line != null) { w.AppendLine(line); line = reader.readLine(); } reader.close(); } catch { // oops } return(w.ToString()); }
public override void run() { try { string s = NetLoginHandler.getServerId(loginHandler); var url = new URL( (new StringBuilder()).append("http://www.minecraft.net/game/checkserver.jsp?user="******"&serverId=").append(s).toString()); var bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); string s1 = bufferedreader.readLine(); bufferedreader.close(); if (s1.Equals("YES")) { NetLoginHandler.setLoginPacket(loginHandler, loginPacket); } else { loginHandler.kickUser("Failed to verify username!"); } } catch (Exception exception) { exception.printStackTrace(); } }
public static string ToWebString(this Uri u) { var w = new StringBuilder(); try { var url = new URL(u.ToString()); var i = new InputStreamReader(url.openStream()); var reader = new BufferedReader(i); var line = reader.readLine(); while (line != null) { w.AppendLine(line); line = reader.readLine(); } reader.close(); } catch { // oops } return w.ToString(); }
public string DownloadString(Uri u) { var w = new StringBuilder(); try { var url = new java.net.URL(u.ToString()); var i = new java.io.InputStreamReader(url.openStream(), "UTF-8"); var reader = new java.io.BufferedReader(i); // can't we just read to the end? var line = reader.readLine(); while (line != null) { w.AppendLine(line); line = reader.readLine(); } reader.close(); } catch { // oops } return w.ToString(); }