예제 #1
0
        private static string PerformClipboardCopy(string strText, SprContext ctx,
                                                   uint uRecursionLevel)
        {
            string        str = strText;
            int           iStart;
            List <string> lParams;
            SprContext    ctxData = ((ctx != null) ? ctx.WithoutContentTransformations() : null);

            while (ParseAndRemovePlhWithParams(ref str, ctxData, uRecursionLevel,
                                               @"{CLIPBOARD-SET:", out iStart, out lParams, true))
            {
                if (lParams.Count < 1)
                {
                    continue;
                }

                try
                {
                    ClipboardUtil.Copy(lParams[0] ?? string.Empty, false,
                                       true, null, null, IntPtr.Zero);
                }
                catch (Exception) { Debug.Assert(false); }
            }

            return(str);
        }
예제 #2
0
        private void DoCopyTriggers(ListViewItem[] vTriggers)
        {
            if (vTriggers == null)
            {
                return;
            }

            try
            {
                ClipboardUtil.Clear();
                if (vTriggers.Length == 0)
                {
                    return;
                }

                EcasTriggerContainer v = new EcasTriggerContainer();
                for (int iTrigger = 0; iTrigger < vTriggers.Length; ++iTrigger)
                {
                    v.Triggers.Add(vTriggers[iTrigger].Tag as EcasTrigger);
                }

                using (MemoryStream ms = new MemoryStream())
                {
                    XmlUtilEx.Serialize <EcasTriggerContainer>(ms, v);

                    ClipboardUtil.Copy(StrUtil.Utf8.GetString(ms.ToArray()), false,
                                       false, null, null, this.Handle);
                }
            }
            catch (Exception ex) { MessageService.ShowWarning(ex); }
        }
예제 #3
0
 private void CopyPassword(SearchResult searchResult)
 {
     if (ClipboardUtil.Copy(searchResult.Entry.Strings.ReadSafe(PwDefs.PasswordField), true, true, searchResult.Entry,
                            mMainForm.DocumentManager.SafeFindContainerOf(searchResult.Entry),
                            IntPtr.Zero))
     {
         mMainForm.StartClipboardCountdown();
     }
 }
예제 #4
0
        private void buttonCopy_Click(object sender, EventArgs e)
        {
            var otp = _yaotp.ComputeOtp();

            if (ClipboardUtil.Copy(otp, false, true, _entry, _host.Database, IntPtr.Zero))
            {
                _host.MainWindow.StartClipboardCountdown();
            }
        }
예제 #5
0
        private void OnComponentCopyTag(object sender, EventArgs e)
        {
            ListViewItem lvi = GetSelectedComponent();

            if (lvi == null)
            {
                Debug.Assert(false); return;
            }

            string str = ((lvi.Tag as string) ?? string.Empty);

            ClipboardUtil.Copy(str, false, false, null, null, this.Handle);
        }
예제 #6
0
        private void DoCopyTriggers(ListViewItem[] vTriggers)
        {
            if (vTriggers == null)
            {
                return;
            }

            try
            {
                ClipboardUtil.Clear();
                if (vTriggers.Length == 0)
                {
                    return;
                }

                EcasTriggerContainer v = new EcasTriggerContainer();
                for (int iTrigger = 0; iTrigger < vTriggers.Length; ++iTrigger)
                {
                    v.Triggers.Add(vTriggers[iTrigger].Tag as EcasTrigger);
                }

                XmlWriterSettings xws = new XmlWriterSettings();
                xws.Encoding    = new UTF8Encoding(false);
                xws.Indent      = true;
                xws.IndentChars = "\t";

                MemoryStream ms = new MemoryStream();
                XmlWriter    xw = XmlWriter.Create(ms, xws);

                XmlSerializer xmls = new XmlSerializer(typeof(EcasTriggerContainer));
                xmls.Serialize(xw, v);

                ClipboardUtil.Copy(StrUtil.Utf8.GetString(ms.ToArray()), false,
                                   false, null, null, this.Handle);
                xw.Close();
                ms.Close();
            }
            catch (Exception excp) { MessageService.ShowWarning(excp.Message); }
        }
예제 #7
0
 private void OnCopyLinkCommand(object sender, EventArgs e)
 {
     ClipboardUtil.Copy(m_strCurLink, false, false, null, null,
                        (m_form != null) ? m_form.Handle : IntPtr.Zero);
 }
예제 #8
0
 private void copyPublicKeybutton_Click(object sender, EventArgs e)
 {
     ClipboardUtil.Copy(publicKeyTextBox.Text, false, false, null, null, pwEntryForm.Handle);
 }