Beispiel #1
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 786)
     {
         Keys         hKey             = (Keys)((int)m.LParam >> 16 & (int)ushort.MaxValue);
         KeysModifier hModifier        = (KeysModifier)((int)m.LParam & (int)ushort.MaxValue);
         uint         foregroundWindow = PlayerKey.GetForegroundWindow();
         Dialog       dialog           = Game.DialogList == null ? (Dialog)null : Game.DialogList.GetDialog("chat_input_dialog", false);
         for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
         {
             if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == hKey && (KeysModifier)PlayerKey._hHotKey[index][2] == hModifier)
             {
                 if ((int)foregroundWindow == (int)Game.Process.ProcessWindowHandle && (dialog == null || !dialog.IsVisible()))
                 {
                     if ((bool)PlayerKey._hHotKey[index][3])
                     {
                         ((AionEventKeyHandler)PlayerKey._hHotKey[index][0])(hKey, hModifier);
                         break;
                     }
                     ((AionEventHandler)PlayerKey._hHotKey[index][0])();
                     break;
                 }
                 PlayerKey.UnregisterHotKey(this.Handle, index + 1);
                 PlayerKey.keybd_event((byte)hKey, (byte)69, 1U, UIntPtr.Zero);
                 PlayerKey.keybd_event((byte)hKey, (byte)69, 3U, UIntPtr.Zero);
                 PlayerKey.RegisterHotKey(this.Handle, index + 1, (uint)hModifier, (uint)hKey);
                 break;
             }
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
Beispiel #2
0
 public static bool Unregister(string zKey, string zModifier = null)
 {
     try
     {
         if (Scripting._hLua_X86 == null && Scripting._hLua_X64 == null)
         {
             return(false);
         }
         int          result    = 0;
         Keys         hKey      = (Keys)Enum.Parse(typeof(Keys), zKey);
         KeysModifier hModifier = zModifier == null ? KeysModifier.None : (int.TryParse(zModifier, out result) ? (KeysModifier)result : (KeysModifier)Enum.Parse(typeof(KeysModifier), zModifier));
         foreach (KeyValuePair <string, ArrayList> keyValuePair in Scripting._hHotKey)
         {
             if ((Keys)keyValuePair.Value[0] == hKey && (KeysModifier)keyValuePair.Value[1] == hModifier)
             {
                 Game.PlayerInput.Unregister(hKey, hModifier);
                 Scripting._hHotKey.Remove(keyValuePair.Key);
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #3
0
 public static bool Register(string zFunction, string zKey, string zModifier = null)
 {
     try
     {
         if (Scripting._hLua_X86 == null && Scripting._hLua_X64 == null)
         {
             return(false);
         }
         int          result    = 0;
         Keys         hKey      = (Keys)Enum.Parse(typeof(Keys), zKey);
         KeysModifier hModifier = zModifier == null ? KeysModifier.None : (int.TryParse(zModifier, out result) ? (KeysModifier)result : (KeysModifier)Enum.Parse(typeof(KeysModifier), zModifier));
         if (Scripting._hHotKey.ContainsKey(zFunction) || !Game.PlayerInput.Register(new AionEventKeyHandler(Scripting._OnHotKey), hKey, hModifier))
         {
             return(false);
         }
         ArrayList arrayList = new ArrayList()
         {
             (object)hKey,
             (object)hModifier
         };
         Scripting._hHotKey[zFunction] = arrayList;
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #4
0
 public void Unregister(Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     if (PlayerInput._hPlayerKey == null)
     {
         return;
     }
     PlayerInput._hPlayerKey.Unregister(hKey, hModifier);
 }
Beispiel #5
0
 public bool Register(AionEventKeyHandler hFunction, Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     if (PlayerInput._hPlayerKey != null)
     {
         return(PlayerInput._hPlayerKey.Register(hFunction, hKey, hModifier));
     }
     return(false);
 }
Beispiel #6
0
 public bool Register(AionEventKeyHandler hFunction, Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     return(this._Register(new ArrayList()
     {
         (object)hFunction,
         (object)hKey,
         (object)hModifier,
         (object)true
     }));
 }
Beispiel #7
0
 public static bool Unregister(Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     // ISSUE: reference to a compiler-generated field
     if (Global.OnGlobalUnregister != null)
     {
         // ISSUE: reference to a compiler-generated field
         return(Global.OnGlobalUnregister(hKey, hModifier));
     }
     return(false);
 }
Beispiel #8
0
 public static bool Register(AionEventKeyHandler hFunction, Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     // ISSUE: reference to a compiler-generated field
     if (Global.OnGlobalRegister != null)
     {
         // ISSUE: reference to a compiler-generated field
         return(Global.OnGlobalRegister(hFunction, hKey, hModifier));
     }
     return(false);
 }
Beispiel #9
0
 public void Unregister(Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
     {
         if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == hKey && (KeysModifier)PlayerKey._hHotKey[index][2] == hModifier)
         {
             PlayerKey.UnregisterHotKey(this.Handle, index + 1);
             PlayerKey._hHotKey[index] = (ArrayList)null;
             break;
         }
     }
 }
Beispiel #10
0
 private async void EventHotKeyPressed(KeysModifier keysModifier, KeysVirtual keysVirtual)
 {
     try
     {
         //Make screenshot hotkey
         if (keysModifier == KeysModifier.Alt && keysVirtual == KeysVirtual.F12)
         {
             if (Convert.ToBoolean(Setting_Load(vConfigurationDirectXInput, "ShortcutScreenshotKeyboard")))
             {
                 Debug.WriteLine("Button Global - Screenshot");
                 await CaptureScreen.CaptureScreenToFile();
             }
         }
     }
     catch { }
 }
Beispiel #11
0
        protected bool _Register(ArrayList hItem)
        {
            for (int index = 0; index < PlayerKey._hHotKey.Count; ++index)
            {
                if (PlayerKey._hHotKey[index] != null && (Keys)PlayerKey._hHotKey[index][1] == (Keys)hItem[1] && (KeysModifier)PlayerKey._hHotKey[index][2] == (KeysModifier)hItem[2])
                {
                    return(false);
                }
            }
            Keys         keys         = (Keys)hItem[1];
            KeysModifier keysModifier = (KeysModifier)hItem[2];

            if (!PlayerKey.RegisterHotKey(this.Handle, PlayerKey._iHotKey + 1, (uint)keysModifier, (uint)keys))
            {
                Marshal.GetLastWin32Error();
                return(false);
            }
            PlayerKey._hHotKey.Add(PlayerKey._iHotKey, hItem);
            ++PlayerKey._iHotKey;
            return(true);
        }
Beispiel #12
0
 private static void _OnHotKey(Keys hKey, KeysModifier hModifier)
 {
     if (Scripting._hLua_X64 == null && Scripting._hLua_X86 == null)
     {
         return;
     }
     foreach (KeyValuePair <string, ArrayList> keyValuePair in Scripting._hHotKey)
     {
         try
         {
             if ((Keys)keyValuePair.Value[0] == hKey)
             {
                 if ((KeysModifier)keyValuePair.Value[1] == hModifier)
                 {
                     if (Scripting._hLua_X64 != null)
                     {
                         LuaInterface_X64.LuaFunction function = Scripting._hLua_X64.LuaEngine.GetFunction(keyValuePair.Key);
                         if (function == null)
                         {
                             break;
                         }
                         function.Call();
                         break;
                     }
                     LuaInterface_X86.LuaFunction function1 = Scripting._hLua_X86.LuaEngine.GetFunction(keyValuePair.Key);
                     if (function1 == null)
                     {
                         break;
                     }
                     function1.Call();
                     break;
                 }
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Beispiel #13
0
 public static bool UnregisterCompiled(Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     try
     {
         if (Scripting._hCompiled == null)
         {
             return(false);
         }
         foreach (KeyValuePair <AionEventKeyHandler, ArrayList> keyValuePair in Scripting._hHotKeyCompiled)
         {
             if ((Keys)keyValuePair.Value[0] == hKey && (KeysModifier)keyValuePair.Value[1] == hModifier)
             {
                 Game.PlayerInput.Unregister(hKey, hModifier);
                 Scripting._hHotKeyCompiled.Remove(keyValuePair.Key);
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #14
0
 public static bool RegisterCompiled(AionEventKeyHandler hFunction, Keys hKey, KeysModifier hModifier = KeysModifier.None)
 {
     try
     {
         if (Scripting._hCompiled == null || Scripting._hHotKeyCompiled.ContainsKey(hFunction) || !Game.PlayerInput.Register(hFunction, hKey, hModifier))
         {
             return(false);
         }
         ArrayList arrayList = new ArrayList()
         {
             (object)hKey,
             (object)hModifier
         };
         Scripting._hHotKeyCompiled[hFunction] = arrayList;
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }