public static ITerminalSession InvokeOpenSessionOrNull(ICommandTarget target, TerminalParam param) { ITerminalParameter tp = param.ConvertToTerminalParameter(); ITerminalSettings ts = CreateTerminalSettings(param); IViewManager pm = CommandTargetUtil.AsWindow(target).ViewManager; //独立ウィンドウにポップアップさせるようなことは考えていない IContentReplaceableView rv = (IContentReplaceableView)pm.GetCandidateViewForNewDocument().GetAdapter(typeof(IContentReplaceableView)); TerminalControl tc = (TerminalControl)rv.GetCurrentContent().GetAdapter(typeof(TerminalControl)); if (tc != null) //ターミナルコントロールがないときは無理に設定しにいかない { Size sz; if (ts.UsingDefaultRenderProfile) { using (RenderProfile profile = MacroPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile()) sz = tc.CalcTerminalSize(profile); } else { sz = tc.CalcTerminalSize(ts.RenderProfile); } //RenderProfile rp = ts.UsingDefaultRenderProfile? MacroPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile() : ts.RenderProfile; //Size sz = tc.CalcTerminalSize(rp); tp.SetTerminalSize(sz.Width, sz.Height); } return((ITerminalSession)MacroPlugin.Instance.WindowManager.ActiveWindow.AsForm().Invoke(new OpenSessionDelegate(OpenSessionOrNull), tp, ts)); }
protected void OnOK(object sender, EventArgs args) { this.DialogResult = DialogResult.None; _targetView = GetTargetView(); ITerminalParameter term = PrepareTerminalParameter(); if (term == null) { return; //設定に誤りがある場合 } TerminalControl tc = (TerminalControl)_targetView.GetAdapter(typeof(TerminalControl)); //Size sz = tc.CalcTerminalSize((_terminalSettings.RenderProfile == null) ? // this.GetInitialRenderProfile() : _terminalSettings.RenderProfile); Size sz; if (_terminalSettings.RenderProfile == null) { using (RenderProfile profile = this.GetInitialRenderProfile()) sz = tc.CalcTerminalSize(profile); } else { sz = tc.CalcTerminalSize(_terminalSettings.RenderProfile); } term.SetTerminalSize(sz.Width, sz.Height); _loginButton.Enabled = false; _cancelButton.Enabled = false; this.Cursor = Cursors.WaitCursor; _originalText = this.Text; this.Text = String.Format("{0} - {1}", _originalText, TEnv.Strings.GetString("Caption.HowToCancel")); StartConnection(); }
/// <summary> /// Default constructor. /// </summary> /// <param name="parentForm">The connection form that will display the PowerShell console.</param> /// <param name="terminal">Terminal control that will display the PowerShell console.</param> /// <param name="executeHelper">Method used to execute PowerShell commands within the current session.</param> /// <param name="progressBar">Progress bar UI element to update when writing progress records.</param> /// <param name="progressLabel">Label UI element to update when writing progress records.</param> public PowerShellHost( PowerShellConnectionForm parentForm, TerminalControl terminal, Func <string, Collection <PSObject> > executeHelper, ToolStripProgressBar progressBar, ToolStripStatusLabel progressLabel) { _parentForm = parentForm; _powerShellHostUi = new PowerShellHostUi(terminal, executeHelper, progressBar, progressLabel); }
public SavingShellStreamNotifier(TerminalControl terminal, ShellStream stream, Stream output) { this.terminal = terminal; input = stream; this.output = output; middle = new ProxyStream(input); stream.DataReceived += Stream_DataReceived; outputTask = Task.Run(() => { do { outputWait.WaitOne(); if (outputQueue.IsEmpty) { break; } byte[] result; while (!outputQueue.TryDequeue(out result)) { ; } output.Write(result, 0, result.Length); } while (true); }); }
/// <summary> /// Default constructor. /// </summary> /// <param name="terminal">Terminal control that will display the PowerShell console.</param> public PowerShellRawUi(TerminalControl terminal, StreamConnection connection) { _terminal = terminal; _backgroundColor = ClosestConsoleColor(_terminal.BackColor); _foregroundColor = ClosestConsoleColor(_terminal.ForeColor); _connection = connection; }
public Form1() { InitializeComponent(); m_terminal = new TerminalControl(); m_terminal.Dock = DockStyle.Fill; Controls.Add(m_terminal); }
private static TerminalControl CastOrCreateTerminalControl(IPoderosaView view) { TerminalControl c = CastTerminalControl(view); if(c!=null) return c; //キャストできればそれでOK。でなければ作る Debug.WriteLine("Creating New TerminalControl"); IContentReplaceableView rv = (IContentReplaceableView)view.GetAdapter(typeof(IContentReplaceableView)); TerminalControl tc = new TerminalControl(); rv.ReplaceContent(new TerminalView(view.ParentForm, tc)); return tc; }
public static CommandResult OpenShortcutFile(ICommandTarget target, string filename) { IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target); if (window == null) { window = (IPoderosaMainWindow)CommandTargetUtil.AsViewOrLastActivatedView(target).ParentForm.GetAdapter(typeof(IPoderosaMainWindow)); } if (window == null) { return(CommandResult.Ignored); } if (!File.Exists(filename)) { window.Warning(String.Format("{0} is not a file", filename)); return(CommandResult.Failed); } ShortcutFileContent f = null; try { f = ShortcutFileContent.LoadFromXML(filename); } catch (Exception ex) { //変なファイルをドロップしたなどで例外は簡単に起こりうる window.Warning(String.Format("Failed to read {0}\n{1}", filename, ex.Message)); return(CommandResult.Failed); } try { //独立ウィンドウにポップアップさせるようなことは考えていない IContentReplaceableView rv = (IContentReplaceableView)target.GetAdapter(typeof(IContentReplaceableView)); if (rv == null) { rv = (IContentReplaceableView)window.ViewManager.GetCandidateViewForNewDocument().GetAdapter(typeof(IContentReplaceableView)); } TerminalControl tc = (TerminalControl)rv.GetCurrentContent().GetAdapter(typeof(TerminalControl)); if (tc != null) //ターミナルコントロールがないときは無理に設定しにいかない { RenderProfile rp = f.TerminalSettings.UsingDefaultRenderProfile ? TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile() : f.TerminalSettings.RenderProfile; Size sz = tc.CalcTerminalSize(rp); f.TerminalParameter.SetTerminalSize(sz.Width, sz.Height); } ITerminalSession s = TerminalSessionsPlugin.Instance.TerminalSessionStartCommand.StartTerminalSession(target, f.TerminalParameter, f.TerminalSettings); return(s != null ? CommandResult.Succeeded : CommandResult.Failed); } catch (Exception ex) { RuntimeUtil.ReportException(ex); return(CommandResult.Failed); } }
public void Write(string text) { TerminalControl.SelectionStart = TerminalControl.Text.Length; TerminalControl.Text += text; TerminalControl.SelectionStart = TerminalControl.Text.Length; if (CurrentSystem.HasShiftoriumUpgrade("autoscrollterminal")) { TerminalControl.ScrollToCaret(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); terminalControl = new TerminalControl(View.Frame); terminalControl.ShellExited += () => { View.Window.Close(); }; View.AddSubview(terminalControl); terminalControl.StartShell(); }
public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) { Debug.WriteLineIf(DebugOpt.ViewManagement, "ATTACH VIEW"); Debug.Assert(document == _terminal.IDocument); TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView)); Debug.Assert(tv != null); TerminalControl tp = tv.TerminalControl; Debug.Assert(tp != null); tp.Attach(this); _terminalControl = tp; _terminal.Attached(tp); }
public override void _Ready() { _camera = GetNode <Camera>("RotationHelper/Camera"); _rotationHelper = GetNode <Spatial>("RotationHelper"); _flashlight = GetNode <SpotLight>("RotationHelper/Camera/Flashlight"); _rayCast = GetNode <RayCast>("RotationHelper/Camera/RayCast"); _terminalControl = GetNode <TerminalControl>("GUI/TerminalWrapper/Terminal"); _hotcode1Node = GetNode <HotCode>("GUI/HotCode1"); Input.SetMouseMode(Input.MouseMode.Captured); _spawn = GlobalTransform.origin; }
private void AwaitConnectResult() { mreConnect.WaitOne(); if (_terminalConnection != null) { _terminalControl = new TerminalControl(); _terminalSession = new TerminalSession(_terminalConnection, _terminalSettings); _terminalControl.Attach(_terminalSession); _connectCallback?.Invoke(this); } else { MessageBox.Show("Connection error : " + errorMsg, "Unable to connect", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) { Debug.WriteLineIf(DebugOpt.ViewManagement, "DETACH VIEW"); Debug.Assert(document == _terminal.IDocument); TerminalView tv = (TerminalView)view.GetAdapter(typeof(TerminalView)); Debug.Assert(tv != null); TerminalControl tp = tv.TerminalControl; Debug.Assert(tp != null); //Detachするときにはこのビューになっている必要あり if (!tp.IsDisposed) { _terminal.Detach(tp); tp.Detach(); } _terminalControl = null; }
/// <summary> /// Initializes everything with null values. For used by constructors. /// </summary> void SetZeroValues() { m_Line = null; m_ParDial = null; m_Offset = null; m_OffsetPoint = null; m_IsReversed = false; m_TermDial1 = null; m_TermLine1 = null; m_TermDial2 = null; m_TermLine2 = null; m_Par1 = null; m_Par2 = null; m_Term1 = null; m_Term2 = null; }
// This is a simplified/butchered app control, Chrome doesn't like being pushed around public AppControl(TerminalControl terminal, String executable, IEnumerable <String> arguments, Dictionary <String, String> environmentVariables) { _terminal = terminal; _environment = environmentVariables; if (File.Exists(executable)) { FileInfo fileInfo = new(executable); if (fileInfo.Directory != null) { _path = fileInfo.Directory.ToString(); _executable = executable; _parameters = arguments.Aggregate("", (current, argument) => current + " " + argument).Trim(); } } Padding = new Padding(0); }
public void startMsg() { GameObject tmpMsg = l.level[curMsg]; tmpMsg.transform.SetParent(gameObject.transform); tc = GameObject.Find("TerminalPanel").GetComponent <TerminalControl>(); // need to place tmpMsg.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); tmpMsg.GetComponent <RectTransform> ().offsetMax = new Vector2(-9, -9); tmpMsg.GetComponent <RectTransform> ().offsetMin = new Vector2(9, 515); tmpMsg.SetActive(true); Message tmp = tmpMsg.GetComponent <Message> (); tmp.waitSec(5); tmp.wait = 0; tmp.start(); //msgs.Add (tmpMsg); started = true; }
/// <summary> /// Destroys any dialogs that are currently displayed. /// </summary> void KillDialogs() { this.Container.Clear(); if (m_ParDial != null) { m_ParDial.Dispose(); m_ParDial = null; } if (m_TermDial1 != null) { m_TermDial1.Dispose(); m_TermDial1 = null; } if (m_TermDial2 != null) { m_TermDial2.Dispose(); m_TermDial2 = null; } }
public MapHandler(TerminalControl terminalCtl, WindowsFormsHost mapHost, Game game) { _terminal = new Terminal(ColumnCount, RowCount); terminalCtl.Terminal = _terminal; _mapHost = mapHost; _charWidth = terminalCtl.GlyphSheet.Width; _charHeight = terminalCtl.GlyphSheet.Height; _game = game; _game.HeroMoveEvent += HandleCreatureMoveEvent; _game.AttackEvent += GameAttackEvent; NewLevelCommand levelCommand = new NewLevelCommand { Width = ColumnCount, Height = RowCount, FOVRows = 20, Filter = (locHero, locSite) => MapCoordinates.Within(locHero, locSite, 15, 10, 12), Level = 0 }; _game.EnqueueAndProcess(levelCommand); terminalCtl.Size = terminalCtl.GetPreferredSize(new System.Drawing.Size()); _mainWindow = (MainWindow)Application.Current.MainWindow; }
/// <summary> /// 接続 /// </summary> public void Connect() { ITCPParameter tcp = null; // プロトコル if (_prof.Protocol == ConnectionMethod.Telnet) { // Telnet tcp = ConnectProfilePlugin.Instance.ProtocolService.CreateDefaultTelnetParameter(); tcp.Destination = _prof.HostName; tcp.Port = _prof.Port; ITelnetParameter telnetParameter = null; telnetParameter = (ITelnetParameter)tcp.GetAdapter(typeof(ITelnetParameter)); if (telnetParameter != null) { telnetParameter.TelnetNewLine = _prof.TelnetNewLine; } } else if ((_prof.Protocol == ConnectionMethod.SSH1) || (_prof.Protocol == ConnectionMethod.SSH2)) { // SSH ISSHLoginParameter ssh = ConnectProfilePlugin.Instance.ProtocolService.CreateDefaultSSHParameter(); tcp = (ITCPParameter)ssh.GetAdapter(typeof(ITCPParameter)); tcp.Destination = _prof.HostName; tcp.Port = _prof.Port; ssh.Method = (_prof.Protocol == ConnectionMethod.SSH1) ? SSHProtocol.SSH1 : SSHProtocol.SSH2; ssh.Account = _prof.UserName; ssh.AuthenticationType = ConvertAuth(_prof.AuthType); ssh.PasswordOrPassphrase = _prof.Password; ssh.IdentityFileName = _prof.KeyFile; ssh.LetUserInputPassword = (_prof.AutoLogin == true) ? false : true; } // TerminalSettings(表示プロファイル/改行コード/文字コード) ITerminalSettings terminalSettings = ConnectProfilePlugin.Instance.TerminalEmulatorService.CreateDefaultTerminalSettings(_prof.HostName, null); terminalSettings.BeginUpdate(); terminalSettings.RenderProfile = _prof.RenderProfile; terminalSettings.TransmitNL = _prof.NewLine; terminalSettings.Encoding = _prof.CharCode; terminalSettings.LocalEcho = false; terminalSettings.EndUpdate(); // TerminalParameter ITerminalParameter terminalParam = (ITerminalParameter)tcp.GetAdapter(typeof(ITerminalParameter)); // ターミナルサイズ(これを行わないとPoderosa起動直後のOnReceptionが何故か機能しない, 行わない場合は2回目以降の接続時は正常) IViewManager viewManager = CommandTargetUtil.AsWindow(ConnectProfilePlugin.Instance.WindowManager.ActiveWindow).ViewManager; IContentReplaceableView contentReplaceableView = (IContentReplaceableView)viewManager.GetCandidateViewForNewDocument().GetAdapter(typeof(IContentReplaceableView)); TerminalControl terminalControl = (TerminalControl)contentReplaceableView.GetCurrentContent().GetAdapter(typeof(TerminalControl)); if (terminalControl != null) { Size size = terminalControl.CalcTerminalSize(terminalSettings.RenderProfile); terminalParam.SetTerminalSize(size.Width, size.Height); } // 接続(セッションオープン) _terminalSession = (ITerminalSession)ConnectProfilePlugin.Instance.WindowManager.ActiveWindow.AsForm().Invoke(new OpenSessionDelegate(InvokeOpenSessionOrNull), terminalParam, terminalSettings); // 自動ログイン/SU/実行コマンド if (_terminalSession != null) { // 受信データオブジェクト作成(ユーザからのキーボード入力が不可) ReceptionData pool = new ReceptionData(); _terminalSession.Terminal.StartModalTerminalTask(pool); // Telnet自動ログイン if ((_prof.AutoLogin == true) && (_prof.Protocol == ConnectionMethod.Telnet)) { if (TelnetAutoLogin() != true) { return; } } // SU if ((_prof.AutoLogin == true) && (_prof.SUUserName != "")) { if (SUSwitch() != true) { return; } } // 実行コマンド if ((_prof.AutoLogin == true) && (_prof.ExecCommand != "")) { if (ExecCommand() != true) { return; } } // 受信データオブジェクト定義解除(ユーザからのキーボード入力を許可) _terminalSession.Terminal.EndModalTerminalTask(); } }
/// <summary> /// 动态创建控件 /// </summary> private void buildControl() { titlePanel = new Panel(); titlePanel.BackColor = ColorTranslator.FromHtml("#438EB9"); this.Controls.Add(titlePanel); // 注册鼠标事件到窗体 registerMouseEvent(titlePanel); corpName = new Label(); corpName.AutoSize = false; corpName.Text = "上海数码科技"; corpName.TextAlign = ContentAlignment.MiddleCenter; corpName.ForeColor = Color.Black; corpName.BackColor = Color.White; this.Controls.Add(corpName); systemTree = new BaseTreeView(); this.Controls.Add(systemTree); systemTree.BorderStyle = BorderStyle.None; systemTree.ItemHeight = 60; systemTree.Font = new Font("宋体", 10); systemTree.ImageList = initImages(); systemTree.NodeMouseClick += systemTree_NodeMouseClick; systemTree.Invalidate(); bar = new NativeBar(); this.Controls.Add(bar); // setCtrl = new SystemSetting(); this.Controls.Add(setCtrl); setCtrl.Visible = false; setCtrl.buildControl(); logPanel = new LoggerPannel(); this.Controls.Add(logPanel); logPanel.Visible = false; logPanel.buildControl(); roleCtrl = new RoleControl(); grantCtrl = new GrantControl(); this.Controls.Add(roleCtrl); this.Controls.Add(grantCtrl); roleCtrl.Visible = false; grantCtrl.Visible = false; roleCtrl.buildControl(); grantCtrl.buildControl(); orderControl = new OrderControl(); this.Controls.Add(orderControl); orderControl.buildControl(); orderControl.Visible = false; terminalCtrl = new TerminalControl(); this.Controls.Add(terminalCtrl); terminalCtrl.buildControl(); terminalCtrl.Visible = false; }
public TerminalTextWriter(TerminalControl terminalControl) { _terminalControl = terminalControl; }
// Use this for initialization void Start() { curActive = -1; messaging = gameObject.transform.Find("MessagingPanel").gameObject.GetComponent <MessageControl> (); terminal = gameObject.transform.Find("TerminalPanel").gameObject.GetComponent <TerminalControl> (); }
/// <summary> /// Reacts to selection of the OK button in the dialog. /// </summary> /// <param name="wnd">The dialog window. If this matches the dialog that /// this command knows about, the command will be executed (and, on success, /// the dialog will be destroyed). If it's some other window, it must /// be a sub-dialog created by our guy, so let it handle the request.</param> /// <returns>True if command finished ok</returns> internal override bool DialFinish(Control wnd) { // If it's the offset dialog that's just finished, grab info // from it, delete it, and go to the dialog for the first // terminal line. ISpatialDisplay view = ActiveDisplay; UpdateUI up = this.Update; if (m_ParDial != null) { // Get info from dialog (it'll be ONE of the two). The dialog // should only call this function after validating that one // of them is defined. m_OffsetPoint = m_ParDial.OffsetPoint; if (m_OffsetPoint == null) { m_Offset = m_ParDial.OffsetDistance; } // Destroy the dialog. KillDialogs(); // Calculate the positions for the parallel points. Calculate(); // Repaint what we know about. Draw(); // And start the dialog for the first terminal line. if (up != null) { m_TermDial1 = new TerminalControl(up, false); } else { m_TermDial1 = new TerminalControl(this, false); } //m_TermDial1.Show(); this.Container.Display(m_TermDial1); return(true); } if (m_TermDial1 != null) { // Get the first terminal line (if any). And the position. m_TermLine1 = m_TermDial1.TerminalLine; m_Term1 = m_TermDial1.TerminalPosition; // And move on to the 2nd terminal dialog. KillDialogs(); // Repaint what we know about. Draw(); // And start the dialog for the first terminal line. if (up != null) { m_TermDial2 = new TerminalControl(up, true); } else { m_TermDial2 = new TerminalControl(this, true); } this.Container.Display(m_TermDial2); //m_TermDial2.Show(); return(true); } if (m_TermDial2 == null) { throw new Exception("ParallelLineUI.DialFinish - No dialog!"); } // Get the nortthern terminal line (if any). And the position. m_TermLine2 = m_TermDial2.TerminalLine; m_Term2 = m_TermDial2.TerminalPosition; // Erase everything special that we've drawn. ErasePainting(); // And ensure the view has nothing selected (sometimes the line // last selected had been unhighlighted, although it's end points // stay highlighted for some reason). EditingController.Current.ClearSelection(); // If we are doing an update, remember the changes if (up != null) { // Get the original operation. ParallelLineOperation op = (ParallelLineOperation)up.GetOp(); if (op == null) { throw new Exception("ParallelLineUI.DialFinish - Unexpected edit type."); } // Note the offset (it SHOULD be defined) Observation offset = null; if (m_Offset != null) { offset = m_Offset; } else if (m_OffsetPoint != null) { offset = new OffsetPoint(m_OffsetPoint); } Debug.Assert(offset != null); // Remember the changes as part of the UI object (the original edit remains // unchanged for now) UpdateItemCollection changes = op.GetUpdateItems(m_Line, offset, m_TermLine1, m_TermLine2, m_IsReversed); if (!up.AddUpdate(op, changes)) { return(false); } } else { Observation offset = m_Offset; if (offset == null && m_OffsetPoint != null) { offset = new OffsetPoint(m_OffsetPoint); } Debug.Assert(offset != null); // Execute the edit ParallelLineOperation op = null; try { op = new ParallelLineOperation(m_Line, offset, m_TermLine1, m_TermLine2, m_IsReversed); op.Execute(); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); return(false); } } // Destroy the dialog(s). KillDialogs(); // Get the base class to finish up. return(FinishCommand()); }
public PasteToTerminalCommand(TerminalControl control) { _control = control; }
public static void OnProcessExited(TerminalControl terminal) => ProcessExited?.Invoke(terminal);
public ConsoleWriter(TerminalControl control) { this.control = control; // TerminalColor.ForegroundColorChanged += TerminalColor_ForegroundColorChanged; // TerminalColor.BackgroundColorChanged += TerminalColor_BackgroundColorChanged; }
public LibSshNetStreamNotifier(TerminalControl terminal, LibSshNetStream stream) { this.terminal = terminal; Stream = stream; stream.DataReceived += Stream_DataReceived; }
public ShellStreamNotifier(TerminalControl terminal, ShellStream stream) { this.terminal = terminal; Stream = stream; stream.DataReceived += Stream_DataReceived; }
/// <summary> /// Default constructor. /// </summary> /// <param name="terminal">Terminal control that will display the PowerShell console.</param> public PowerShellRawUi(TerminalControl terminal) { _terminal = terminal; _backgroundColor = ClosestConsoleColor(_terminal.TerminalPane.ConnectionTag.RenderProfile.BackColor); _foregroundColor = ClosestConsoleColor(_terminal.TerminalPane.ConnectionTag.RenderProfile.ForeColor); }
public ConsoleWriter(TerminalControl control) { this.control = control; }