KeePass.Util.ClipboardEventChainBlocker.Release C# (CSharp) Method

Release() public method

public Release ( ) : void
return void
        public void Release()
        {
            if(m_form != null)
            {
                try
                {
                    if(NativeMethods.ChangeClipboardChain(m_form.Handle,
                        m_hChain) == false)
                    {
                        Debug.Assert(false);
                    }
                }
                catch(Exception) { Debug.Assert(false); }

                m_form.Dispose();
                m_form = null;
            }

            m_hChain = IntPtr.Zero;
        }

Usage Example

Example #1
0
        private static void SendObfuscated(string strKeys)
        {
            Debug.Assert(strKeys != null);
            if (strKeys == null)
            {
                throw new ArgumentNullException("strKeys");
            }

            if (strKeys.Length == 0)
            {
                return;
            }

            ClipboardEventChainBlocker cev = new ClipboardEventChainBlocker();
            ClipboardContents          cnt = new ClipboardContents(true);
            Exception excpInner            = null;

            char[] vSpecial = new char[] { '{', '}', '(', ')', '+', '^', '%',
                                           ' ', '\t', '\r', '\n' };

            try
            {
                List <string> vParts = SplitKeySequence(strKeys);
                foreach (string strPart in vParts)
                {
                    if (strPart.Length == 0)
                    {
                        continue;
                    }

                    if (strPart.IndexOfAny(vSpecial) >= 0)
                    {
                        SendKeysWithSpecial(strPart);
                    }
                    else
                    {
                        MixedTransfer(strPart);
                    }
                }
            }
            catch (Exception ex) { excpInner = ex; }

            cnt.SetData();
            cev.Release();

            if (excpInner != null)
            {
                throw excpInner;
            }
        }
All Usage Examples Of KeePass.Util.ClipboardEventChainBlocker::Release
ClipboardEventChainBlocker