mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Fix warnings
This commit is contained in:
parent
b6bfecc622
commit
e81700bf0e
5 changed files with 28 additions and 39 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Intrinsics;
|
||||
|
|
@ -63,16 +63,16 @@ namespace MinecraftClient.Crypto
|
|||
|
||||
keys[0] = Unsafe.ReadUnaligned<Vector128<byte>>(ref key[0]);
|
||||
|
||||
MakeRoundKey(keys, 1, 0x01);
|
||||
MakeRoundKey(keys, 2, 0x02);
|
||||
MakeRoundKey(keys, 3, 0x04);
|
||||
MakeRoundKey(keys, 4, 0x08);
|
||||
MakeRoundKey(keys, 5, 0x10);
|
||||
MakeRoundKey(keys, 6, 0x20);
|
||||
MakeRoundKey(keys, 7, 0x40);
|
||||
MakeRoundKey(keys, 8, 0x80);
|
||||
MakeRoundKey(keys, 9, 0x1b);
|
||||
MakeRoundKey(keys, 10, 0x36);
|
||||
ExpandRound(keys, 1, Aes.KeygenAssist(keys[0], 0x01));
|
||||
ExpandRound(keys, 2, Aes.KeygenAssist(keys[1], 0x02));
|
||||
ExpandRound(keys, 3, Aes.KeygenAssist(keys[2], 0x04));
|
||||
ExpandRound(keys, 4, Aes.KeygenAssist(keys[3], 0x08));
|
||||
ExpandRound(keys, 5, Aes.KeygenAssist(keys[4], 0x10));
|
||||
ExpandRound(keys, 6, Aes.KeygenAssist(keys[5], 0x20));
|
||||
ExpandRound(keys, 7, Aes.KeygenAssist(keys[6], 0x40));
|
||||
ExpandRound(keys, 8, Aes.KeygenAssist(keys[7], 0x80));
|
||||
ExpandRound(keys, 9, Aes.KeygenAssist(keys[8], 0x1b));
|
||||
ExpandRound(keys, 10, Aes.KeygenAssist(keys[9], 0x36));
|
||||
|
||||
for (int i = 1; i < 10; i++)
|
||||
{
|
||||
|
|
@ -82,13 +82,11 @@ namespace MinecraftClient.Crypto
|
|||
return keys;
|
||||
}
|
||||
|
||||
private static void MakeRoundKey(Vector128<byte>[] keys, int i, byte rcon)
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static void ExpandRound(Vector128<byte>[] keys, int i, Vector128<byte> assist)
|
||||
{
|
||||
Vector128<byte> s = keys[i - 1];
|
||||
Vector128<byte> t = keys[i - 1];
|
||||
|
||||
t = Aes.KeygenAssist(t, rcon);
|
||||
t = Sse2.Shuffle(t.AsUInt32(), 0xFF).AsByte();
|
||||
Vector128<byte> t = Sse2.Shuffle(assist.AsUInt32(), 0xFF).AsByte();
|
||||
|
||||
s = Sse2.Xor(s, Sse2.ShiftLeftLogical128BitLane(s, 4));
|
||||
s = Sse2.Xor(s, Sse2.ShiftLeftLogical128BitLane(s, 8));
|
||||
|
|
|
|||
|
|
@ -951,7 +951,7 @@ namespace MinecraftClient
|
|||
offlinePrompt = null;
|
||||
ConsoleIO.Reset();
|
||||
}
|
||||
if (Config.Main.Advanced.PlayerHeadAsIcon) { ConsoleIcon.RevertToMCCIcon(); }
|
||||
if (Config.Main.Advanced.PlayerHeadAsIcon && OperatingSystem.IsWindows()) { ConsoleIcon.RevertToMCCIcon(); }
|
||||
ConsoleIO.Backend?.Shutdown();
|
||||
Environment.Exit(exitcode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ public sealed class MccGameApi
|
|||
{
|
||||
Id = inventory.ID,
|
||||
Type = inventory.Type.ToString(),
|
||||
Title = inventory.Title,
|
||||
Title = inventory.Title ?? string.Empty,
|
||||
SlotCount = inventory.Type.SlotCount(),
|
||||
Slots = slots,
|
||||
Cursor = TryBuildCursorSnapshot(inventory)
|
||||
|
|
@ -850,7 +850,7 @@ public sealed class MccGameApi
|
|||
{
|
||||
InventoryId = entry.Key,
|
||||
InventoryType = inventory.Type.ToString(),
|
||||
InventoryTitle = inventory.Title,
|
||||
InventoryTitle = inventory.Title ?? string.Empty,
|
||||
Slot = pair.Key,
|
||||
ItemType = pair.Value.Type.ToString(),
|
||||
TypeLabel = pair.Value.GetTypeString(),
|
||||
|
|
@ -894,7 +894,7 @@ public sealed class MccGameApi
|
|||
{
|
||||
Id = entry.Key,
|
||||
Type = entry.Value.Type.ToString(),
|
||||
Title = entry.Value.Title,
|
||||
Title = entry.Value.Title ?? string.Empty,
|
||||
SlotCount = entry.Value.Type.SlotCount(),
|
||||
NonEmptySlots = entry.Value.Items.Count(item => IsSnapshotInventorySlot(entry.Value, item.Key)),
|
||||
Active = entry.Key > 0 && entry.Key == GetActiveContainerId(client)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace MinecraftClient.Tui
|
|||
public event EventHandler<ConsoleInputBuffer>? OnInputChange;
|
||||
|
||||
private MainTuiView? _view;
|
||||
private volatile bool _readThreadActive;
|
||||
|
||||
public bool DisplayUserInput { get; set; } = true;
|
||||
|
||||
|
|
@ -177,12 +176,10 @@ namespace MinecraftClient.Tui
|
|||
|
||||
public void BeginReadThread()
|
||||
{
|
||||
_readThreadActive = true;
|
||||
}
|
||||
|
||||
public void StopReadThread()
|
||||
{
|
||||
_readThreadActive = false;
|
||||
DismissOverlay();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
|
|
@ -13,6 +13,7 @@ namespace MinecraftClient.WinAPI
|
|||
/// Allow to set the player skin as console icon, on Windows only.
|
||||
/// See StackOverflow no. 2986853
|
||||
/// </summary>
|
||||
[SupportedOSPlatform("windows")]
|
||||
public static class ConsoleIcon
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
|
|
@ -32,18 +33,14 @@ namespace MinecraftClient.WinAPI
|
|||
|
||||
private static void SetWindowIcon(System.Drawing.Icon icon)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
IntPtr mwHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
|
||||
SendMessage(mwHandle, (int)WinMessages.SETICON, 0, icon.Handle);
|
||||
SendMessage(mwHandle, (int)WinMessages.SETICON, 1, icon.Handle);
|
||||
}
|
||||
IntPtr mwHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
|
||||
SendMessage(mwHandle, (int)WinMessages.SETICON, 0, icon.Handle);
|
||||
SendMessage(mwHandle, (int)WinMessages.SETICON, 1, icon.Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously download the player's skin and set the head as console icon
|
||||
/// </summary>
|
||||
[SupportedOSPlatform("windows")]
|
||||
public static void SetPlayerIconAsync(string playerName)
|
||||
{
|
||||
Thread t = new(new ThreadStart(delegate
|
||||
|
|
@ -99,16 +96,13 @@ namespace MinecraftClient.WinAPI
|
|||
/// </summary>
|
||||
public static void RevertToMCCIcon()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) //Windows Only
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Icon defaultIcon = Icon.ExtractAssociatedIcon(Environment.ProcessPath!)!;
|
||||
SetWindowIcon(Icon.FromHandle(defaultIcon.Handle)); // Windows 10+ (New console)
|
||||
SetConsoleIcon(defaultIcon.Handle); // Windows 8 and lower (Older console)
|
||||
}
|
||||
catch { }
|
||||
Icon defaultIcon = Icon.ExtractAssociatedIcon(Environment.ProcessPath!)!;
|
||||
SetWindowIcon(Icon.FromHandle(defaultIcon.Handle)); // Windows 10+ (New console)
|
||||
SetConsoleIcon(defaultIcon.Handle); // Windows 8 and lower (Older console)
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue