Пример #1
0
        public static void SendKeysWait(string strKeys, bool bObfuscate)
        {
            if (strKeys == null)
            {
                Debug.Assert(false); return;
            }

            List <SiEvent> l = Parse(strKeys);

            if (l.Count == 0)
            {
                return;
            }

            if (bObfuscate)
            {
                SiObf.Obfuscate(l);
            }

            FixEventSeq(l);

            bool      bUnix = KeePassLib.Native.NativeLib.IsUnix();
            ISiEngine si;

            if (bUnix)
            {
                si = new SiEngineUnix();
            }
            else
            {
                si = new SiEngineWin();
            }

            bool bInter = Program.Config.Integration.AutoTypeAllowInterleaved;

            if (!bInter)
            {
                if (!m_csSending.TryEnter())
                {
                    return;
                }
            }

            try
            {
                si.Init();
                Send(si, l);
            }
            finally
            {
                try { si.Release(); }
                catch (Exception) { Debug.Assert(false); }

                if (!bInter)
                {
                    m_csSending.Exit();
                }
            }
        }
Пример #2
0
        public static void SendKeysWait(string strKeys, bool bObfuscate)
        {
            if (strKeys == null)
            {
                Debug.Assert(false); return;
            }

            List <SiEvent> l = Parse(strKeys);

            if (l.Count == 0)
            {
                return;
            }

            if (bObfuscate)
            {
                SiObf.Obfuscate(l);
            }

            FixEventSeq(l);

            ISiEngine si = new SiEngineWin();

            bool bInter = Properties.Settings.Default.AutoTypeAllowInterleaved;

            if (!bInter)
            {
                if (!g_csSending.TryEnter())
                {
                    return;
                }
            }

            Interlocked.Increment(ref m_nCurSending);
            try
            {
                si.Init();
                Send(si, l);
            }
            finally
            {
                try { si.Release(); }
                catch (Exception) { Debug.Assert(false); }

                Interlocked.Decrement(ref m_nCurSending);

                if (!bInter)
                {
                    g_csSending.Exit();
                }
            }
        }
Пример #3
0
        public static void SendKeysWait(string strKeys, bool bObfuscate)
        {
            if (strKeys == null)
            {
                Debug.Assert(false); return;
            }

            List <SiEvent> l = Parse(strKeys);

            if (l.Count == 0)
            {
                return;
            }

            if (bObfuscate)
            {
                SiObf.Obfuscate(l);
            }

            FixEventSeq(l);

            ISiEngine si = null;

            if (SendInputEx.CreateEngine != null)
            {
                SiEventArgs ea = new SiEventArgs();
                SendInputEx.CreateEngine(null, ea);
                si = ea.Engine;
            }
            if (si == null)
            {
                if (NativeLib.IsUnix())
                {
                    si = new SiEngineUnix();
                }
                else
                {
                    si = new SiEngineWin();
                }
            }

            bool bInter = Program.Config.Integration.AutoTypeAllowInterleaved;

            if (!bInter)
            {
                if (!g_csSending.TryEnter())
                {
                    return;
                }
            }

            Interlocked.Increment(ref g_cCurSending);
            try
            {
                si.Init();
                Send(si, l);
            }
            finally
            {
                try { si.Release(); }
                catch (Exception) { Debug.Assert(false); }

                Interlocked.Decrement(ref g_cCurSending);

                if (!bInter)
                {
                    g_csSending.Exit();
                }
            }
        }