예제 #1
0
        public void PasteTextFromClipboard()
        {
            //GApp.GetConnectionCommandTarget().Paste();
            string value = (string)Clipboard.GetDataObject().GetData("Text");
            if (value == null || value.Length == 0 || this.TerminalPane == null || this.TerminalPane.ConnectionTag == null) return ;

            PasteProcessor p = new PasteProcessor(this.TerminalPane.ConnectionTag, value);
            p.Perform();
        }
예제 #2
0
        public SendingLargeText(PasteProcessor proc)
        {
            _proc = proc;

            Init();
        }
        public CommandResult PasteFromFile()
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.InitialDirectory = GApp.Options.DefaultFileDir;
            dlg.Title = GApp.Strings.GetString("Util.SourceToLoad");
            dlg.Filter = "All Files(*.*)|*.*";
            ConnectionTag ct = GEnv.Connections.FindTag(_connection);
            if(ct.ModalTerminalTask!=null) return CommandResult.Denied;

            if(GCUtil.ShowModalDialog(GApp.Frame, dlg)==DialogResult.OK) {
                GApp.Options.DefaultFileDir = GUtil.FileToDir(dlg.FileName);
                try {
                    StreamReader re = new StreamReader(new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read), _connection.Param.EncodingProfile.Encoding);
                    if(new FileInfo(dlg.FileName).Length > 0x1000) { //4KB�ȏ�͔񓯊�
                        SendingLargeText dlg2 = new SendingLargeText(new PasteProcessor(ct, re));
                        re.Close();
                        if(GCUtil.ShowModalDialog(GApp.Frame, dlg2)==DialogResult.OK)
                            return CommandResult.Success;
                        else
                            return CommandResult.Cancelled;
                    }
                    else {
                        PasteProcessor p = new PasteProcessor(ct, re);
                        p.Perform();
                        re.Close();
                    }
                    //GEnv.Frame.StatusBar.IndicateSendData();
                    return CommandResult.Success;
                }
                catch(Exception ex) {
                    GUtil.Warning(GEnv.Frame, ex.Message);
                    return CommandResult.Failed;
                }
            }
            else
                return CommandResult.Cancelled;
        }
예제 #4
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            if (OnOnKeyUpAction != null)
                OnOnKeyUpAction(this, e);
            //Console.WriteLine(e.KeyCode.ToString());

            #region all this gay shit is just to allow "Shift + Insert" to paste from clipboard
            if (e.KeyCode == Keys.Insert && e.Shift == true)
            {
                //Console.WriteLine("Shift" + e.KeyCode.ToString());
                string value = (string)Clipboard.GetDataObject().GetData("Text");
                if (value == null || value.Length == 0 || this.ConnectionTag == null) return;

                PasteProcessor p = new PasteProcessor(this.ConnectionTag, value);
                p.Perform();
            }
            #endregion

            base.OnKeyUp(e);
        }
예제 #5
0
        protected CommandResult PasteMain(string value)
        {
            ConnectionTag tag = GEnv.Connections.FindTag(_connection);
            PasteProcessor p = new PasteProcessor(tag, value);

            try {
                p.Perform();
                return CommandResult.Success;
            }
            catch(Exception ex) {
                Debug.WriteLine(ex.StackTrace);
                GUtil.Warning(GEnv.Frame, GEnv.Strings.GetString("Message.ConnectionCommandTarget.SendError") + ex.Message);
                return CommandResult.Failed;
            }
        }