Example #1
0
        private static bool OnKeyboardInputReceived(Win32.WM wParam, Win32.WindowHook.KBDLLHOOKSTRUCT hookStruct)
        {
            // fix for 'key repeat' windows feature
            if (pressedKeys.Contains((byte)(hookStruct.vkCode & 0xFF)))
            {
                return(false);
            }

            // and ignore "global desktop keys"
            Mubox.Configuration.KeySetting globalKeySetting = null;
            if (Mubox.Configuration.MuboxConfigSection.Default.Keys.TryGetKeySetting((Win32.VK)hookStruct.vkCode, out globalKeySetting) && (globalKeySetting.SendToDesktop))
            {
                return(false);
            }

            // filter repeated keys, we don't rebroadcast these
            if (IsRepeatKey(hookStruct) && Mubox.Configuration.MuboxConfigSection.Default.IsCaptureEnabled && !Mubox.Configuration.MuboxConfigSection.Default.DisableRepeatKeyFiltering)
            {
                return(true);
            }

            // count
            if (Performance.IsPerformanceEnabled)
            {
                KeyboardInputPerformance.Count(Convert.ToInt64(hookStruct.time));
            }

            // handle high-level
            if (KeyboardInputReceived != null)
            {
                KeyboardInput keyboardInputEventArgs = KeyboardInput.CreateFrom(wParam, hookStruct);
                {
                    Mubox.Configuration.KeySetting keySetting = globalKeySetting;
                    if (Mubox.Configuration.MuboxConfigSection.Default.Teams.ActiveTeam != null)
                    {
                        Mubox.Configuration.ClientSettings activeClient = Mubox.Configuration.MuboxConfigSection.Default.Teams.ActiveTeam.ActiveClient;
                        if (activeClient != null)
                        {
                            activeClient.Keys.TryGetKeySetting((Win32.VK)keyboardInputEventArgs.VK, out keySetting);
                        }
                        if (keySetting != null)
                        {
                            keyboardInputEventArgs.VK  = (uint)keySetting.OutputKey;
                            keyboardInputEventArgs.CAS = keySetting.OutputModifiers;
                        }
                    }
                }
                OnKeyboardInputReceivedInternal(keyboardInputEventArgs);
                return(keyboardInputEventArgs.Handled);
            }

            return(false);
        }
Example #2
0
 private void OnNameReceived(string[] parameters)
 {
     this.WindowStationHandle = parameters.Length > 2 ? new IntPtr(int.Parse(parameters[2])) : IntPtr.Zero;
     this.WindowDesktopHandle = parameters.Length > 3 ? new IntPtr(int.Parse(parameters[3])) : IntPtr.Zero;
     this.WindowHandle        = parameters.Length > 4 ? new IntPtr(int.Parse(parameters[4])) : IntPtr.Zero;
     this.Dispatcher.BeginInvoke((System.Threading.ThreadStart) delegate()
     {
         try
         {
             if (this.ClientSocket != null)
             {
                 this.Address = ((System.Net.IPEndPoint)ClientSocket.RemoteEndPoint).Address.ToString();
             }
             var parts        = parameters[1].Split('_');
             this.DisplayName = parts[0];
             this.ProfileName = parts[1];
             foreach (var L_profile in Mubox.Configuration.MuboxConfigSection.Default.Profiles.Cast <Mubox.Configuration.ProfileSettings>())
             {
                 if (L_profile.Name == this.ProfileName)
                 {
                     Mubox.Configuration.ClientSettings settings = L_profile.Clients.GetExisting(DisplayName);
                     if (settings != null)
                     {
                         ProfileName = L_profile.Name;
                         break;
                     }
                     else
                     {
                         settings = L_profile.Clients.CreateNew(this.DisplayName);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             ex.Log();
         }
     });
 }
Example #3
0
 public ClientState(Mubox.Configuration.ClientSettings settings, Mubox.Configuration.ProfileSettings profile)
     : this()
 {
     Settings = settings;
     Profile  = profile;
 }
Example #4
0
 public ClientState(Mubox.Configuration.ClientSettings settings)
     : this()
 {
     Settings = settings;
 }