Update 0.01 E
This commit is contained in:
+15
-9
@@ -10,17 +10,23 @@ namespace Lua
|
||||
public static readonly SpeechSynthesizer Tts = new SpeechSynthesizer();
|
||||
private static readonly object TtsLock = new object();
|
||||
|
||||
[DllImport("user32.dll")] public static extern short GetAsyncKeyState(int vKey);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern short GetKeyState(int keyCode);
|
||||
[DllImport("user32.dll")] public static extern void mouse_event(uint dwFlags, int dx, int dy, uint dwData, UIntPtr dwExtraInfo);
|
||||
[DllImport("user32.dll")]
|
||||
public static extern short GetAsyncKeyState(int vKey);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||
public static extern short GetKeyState(int keyCode);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern void mouse_event(uint dwFlags, int dx, int dy, uint dwData, UIntPtr dwExtraInfo);
|
||||
|
||||
public const uint MOUSEEVENTF_MOVE = 0x0001;
|
||||
|
||||
private const int VK_CAPITAL = 0x14;
|
||||
private static bool previousCapsState;
|
||||
private static bool _previousCapsState;
|
||||
|
||||
public static void InitializeCapsState()
|
||||
{
|
||||
previousCapsState = IsCapsLockOn();
|
||||
_previousCapsState = IsCapsLockOn();
|
||||
}
|
||||
|
||||
public static bool IsPressed(int vKey) => (GetAsyncKeyState(vKey) & 0x8000) != 0;
|
||||
@@ -38,7 +44,7 @@ namespace Lua
|
||||
Tts.SpeakAsyncCancelAll();
|
||||
Tts.SpeakAsync(text);
|
||||
}
|
||||
catch { }
|
||||
catch { /* Ignore TTS errors */ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +58,9 @@ namespace Lua
|
||||
public static void CheckCapsLockChange()
|
||||
{
|
||||
bool caps = IsCapsLockOn();
|
||||
if (caps != previousCapsState)
|
||||
if (caps != _previousCapsState)
|
||||
{
|
||||
previousCapsState = caps;
|
||||
_previousCapsState = caps;
|
||||
ShowCapsLockStatus();
|
||||
}
|
||||
}
|
||||
@@ -77,7 +83,7 @@ namespace Lua
|
||||
try
|
||||
{
|
||||
int current = Console.CursorTop;
|
||||
int limit = Console.WindowHeight - 2;
|
||||
int limit = Console.WindowHeight - 2; // Keep 2-row buffer
|
||||
|
||||
if (current >= limit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user