Пример #1
0
 public TerminalSession(ITerminalConnection connection, ITerminalSettings terminalSettings, TerminalOptions terminalOptions)
 {
     _terminalSettings = terminalSettings;
     _terminalOptions  = terminalOptions;
     //VT100Žw’è‚Å‚àxtermƒV[ƒPƒ“ƒX‚ð‘—‚Á‚Ä‚­‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŒã‚ð‚½‚½‚È‚¢‚Ì‚Å
     _terminal  = AbstractTerminal.Create(new TerminalInitializeInfo(this, connection.Destination));
     _output    = new TerminalTransmission(_terminal, _terminalSettings, connection);
     _keepAlive = new KeepAlive(this);
 }
Пример #2
0
        public TerminalSession(ITerminalConnection connection, ITerminalSettings terminalSettings) {
            _terminalSettings = terminalSettings;
            //VT100指定でもxtermシーケンスを送ってくるアプリケーションが後をたたないので
            _terminal = AbstractTerminal.Create(new TerminalInitializeInfo(this, connection.Destination));
            _output = new TerminalTransmission(_terminal, _terminalSettings, connection);

            _terminalSettings.ChangeCaption += delegate(string caption) {
                this.OwnerWindow.DocumentTabFeature.Update(_terminal.IDocument);
            };

        }
Пример #3
0
        /// <summary>
        /// <ja>プラグイン実行</ja>
        /// </summary>
        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            IPoderosaView    view;
            ITerminalSession session;

            // ビュー/セッション取得
            if (!GetViewAndSession(target, out view, out session))
            {
                return(CommandResult.Ignored);
            }

            // クリップボードデータ取得
            var clipboardData = Clipboard.GetDataObject();

            if (!clipboardData.GetDataPresent("Text"))
            {
                return(CommandResult.Ignored);
            }
            string data = (string)clipboardData.GetData("Text");

            if (data == null)
            {
                return(CommandResult.Ignored);
            }

            // オプション取得
            ExtendPasteOptions opt = ExtendPastePlugin.Instance.ExtendPasteOptionSupplier.OriginalOptions;

            // 改行存在チェック
            bool newLineFlg = ((data.IndexOfAny(new char[] { '\r', '\n' }) >= 0) || (data.Contains(Environment.NewLine))) ? true : false;

            // セッション名取得
            //ITerminalSession sessionName = (ITerminalSession)view.Document.OwnerSession.GetAdapter(typeof(ITerminalSession));

            // 確認ダイアログ表示
            if (((opt.UseAction == UseAction.NewLine) && (newLineFlg)) || (opt.UseAction == UseAction.Always))
            {
                IPoderosaForm     poderosaForm = view.ParentForm;
                ExtendPasteDialog Form         = new ExtendPasteDialog(data, newLineFlg, session.Caption);
                if (Form.ShowDialog(poderosaForm.AsForm()) != DialogResult.OK)
                {
                    return(CommandResult.Ignored);
                }
            }

            // クリップボードデータ送信
            StringReader         reader = new StringReader(data);
            TerminalTransmission output = session.TerminalTransmission;

            output.SendTextStream(reader, data[data.Length - 1] == '\n', true);
            return(CommandResult.Succeeded);
        }
Пример #4
0
        public void Start(ITerminalSession session)
        {
            _session     = session;
            _output      = session.TerminalTransmission;
            _consoleFlag = true;

            _session.Terminal.PromptRecognizer.AddListener(this);
            //Test Body
            Test1();
            Test2();
            Test3();

            _session.Terminal.PromptRecognizer.RemoveListener(this);
        }
Пример #5
0
        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            IPoderosaView    view;
            ITerminalSession session;

            if (!GetViewAndSession(target, out view, out session))
            {
                return(CommandResult.Ignored);
            }
            var clipboardData = Clipboard.GetDataObject();

            if (!clipboardData.GetDataPresent("Text"))
            {
                return(CommandResult.Ignored);
            }

            string data = clipboardData.GetData("Text") as string;

            if (data == null)
            {
                return(CommandResult.Ignored);
            }

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;

            if (options.AlertOnPasteNewLineChar)
            {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine))
                {
                    IPoderosaForm form = view.ParentForm;
                    if (form != null)
                    {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes)
                        {
                            return(CommandResult.Ignored);
                        }
                    }
                }
            }

            StringReader         reader = new StringReader(data);
            TerminalTransmission output = session.TerminalTransmission;

            output.SendTextStream(reader, data[data.Length - 1] == '\n');
            return(CommandResult.Succeeded);
        }
Пример #6
0
        public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args)
        {
            if (!CanExecute(target))
            {
                return(CommandResult.Ignored);
            }
            TerminalTransmission output = GetSession().TerminalTransmission;

            //string data = Clipboard.GetDataObject().GetData("Text") as string;
            string data = Clipboard.GetText();

            if (data == null || data.Length == 0)
            {
                return(CommandResult.Ignored);
            }

            ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions;

            if (options.AlertOnPasteNewLineChar)
            {
                // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine,
                // So we check the data about CR, LF and Environment.NewLine.
                if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine))
                {
                    IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView));
                    IPoderosaForm form = view.ParentForm;
                    if (form != null)
                    {
                        DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar"));
                        if (res != DialogResult.Yes)
                        {
                            return(CommandResult.Ignored);
                        }
                    }
                }
            }

            //TODO 長文のときにダイアログを出して中途キャンセル可能に
            StringReader reader = new StringReader(data);

            output.SendTextStream(reader, data[data.Length - 1] == '\n');
            return(CommandResult.Succeeded);
        }