mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Revert to CMD icon on exit
Else CMD would still have the player head as icon
This commit is contained in:
parent
cb1edcb3b1
commit
47a3cdc783
2 changed files with 27 additions and 7 deletions
|
|
@ -26,13 +26,12 @@ namespace MinecraftClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public static void setPlayerIconAsync(string playerName)
|
public static void setPlayerIconAsync(string playerName)
|
||||||
{
|
|
||||||
Thread t = new Thread(new ThreadStart(delegate
|
|
||||||
{
|
{
|
||||||
if (!Program.isUsingMono) //Windows Only
|
if (!Program.isUsingMono) //Windows Only
|
||||||
|
{
|
||||||
|
Thread t = new Thread(new ThreadStart(delegate
|
||||||
{
|
{
|
||||||
HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create("http://skins.minecraft.net/MinecraftSkins/" + playerName + ".png");
|
HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create("http://skins.minecraft.net/MinecraftSkins/" + playerName + ".png");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse())
|
using (HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse())
|
||||||
|
|
@ -43,9 +42,12 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (WebException) //Skin not found? Reset to default icon
|
catch (WebException) //Skin not found? Reset to default icon
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SetConsoleIcon(Icon.ExtractAssociatedIcon(Application.ExecutablePath).Handle);
|
SetConsoleIcon(Icon.ExtractAssociatedIcon(Application.ExecutablePath).Handle);
|
||||||
}
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
@ -53,4 +55,21 @@ namespace MinecraftClient
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the icon back to the default CMD icon
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public static void revertToCMDIcon()
|
||||||
|
{
|
||||||
|
if (!Program.isUsingMono) //Windows Only
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetConsoleIcon(Icon.ExtractAssociatedIcon(Environment.SystemDirectory + "\\cmd.exe").Handle);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,7 @@ namespace MinecraftClient
|
||||||
private static void t_exit()
|
private static void t_exit()
|
||||||
{
|
{
|
||||||
if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); }
|
if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); }
|
||||||
|
if (Settings.playerHeadAsIcon) { ConsoleIcon.revertToCMDIcon(); }
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue