public ChangeLogDialog(TerminalConnection current) { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); this._logTypeLabel.Text = GApp.Strings.GetString("Form.ChangeLog._logTypeLabel"); this._fileNameLabel.Text = GApp.Strings.GetString("Form.ChangeLog._fileNameLabel"); this._cancelButton.Text = GApp.Strings.GetString("Common.Cancel"); this._okButton.Text = GApp.Strings.GetString("Common.OK"); this.Text = GApp.Strings.GetString("Form.ChangeLog.Text"); // // _connection = current; _logTypeBox.SelectedIndex = _logTypeBox.FindStringExact(EnumDescAttributeT.For(typeof(LogType)).GetDescription(_connection.LogType)); if (_connection.LogType != LogType.None) { _fileNameBox.Items.Add(_connection.LogPath); _fileNameBox.SelectedIndex = 0; } foreach (string p in GApp.ConnectionHistory.LogPaths) { _fileNameBox.Items.Add(p); } AdjustUI(); }
public ServerInfo(TerminalConnection con) { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); // // _serverNamesBox.Text = con.ServerName; _IPAddressBox.Text = con.ServerAddress == null? "" : con.ServerAddress.ToString(); _protocolBox.Text = con.ProtocolDescription; _parameterBox.Lines = con.ConnectionParameter; _terminalTypeBox.Text = EnumDescAttributeT.For(typeof(TerminalType)).GetDescription(con.Param.TerminalType); string li = EnumDescAttributeT.For(typeof(LogType)).GetDescription(con.LogType); if (con.LogType != LogType.None) { li += "(" + con.LogPath + ")"; } _logBox.Text = li; _receiveBytes.Text = String.Format("{0,10}{1}", con.ReceivedDataSize, GApp.Strings.GetString("Caption.ServerInfo.BytesReceived")); _transmitBytes.Text = String.Format("{0,10}{1}", con.SentDataSize, GApp.Strings.GetString("Caption.ServerInfo.BytesSent")); this._okButton.Text = GApp.Strings.GetString("Common.OK"); this._serverNamesLabel.Text = GApp.Strings.GetString("Form.ServerInfo._serverNamesLabel"); this._IPAddressLabel.Text = GApp.Strings.GetString("Form.ServerInfo._IPAddressLabel"); this._protocolLabel.Text = GApp.Strings.GetString("Form.ServerInfo._protocolLabel"); this._terminalTypeLabel.Text = GApp.Strings.GetString("Form.ServerInfo._terminalTypeLabel"); this._parameterLabel.Text = GApp.Strings.GetString("Form.ServerInfo._parameterLabel"); this._statsLabel.Text = GApp.Strings.GetString("Form.ServerInfo._statsLabel"); this._logLabel.Text = GApp.Strings.GetString("Form.ServerInfo._logLabel"); this.Text = GApp.Strings.GetString("Form.ServerInfo.Text"); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="localPort">自分のポート</param> public RemoteHost(int localPort, DebugWindow debugwindow, TerminalConnection.TerminalConnection TC) { try { this.UP_Cliant = new UDP_PACKETS_CLIANT.UDP_PACKETS_CLIANT(localPort); this.UP_Encoder = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER(); this.UP_Decoder = new UDP_PACKETS_CODER.UDP_PACKETS_DECODER(); this.id = localPort; this.CTS = new CancellationTokenSource(); this.mytask = new Task(() => this.Main_Task(), CTS.Token); this.mytask.Start(); this.fpsa = new FPSAdjuster.FPSAdjuster(); this.debugwindow = debugwindow; this.debugwindow.DebugLog = "[Port:" + localPort.ToString() + "]受信を開始します"; this.TC = TC; } catch (Exception ex) { while (true) { myDialog dialog = new myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
public void DisconnectedFromServer(TerminalConnection con) { lock (this) { _connection = con; SendMessageCore(Service.DisconnectedFromServer); } }
private int _size; //サイズは_firstLine/lastLineから計算可能だがよく使うのでキャッシュ internal TerminalDocument(TerminalConnection con) { _connection = con; Clear(); _scrollingTop = -1; _scrollingBottom = -1; }
private void StopStreaming() { StreamManifest.Dispose(); StreamManifest = null; buffer = null; TerminalConnection?.Unsuspend(); }
public ConnectionTag(TerminalConnection c) { _connection = c; _pane = null; _invalidateParam = new InvalidateParam(); _tabButton = null; _document = new TerminalDocument(_connection); _receiver = new TerminalDataReceiver(this); _terminated = false; _timer = null; _windowTitle = ""; //nullのときはデフォルトプロファイルを使う _renderProfile = c.Param.RenderProfile; //VT100指定でもxtermシーケンスを送ってくるアプリケーションが後をたたないので //_terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); if (c.Param.TerminalType == TerminalType.XTerm || c.Param.TerminalType == TerminalType.KTerm) { _terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); } else { _terminal = new VT100Terminal(this, new JapaneseCharDecoder(_connection)); } GEnv.Connections.KeepAlive.SetTimerToConnectionTag(this); }
public void DisconnectedFromServer() { if(GEnv.Frame.IgnoreErrors) return; _tag.NotifyDisconnect(); TerminalConnection c = _tag.Connection; GEnv.InterThreadUIService.DisconnectedFromServer(c); }
public void CloseConnection(ConnectionTag tag) { _connection = tag.Connection; lock (this) { SendMessageCore(CService.CloseConnection); } }
public void ActivateConnection(ConnectionTag tag) { lock (this) { _connection = tag.Connection; SendMessageCore(CService.ActivateConnection); } }
public void SetPanePosition(ConnectionTag tag, PanePosition pos) { lock (this) { _connection = tag.Connection; _destinationPanePosition = pos; SendMessageCore(CService.SetPanePosition); } }
public void DataArrived(byte[] data, int offset, int count) { try { TerminalConnection con = _tag.Connection; con.AddReceivedDataStats(count); con.BinaryLogger.Append(data, offset, count); if(_tag.ModalTerminalTask!=null && _tag.ModalTerminalTask.CanReceive) _tag.ModalTerminalTask.Input(data, offset, count); else { TerminalDocument document = _tag.Document; lock(document) { _tag.InvalidateParam.Reset(); _tag.Terminal.Input(data, offset, count); //右端にキャレットが来たときは便宜的に次行の頭にもっていく if(document.CaretColumn==_tag.Connection.TerminalWidth) { document.CurrentLineNumber++; //これによって次行の存在を保証 document.CaretColumn = 0; } CheckDiscardDocument(); AdjustTransientScrollBar(); int n = document.CurrentLineNumber-_tag.Connection.TerminalHeight+1-document.FirstLineNumber; if(n < 0) n = 0; //Debug.WriteLine(String.Format("E={0} C={1} T={2} H={3} LC={4} MAX={5} n={6}", _transientScrollBarEnabled, _tag.Document.CurrentLineNumber, _tag.Document.TopLineNumber, _tag.Connection.TerminalHeight, _transientScrollBarLargeChange, _transientScrollBarMaximum, n)); if(IsAutoScrollMode(n)) { _transientScrollBarValue = n; document.TopLineNumber = n + document.FirstLineNumber; } else _transientScrollBarValue = document.TopLineNumber - document.FirstLineNumber; _tag.NotifyUpdate(); } //Invalidateをlockの外に出す。このほうが安全と思われた if(_tag.Pane!=null) _tag.InvalidateParam.InvokeFor(_tag.Pane); ITerminalTextLogger tl = con.TextLogger; if(tl!=null) { tl.PacketDelimiter(); tl.Flush(); } } ITerminalBinaryLogger bl = con.BinaryLogger; if(bl!=null) bl.Flush(); } catch(Exception ex) { GEnv.InterThreadUIService.ReportCriticalError(ex); } }
public ConnectionTag FindTag(TerminalConnection con) { foreach (ConnectionTag t in _connections) { if (t.Connection == con) { return(t); } } return(null); }
public void RefreshConnection(ConnectionTag tag) { TerminalDocument doc = tag.Document; Monitor.Exit(doc); lock (this) { _connection = tag.Connection; SendMessageCore(Service.RefreshConnection); } Monitor.Enter(doc); }
public CommandResult MoveToNextPane() { Connections cc = GEnv.Connections; TerminalConnection a = cc.ActiveConnection; if (a == null) { return(CommandResult.Ignored); } ActivateConnection(cc.NextConnection(cc.FindTag(a)).Connection); return(CommandResult.Success); }
public JapaneseCharDecoder(TerminalConnection con) { _jisbuf = new MemoryStream(0x1000); _state = State.Normal; _connection = con; _encoding = con.Param.EncodingProfile; _iso2022jpByteProcessor = new ByteProcessor(this.ProcessByteAsISO2022JP); _DECLineByteProcessor = new ByteProcessor(this.ProcessByteAsDECLine); _currentByteProcessor = null; _G0ByteProcessor = null; _G1ByteProcessor = null; }
public int IndexOf(TerminalConnection con) { int i = 0; foreach (ConnectionTag t in _connections) { if (t.Connection == con) { return(i); } i++; } return(-1); }
public void ApplyParam(TerminalConnection con) { _con = con; SerialTerminalParam param = (SerialTerminalParam)con.Param; _portBox.Text = "COM" + param.Port; _baudRateBox.SelectedIndex = _baudRateBox.FindStringExact(param.BaudRate.ToString()); _dataBitsBox.SelectedIndex = param.ByteSize == 7? 0 : 1; _parityBox.SelectedIndex = (int)param.Parity; _stopBitsBox.SelectedIndex = (int)param.StopBits; _flowControlBox.SelectedIndex = (int)param.FlowControl; _transmitDelayPerCharBox.Text = param.TransmitDelayPerChar.ToString(); _transmitDelayPerLineBox.Text = param.TransmitDelayPerLine.ToString(); }
//Activateの処理中は、GEnc.Coonectionsから取れるActiveConnectionは古いやつである。 public CommandResult ActivateConnection(TerminalConnection con) { if (con == GEnv.Connections.ActiveConnection) { IPoderosaTerminalPane p = GEnv.Connections.FindTag(con).AttachedPane; if (p != null && !p.AsControl().Focused) { p.AsControl().Focus(); //!!アクティブなコネクションだからPaneがnullってことはないはずだが、そうなってしまうケースがあるようだ。真の原因は別にあるはずだが未解明 } return(CommandResult.Success); } return(ActivateConnection2(con == null? null : GEnv.Connections.FindTag(con))); }
internal void Remove(TerminalConnection con) { int i = IndexOf(con); if (i == -1) { return; //本当はこういうのはよろしくないが } ConnectionTag ct = this.TagAt(i); _connections.RemoveAt(i); _activatedOrder.Remove(ct); _activeIndex = Math.Min(_activeIndex, _connections.Count - 1); }
public void SaveTo(IFavorite favorite) { var consoleOptions = TerminalConnection.GetConsoleOptions(favorite); if (consoleOptions == null) { return; } consoleOptions.BackColor = BackColorTextBox.Text; consoleOptions.Font = FontTextbox.Text; consoleOptions.CursorColor = CursorColorTextBox.Text; consoleOptions.TextColor = TextColorTextBox.Text; consoleOptions.Columns = Convert.ToInt32(ColumnsTextBox.Text); consoleOptions.Rows = Convert.ToInt32(RowsTextBox.Text); }
public void LoadFrom(IFavorite favorite) { // replace with shared method var consoleOptions = TerminalConnection.GetConsoleOptions(favorite); if (consoleOptions == null) { return; } BackColorTextBox.Text = consoleOptions.BackColor; FontTextbox.Text = consoleOptions.Font; CursorColorTextBox.Text = consoleOptions.CursorColor; TextColorTextBox.Text = consoleOptions.TextColor; ColumnsTextBox.Text = consoleOptions.Columns.ToString(); RowsTextBox.Text = consoleOptions.Rows.ToString(); }
public ConnectionTag(TerminalConnection c) { _connection = c; _pane = null; _invalidateParam = new InvalidateParam(); _tabButton = null; _document = new TerminalDocument(_connection); _receiver = new TerminalDataReceiver(this); _terminated = false; _timer = null; _windowTitle = ""; _renderProfile = c.Param.RenderProfile; _terminal = new XTerm(this, new JapaneseCharDecoder(_connection)); GEnv.Connections.KeepAlive.SetTimerToConnectionTag(this); }
public LineFeedStyleDialog(TerminalConnection con) { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); // // this._cancelButton.Text = GApp.Strings.GetString("Common.Cancel"); this._okButton.Text = GApp.Strings.GetString("Common.OK"); this._lineFeedLabel.Text = GApp.Strings.GetString("Form.LineFeedStyleDialog._lineFeedLabel"); this.Text = GApp.Strings.GetString("Form.LineFeedStyleDialog.Text"); this._lineFeedBox.Items.AddRange(EnumDescAttributeT.For(typeof(LineFeedRule)).DescriptionCollection()); this._lineFeedBox.SelectedIndex = (int)con.Param.LineFeedRule; }
public void EnableTerminalUI(bool enabled, TerminalConnection con) { _blockEventHandler = true; _saveShortcut.Enabled = enabled; _newLineOption.Enabled = enabled && !con.IsClosed; _logSuspend.Enabled = enabled && !con.IsClosed && con.TextLogger.IsActive; _localEcho.Enabled = enabled && !con.IsClosed; _lineFeedRule.Enabled = enabled && !con.IsClosed; _encodingBox.Enabled = enabled && !con.IsClosed; _serverInfo.Enabled = enabled; _commentLog.Enabled = enabled && !con.IsClosed && con.TextLogger.IsActive; if (enabled) { _newLineOption.SelectedIndex = (int)con.Param.TransmitNL; _encodingBox.SelectedIndex = (int)con.Param.EncodingProfile.Type; _logSuspend.Checked = con.LogSuspended; _localEcho.Checked = con.Param.LocalEcho; } _blockEventHandler = false; Invalidate(true); }
/// <inheritdoc /> public void StreamResult(ISerializedResult result, int messageSize, TimeSpan?timeElapsed = null, bool writeHeaders = false, bool disposeResult = true) { if (result == null) { throw new ArgumentNullException(nameof(result)); } if (!result.IsSerialized) { result = result.Serialize(); } if (!(result is Content content) || !(content.Body?.Length > 0)) { SendResult(result, result.TimeElapsed, writeHeaders, disposeResult); return; } if (content.IsLocked) { throw new InvalidOperationException("Unable to stream a result that is already assigned to a different streaming " + "job. A result can only be streamed once."); } content.IsLocked = true; TerminalConnection?.Suspend(); if (messageSize < MinStreamBufferSize) { messageSize = MinStreamBufferSize; } else if (MaxStreamBufferSize < messageSize) { messageSize = MaxStreamBufferSize; } StreamManifest?.Dispose(); StreamManifest = new StreamManifest(content, messageSize); SendJson(StreamManifest); buffer = null; }
internal static ConnectionCommandTarget GetConnectionCommandTarget(TerminalConnection con) { return new ConnectionCommandTarget(con); }
public static ContainerConnectionCommandTarget GetConnectionCommandTarget(TerminalConnection con) { return(new ContainerConnectionCommandTarget(con)); }
public static ContainerConnectionCommandTarget GetConnectionCommandTarget() { TerminalConnection con = GEnv.Connections.ActiveConnection; return(con == null? null : new ContainerConnectionCommandTarget(con)); }
public ConnectionCommandTarget(TerminalConnection con) { _connection = con; }
internal static ConnectionCommandTarget GetConnectionCommandTarget(TerminalConnection con) { return(new ConnectionCommandTarget(con)); }
public ContainerConnectionCommandTarget(TerminalConnection con) : base(con) { }