mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Player head icon fixes (#1049)
This commit is contained in:
parent
7d3e7f66f6
commit
d7b7ba85a4
2 changed files with 8 additions and 10 deletions
|
|
@ -330,7 +330,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); }
|
if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); }
|
||||||
if (offlinePrompt != null) { offlinePrompt.Abort(); offlinePrompt = null; ConsoleIO.Reset(); }
|
if (offlinePrompt != null) { offlinePrompt.Abort(); offlinePrompt = null; ConsoleIO.Reset(); }
|
||||||
if (Settings.playerHeadAsIcon) { ConsoleIcon.revertToCMDIcon(); }
|
if (Settings.playerHeadAsIcon) { ConsoleIcon.revertToMCCIcon(); }
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
})).Start();
|
})).Start();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ namespace MinecraftClient.WinAPI
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Bitmap skin = new Bitmap(Image.FromStream(httpWebReponse.GetResponseStream())); //Read skin from network
|
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
|
|
||||||
SetWindowIcon(Icon.FromHandle(skin.GetHicon())); // Windows 10+ (New console)
|
SetWindowIcon(Icon.FromHandle(skin.GetHicon())); // Windows 10+ (New console)
|
||||||
SetConsoleIcon(skin.GetHicon()); // Windows 8 and lower (Older console)
|
SetConsoleIcon(skin.GetHicon()); // Windows 8 and lower (Older console)
|
||||||
}
|
}
|
||||||
|
|
@ -65,11 +64,7 @@ namespace MinecraftClient.WinAPI
|
||||||
}
|
}
|
||||||
catch (WebException) //Skin not found? Reset to default icon
|
catch (WebException) //Skin not found? Reset to default icon
|
||||||
{
|
{
|
||||||
try
|
revertToMCCIcon();
|
||||||
{
|
|
||||||
SetConsoleIcon(Icon.ExtractAssociatedIcon(Application.ExecutablePath).Handle);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
@ -79,15 +74,18 @@ namespace MinecraftClient.WinAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the icon back to the default CMD icon
|
/// Set the icon back to the default MCC icon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void revertToCMDIcon()
|
public static void revertToMCCIcon()
|
||||||
{
|
{
|
||||||
if (!Program.isUsingMono) //Windows Only
|
if (!Program.isUsingMono) //Windows Only
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetConsoleIcon(Icon.ExtractAssociatedIcon(Environment.SystemDirectory + "\\cmd.exe").Handle);
|
//Icon defaultIcon = Icon.ExtractAssociatedIcon(Environment.SystemDirectory + "\\cmd.exe");
|
||||||
|
Icon defaultIcon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||||
|
SetWindowIcon(Icon.FromHandle(defaultIcon.Handle)); // Windows 10+ (New console)
|
||||||
|
SetConsoleIcon(defaultIcon.Handle); // Windows 8 and lower (Older console)
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue