/// <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); }
/// <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'); return CommandResult.Succeeded; }