private void ProceedFromClipboardConvertion(string?resultFilePath)
        {
            logger.LogInformation("Trying to get the payload from the clipboard");
            var payload = clipboard.GetText();

            ConvertAndSave(resultFilePath, payload ?? string.Empty);
        }
        public void PasteGherkin(IClipboard source)
        {
            if (!source.ContainsText())
                return;

            var gherkinText = source.GetText()
                                    .Split(new[] {Environment.NewLine},
                                           StringSplitOptions.RemoveEmptyEntries)
                                    .Select(s => s.Trim());

            var gherkinTree = new GherkinTree(LineGenerators.CSharp,
                                              GWTIdentify);
            gherkinTree.AddLines(gherkinText);

            _environment.Paste(gherkinTree.ToString());
        }
        public ICollection <AnnoObject> Paste()
        {
            var files = _clipboard.GetFileDropList();

            if (files?.Count == 1)
            {
                try
                {
                    return(_layoutLoader.LoadLayout(files[0], forceLoad: true).Objects);
                }
                catch (JsonReaderException) { }
            }

            if (_clipboard.ContainsData(CoreConstants.AnnoDesignerClipboardFormat))
            {
                try
                {
                    var stream = _clipboard.GetData(CoreConstants.AnnoDesignerClipboardFormat) as Stream;
                    if (stream is not null)
                    {
                        return(_layoutLoader.LoadLayout(stream, forceLoad: true).Objects);
                    }
                }
                catch (JsonReaderException) { }
            }

            if (_clipboard.ContainsText())
            {
                using var memoryStream = new MemoryStream();
                using var streamWriter = new StreamWriter(memoryStream);
                streamWriter.Write(_clipboard.GetText());
                streamWriter.Flush();
                memoryStream.Seek(0, SeekOrigin.Begin);
                try
                {
                    return(_layoutLoader.LoadLayout(memoryStream, forceLoad: true).Objects);
                }
                catch (JsonReaderException) { }
            }

            return(Array.Empty <AnnoObject>());
        }
Exemple #4
0
        //=========================================================================================
        internal bool PasteFromClipboard()
        {
            if (this.ClipboardProxy == null)
            {
                this.ClipboardProxy = ClipboardProxyClass.Self;
            }
            if (!this.ClipboardProxy.ContainsText())
            {
                return(false);
            }

            string text         = ClipboardProxy.GetText();
            var    startPoint   = Viewer.GetSelectionBoundary(true);
            string previousText = Viewer.SelectionText;

            PasteText(text);

            UndoRedoManager.ProcessPaste(startPoint.Line, startPoint.Col, text, previousText);

            this.InitTokens();
            this.Viewer.Body.Invalidate(false);
            return(true);
        }
Exemple #5
0
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Retrieves text data from the Clipboard in the Text or UnicodeText format, depending
 /// on the operating system.
 /// </summary>
 /// --------------------------------------------------------------------------------
 public static string GetText()
 {
     return(s_Clipboard.GetText());
 }
Exemple #6
0
 public string?GetText()
 {
     Check();
     return(clipboard.GetText());
 }
 private void 粘贴字(object sender, EventArgs e)
 {
     sometext.Text = MyClipboard.GetText();
 }