First attempt at Realms list retrieval

> See #51 - Realms Support
+ Catch exception while retrieving player head
This commit is contained in:
ORelio 2015-11-27 16:52:41 +01:00
parent 6dd003d04c
commit 5654871a57
3 changed files with 65 additions and 19 deletions

View file

@ -36,9 +36,13 @@ namespace MinecraftClient
{
using (HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse())
{
Bitmap skin = new Bitmap(Image.FromStream(httpWebReponse.GetResponseStream())); //Read skin from network
skin = skin.Clone(new Rectangle(8, 8, 8, 8), skin.PixelFormat); //Crop skin
SetConsoleIcon(skin.GetHicon()); //Set skin as icon
try
{
Bitmap skin = new Bitmap(Image.FromStream(httpWebReponse.GetResponseStream())); //Read skin from network
skin = skin.Clone(new Rectangle(8, 8, 8, 8), skin.PixelFormat); //Crop skin
SetConsoleIcon(skin.GetHicon()); //Set skin as icon
}
catch (ArgumentException) { /* Invalid image in HTTP response */ }
}
}
catch (WebException) //Skin not found? Reset to default icon