Add support for 19 processes
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Windows.Forms;
|
||||
namespace DD2Switcher;
|
||||
|
||||
internal static class Program {
|
||||
private static int NumProc = 10;
|
||||
private static int NumProc = 19;
|
||||
private static Process[] windows = new Process[NumProc];
|
||||
private static int ActiveIndex = -1;
|
||||
|
||||
@@ -208,12 +208,18 @@ internal static class Program {
|
||||
Process.GetCurrentProcess().Kill();
|
||||
}
|
||||
|
||||
for (int i = 0; i < NumProc; i++) {
|
||||
windows[i] = null;
|
||||
// Register main number keys (0-9)
|
||||
for (int i = 0; i < 10; i++) {
|
||||
HotKeyManager.RegisterHotKey(Keys.D0 + i, KeyModifiers.Alt);
|
||||
HotKeyManager.RegisterHotKey(Keys.D0 + i, KeyModifiers.Alt | KeyModifiers.Shift);
|
||||
}
|
||||
|
||||
// Register numpad keys (1-9)
|
||||
for (int i = 0; i < 9; i++) {
|
||||
HotKeyManager.RegisterHotKey(Keys.NumPad1 + i, KeyModifiers.Alt);
|
||||
HotKeyManager.RegisterHotKey(Keys.NumPad1 + i, KeyModifiers.Alt | KeyModifiers.Shift);
|
||||
}
|
||||
|
||||
HotKeyManager.RegisterHotKey(Keys.Oemtilde, KeyModifiers.Alt);
|
||||
HotKeyManager.HotKeyPressed += HotKeyManager_HotKeyPressed;
|
||||
|
||||
@@ -223,15 +229,25 @@ internal static class Program {
|
||||
return;
|
||||
}
|
||||
|
||||
int index;
|
||||
if (e.Key >= Keys.D0 && e.Key <= Keys.D9) {
|
||||
index = e.Key - Keys.D0;
|
||||
}
|
||||
else if (e.Key >= Keys.NumPad1 && e.Key <= Keys.NumPad9) {
|
||||
index = 10 + (e.Key - Keys.NumPad1);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Modifiers == KeyModifiers.Alt) {
|
||||
TabTo(e.Key - Keys.D0);
|
||||
TabTo(index);
|
||||
}
|
||||
else if (e.Modifiers == (KeyModifiers.Alt | KeyModifiers.Shift)) {
|
||||
Swap(e.Key - Keys.D0);
|
||||
Swap(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Console.CancelKeyPress += (sender, e) => { Process.GetCurrentProcess().Kill(); };
|
||||
while (true)
|
||||
System.Threading.Thread.Sleep(100000);
|
||||
|
Reference in New Issue
Block a user