Browse Source

Installer now uses cross-platform way to check whether a console is available

pull/62/head
Anairkoen Schno 4 years ago
parent
commit
0600d12ddb
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
1 changed files with 1 additions and 55 deletions
  1. +1
    -55
      IPA/Program.cs

+ 1
- 55
IPA/Program.cs View File

@ -414,60 +414,6 @@ namespace IPA
Console.Write("\x1b[1A");
}
[DllImport("kernel32.dll")]
private static extern IntPtr GetConsoleWindow();
private static bool? isConsole;
public static bool IsConsole
{
get
{
if (isConsole == null)
isConsole = GetConsoleWindow() != IntPtr.Zero;
return isConsole.Value;
}
}
/*internal static class Keyboard
{
[Flags]
private enum KeyStates
{
None = 0,
Down = 1,
Toggled = 2
}
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern short GetKeyState(int keyCode);
private static KeyStates KeyState(Keys key)
{
KeyStates state = KeyStates.None;
short retVal = GetKeyState((int)key);
//If the high-order bit is 1, the key is down
//otherwise, it is up.
if ((retVal & 0x8000) == 0x8000)
state |= KeyStates.Down;
//If the low-order bit is 1, the key is toggled.
if ((retVal & 1) == 1)
state |= KeyStates.Toggled;
return state;
}
public static bool IsKeyDown(Keys key)
{
return KeyStates.Down == (KeyState(key) & KeyStates.Down);
}
public static bool IsKeyToggled(Keys key)
{
return KeyStates.Toggled == (KeyState(key) & KeyStates.Toggled);
}
}*/
public static bool IsConsole => Environment.UserInteractive;
}
}

Loading…
Cancel
Save