mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge pull request #22 from justcool393/Indev
Fix Unhandled WebException
This commit is contained in:
commit
1c81b13741
1 changed files with 13 additions and 1 deletions
|
|
@ -79,7 +79,19 @@ namespace MinecraftClient
|
||||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||||
WebClient client = new WebClient();
|
WebClient client = new WebClient();
|
||||||
Console.Write("http://session.minecraft.net/game/joinserver.jsp?user=" + user + "&sessionId=" + sessionID + "&serverId=" + hash + " ... ");
|
Console.Write("http://session.minecraft.net/game/joinserver.jsp?user=" + user + "&sessionId=" + sessionID + "&serverId=" + hash + " ... ");
|
||||||
string result = client.DownloadString("http://session.minecraft.net/game/joinserver.jsp?user=" + user + "&sessionId=" + sessionID + "&serverId=" + hash);
|
string result;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = client.DownloadString("http://session.minecraft.net/game/joinserver.jsp?user=" + user + "&sessionId=" + sessionID + "&serverId=" + hash);
|
||||||
|
}
|
||||||
|
catch (WebException e)
|
||||||
|
{
|
||||||
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine("Error while connecting to session server: " + e.Message);
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Console.WriteLine(result);
|
Console.WriteLine(result);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
return (result == "OK");
|
return (result == "OK");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue