示例#1
0
 public XTerm(ConnectionTag tag, ICharDecoder decoder)
     : base(tag, decoder)
 {
     _wrapAroundMode = true;
     _tabStops = new bool[tag.Connection.TerminalWidth];
     InitTabStops();
 }
示例#2
0
 public void CloseConnection(ConnectionTag tag)
 {
     _connection = tag.Connection;
     lock(this) {
         SendMessageCore(CService.CloseConnection);
     }
 }
示例#3
0
        private void connectSSHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Poderosa.Forms.MultiPaneControl mc = new Poderosa.Forms.MultiPaneControl();
            //mc.Dock = DockStyle.Fill;
            //mc.BackColor = System.Drawing.Color.AliceBlue;
            //tabPage1.Controls.Add(mc);

            InitialAction a = new InitialAction();
            //Poderosa.Forms.GFrame frame = new Poderosa.Forms.GFrame(a);
            ConnectionHistory hst = GApp.ConnectionHistory;

            Poderosa.Forms.LoginDialog dlg = new Poderosa.Forms.LoginDialog();

            TCPTerminalParam param = hst.TopTCPParam;

            dlg.ApplyParam(param);
            dlg.StartPosition = FormStartPosition.CenterParent;

            //if (GCUtil.ShowModalDialog(_frame, dlg) == DialogResult.OK)
            //frame.Show();
            //GCUtil.ShowModalDialog(frame, dlg);
            //dlg.ShowDialog();
            dlg._hostBox.Text            = "palm";
            dlg._methodBox.SelectedIndex = 2;
            dlg._portBox.Text            = "22";
            dlg._userNameBox.Text        = "bwilliam";
            dlg._passphraseBox.Text      = "lkmj9u";
            dlg.OnOK(null, null);

            Connection.ConnectionTag ct = dlg.Result;
        }
示例#4
0
 public void ClearTimerToConnectionTag(ConnectionTag ct)
 {
     if(ct.Timer!=null) {
         ct.Timer.Dispose();
         ct.Timer = null;
     }
 }
示例#5
0
 public PasteProcessor(ConnectionTag tag, string text)
 {
     _tag = tag;
     StringReader r = new StringReader(text);
     Fill(r);
     r.Close();
 }
示例#6
0
 public void ActivateConnection(ConnectionTag tag)
 {
     lock(this) {
         _connection = tag.Connection;
         SendMessageCore(CService.ActivateConnection);
     }
 }
示例#7
0
 public void Add(ConnectionTag t)
 {
     Debug.Assert(t != null);
     t.PositionIndex          = GEnv.Frame.PositionForNextConnection;
     t.PreservedPositionIndex = t.PositionIndex;
     _connections.Add(t);
     _activatedOrder.Add(t);
 }
示例#8
0
 public VT100Terminal(ConnectionTag tag, ICharDecoder decoder)
     : base(tag, decoder)
 {
     _insertMode = false;
     _scrollRegionRelative = false;
     bool sfu = tag.Connection.Param is SFUTerminalParam;
     _homePositionOnCSIJ2 = sfu;
 }
示例#9
0
 //�f�o�b�O�p�ɁA�O����XML�`�����O��ǂ�ŃG�~�����[�g�����
 public static void EmulateWithLog(XmlReader reader, ConnectionTag tag)
 {
     ITerminal term = tag.Terminal;
     TerminalDocument doc = tag.Document;
     StringBuilder buf = new StringBuilder();
     reader.ReadStartElement("terminal-log");
     try {
         do {
             if(reader.NodeType==XmlNodeType.Text || reader.NodeType==XmlNodeType.Whitespace)
                 buf.Append(reader.Value);
             else if(reader.NodeType==XmlNodeType.Element) {
                 if(reader.Name=="ESC") {
                     buf.Append((char)0x1B);
                     buf.Append(reader.GetAttribute("seq"));
                 }
                 else if(reader.Name=="BS")
                     buf.Append((char)0x8);
                 else if(reader.Name=="BEL")
                     buf.Append((char)0x7);
                 else if(reader.Name=="dump") {
                     buf = Flush(tag, buf);
                     doc.Dump(reader.GetAttribute("title"));
                 }
                 else if(reader.Name=="comment") {
                     buf = Flush(tag, buf);
                     while(reader.NodeType!=XmlNodeType.EndElement || reader.Name!="comment") {
                         reader.Read();
                         if(reader.NodeType==XmlNodeType.Text)
                             GEnv.InterThreadUIService.Warning(doc, reader.Value);
                     }
                 }
                 else if(reader.Name=="break") {
                     Debug.WriteLine("BREAK "+reader.GetAttribute("title"));
                     Debugger.Break();
                     buf = Flush(tag, buf);
                 }
                 else if(reader.Name=="PD") {
                     buf = Flush(tag, buf);
                 }
                 else if(reader.Name=="pause") {
                     buf = Flush(tag, buf);
                     GEnv.InterThreadUIService.Warning(doc, reader.GetAttribute("title"));
                 }
                 else if(reader.Name!="SI" && reader.Name!="SO" && reader.Name!="NUL" && reader.Name!="terminal-size")
                     Debug.WriteLine("Unsupported element "+reader.Name);
             }
             else if(reader.NodeType==XmlNodeType.EndElement) {
                 if(reader.Name=="terminal-log") {
                     Flush(tag, buf);
                 }
             }
         } while(reader.Read());
     }
     catch(Exception ex) {
         Debug.WriteLine(ex.Message);
         Debug.WriteLine(ex.StackTrace);
     }
 }
示例#10
0
 /// <summary>
 /// ����̑ΏۂɂȂ�h�L�������g�ƕ����̃G���R�[�f�B���O��w�肵�č\�z
 /// </summary>
 public AbstractTerminal(ConnectionTag tag, ICharDecoder decoder)
 {
     _tag = tag;
     _decoder = decoder;
     _terminalMode = TerminalMode.Normal;
     _currentdecoration = TextDecoration.Default;
     _manipulator = new GLineManipulator(80);
     _bufferForMacro = new StringBuilder();
     _signalForMacro = new AutoResetEvent(false);
 }
示例#11
0
 public static void EmulateWithLog(string filename, ConnectionTag tag)
 {
     _filename = filename;
     _tag = tag;
     //XmlTextReader r = new XmlTextReader(filename);
     //EmulateWithLog(r, tag);
     //r.Close();
     Thread th = new Thread(new ThreadStart(Run));
     th.Start();
 }
示例#12
0
        public void Reorder(int index, int newindex)
        {
            ConnectionTag ct = (ConnectionTag)_connections[index];

            _connections.RemoveAt(index);
            _connections.Insert(newindex, ct);
            if (_activeIndex == index)
            {
                _activeIndex = newindex;
            }
        }
示例#13
0
        public void Replace(ConnectionTag old, ConnectionTag ct)
        {
            int i = IndexOf(old);

            Debug.Assert(i != -1);
            _connections[i] = ct;

            i = _activatedOrder.IndexOf(old);
            Debug.Assert(i != -1);
            _activatedOrder[i] = ct;
        }
示例#14
0
 //Preservedなやつをみて決定
 public ConnectionTag GetCandidateOfLocation(int positionIndex, ConnectionTag excluding)
 {
     for (int i = _activatedOrder.Count - 1; i >= 0; i--)
     {
         ConnectionTag ct = (ConnectionTag)_activatedOrder[i];
         if (ct.PreservedPositionIndex == positionIndex && ct != excluding)
         {
             return(ct);
         }
     }
     return(null);
 }
示例#15
0
        public void ImportProperties(ConnectionTag src)
        {
            _renderProfile          = src.RenderProfile;
            _positionIndex          = src.PositionIndex;
            _preservedPositionIndex = src.PreservedPositionIndex;

            if (src.Button != null)
            {
                src.Button.Tag = this;
            }
            _tabButton = src.Button;
        }
示例#16
0
        public int IndexOf(ConnectionTag tag)
        {
            int i = 0;

            foreach (ConnectionTag t in _connections)
            {
                if (t == tag)
                {
                    return(i);
                }
                i++;
            }
            return(-1);
        }
示例#17
0
        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);
        }
示例#18
0
 public void SetTimerToConnectionTag(ConnectionTag ct)
 {
     if(GEnv.Options.KeepAliveInterval==0) {
         if(ct.Timer!=null) {
             ct.Timer.Dispose();
             ct.Timer = null;
         }
     }
     else {
         if(ct.Timer==null)
             ct.Timer = new Timer(new TimerCallback(OnTimer), ct, GEnv.Options.KeepAliveInterval, Timeout.Infinite);
         else
             ct.Timer.Change(GEnv.Options.KeepAliveInterval, Timeout.Infinite);
     }
 }
示例#19
0
        private void OnOK(object sender, EventArgs args)
        {
            _result = null;
            this.DialogResult = DialogResult.None;

            SerialTerminalParam param = ValidateParam();
            if(param==null) return;

            try {
                _result = CommunicationUtil.CreateNewSerialConnection(this, param);
                if(_result!=null)
                    this.DialogResult = DialogResult.OK;
            }
            catch(Exception ex) {
                GUtil.Warning(this, ex.Message);
            }
        }
示例#20
0
        private static StringBuilder Flush(ConnectionTag tag, StringBuilder buf)
        {
            char[] data = buf.ToString().ToCharArray();
            tag.Terminal.Input(data, 0, data.Length);
            tag.Pane.DataArrived();

            return new StringBuilder();
        }
示例#21
0
        public ConnectionTag NextConnection(ConnectionTag c)
        {
            int i = IndexOf(c);

            return(TagAt(i == _connections.Count - 1? 0 : i + 1));
        }
示例#22
0
 public PasteProcessor(ConnectionTag tag, TextReader reader)
 {
     _tag = tag;
     Fill(reader);
 }
示例#23
0
文件: GApp.cs 项目: rfyiamcool/solrex
 public void ShowContextMenu(System.Drawing.Point pt, ConnectionTag ct)
 {
     GApp.Frame.CommandTargetConnection = ct.Connection;
     //���j���[��UI����
     GApp.Frame.AdjustContextMenu(true, ct.Connection);
     GApp.Frame.ContextMenu.Show(GApp.Frame, pt);
 }
示例#24
0
 //ISocketWithTimeoutClient �����͂��̃E�B���h�E�Ƃ͕ʂ̃X���b�h�Ŏ��s�����̂ŐT�d��
 public void SuccessfullyExit(object result)
 {
     _result = (ConnectionTag)result;
     //_result.SetServerInfo(((TCPTerminalParam)_result.Param).Host, swt.IPAddress);
     Win32.SendMessage(_savedHWND, GConst.WMG_ASYNCCONNECT, IntPtr.Zero, new IntPtr(1));
 }
示例#25
0
 public bool Check(ConnectionTag ct)
 {
     return ct.PositionIndex==_positionIndex && _ignore!=ct.Connection;
 }
示例#26
0
文件: GApp.cs 项目: nospy/EasyConnect
 public void RemoveConnection(ConnectionTag ct)
 {
     GApp.Frame.RemoveConnection(ct);
 }
示例#27
0
 public void SetConnectionLocation(ConnectionTag ct, IPoderosaTerminalPane pane)
 {
     if(ct.AttachedPane==null) { //��\���̂Ƃ�
         ct.PositionIndex = GetPaneIndex(pane);
         ct.PreservedPositionIndex = ct.PositionIndex; //�蓮�Őݒ肳�ꂽ�Ƃ��͂����ւ�L�^
         ActivateConnection(ct);
     }
     else {
         ActivateConnection(ct);
         MovePane(ct, GetPaneIndex(pane));
     }
 }
示例#28
0
        private void MovePane(ConnectionTag ct, int destinationIndex)
        {
            //�ʒu�̕ύX
            //�ړ���ɕ\��
            //Debug.WriteLine("--------");
            //GEnv.Connections.Dump();
            int originalPos = ct.PositionIndex;
            Debug.Assert(originalPos!=destinationIndex);
            ct.PositionIndex = destinationIndex;
            TerminalPane pane = GetPane(destinationIndex);
            if(ct.AttachedPane!=null) ct.AttachedPane.Detach();
            if(pane.FakeVisible) pane.Detach();
            pane.FakeVisible = true;
            pane.Attach(ct);
            pane.Focus();
            GEnv.Frame.RefreshConnection(ct);
            //GEnv.Connections.Dump();

            //������PreservedPositionIndex��ݒ�
            ct.PreservedPositionIndex = destinationIndex;

            //�ړ����ɕʂ̌�₪����΂����\��
            ConnectionTag orig = GEnv.Connections.GetCandidateOfActivation(originalPos, ct);
            if(orig!=null) {
                //orig.PaneType = CalcPaneType(orig);
                GetPane(originalPos).Attach(orig);
                GEnv.Frame.RefreshConnection(orig);
            }
            else {
                GetPane(originalPos).FakeVisible = false;
            }
        }
示例#29
0
        public void Connect(Control control)
        {
            // Save old log info in case this is a reconnect
            Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default;
            string file = null;
            if (this.TerminalPane.Connection != null)
            {
                logType = this.TerminalPane.Connection.LogType;
                file = this.TerminalPane.Connection.LogPath;
                //GApp.GetConnectionCommandTarget().Close();
                this.TerminalPane.Connection.Close();
                this.TerminalPane.Detach();
            }

            try
            {
                //------------------------------------------------------------------------
                SSHTerminalParam sshp = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password);
                sshp.AuthType = this.AuthType;
                sshp.IdentityFile = this.IdentifyFile;
                sshp.Encoding = EncodingType.ISO8859_1;
                sshp.Port = 22;
                sshp.RenderProfile = new RenderProfile();
                sshp.TerminalType = TerminalType.XTerm;

                CommunicationUtil.SilentClient s = new CommunicationUtil.SilentClient();
                Size sz = this.Size;

                SocketWithTimeout swt;
                swt = new SSHConnector((Poderosa.ConnectionParam.SSHTerminalParam)sshp, sz, sshp.Passphrase, (HostKeyCheckCallback)null);
                swt.AsyncConnect(s, sshp.Host, sshp.Port);
                //var thread = new Thread(() =>
                //    {
                        while (swt.Succeeded == false)
                        {
                            Application.DoEvents();
                        }
                        ct = s.Wait(swt);

                        control.Invoke((MethodInvoker)(
                            () =>
                            {
                                this.TerminalPane.FakeVisible = true;

                                this.TerminalPane.Attach(ct);
                                ct.Receiver.Listen();
                                //-------------------------------------------------------------
                                if (file != null)
                                    this.SetLog((LogType)logType, file, true);
                                this.TerminalPane.ConnectionTag.RenderProfile = new RenderProfile();
                                this.SetPaneColors(Color.LightBlue, Color.Black);
                            }
                            ));
                 //   });
                //start thread
                //thread.Start();
            }
            catch
            {
                //MessageBox.Show(e.Message, "Connection Error");
                return;
            }
        }
示例#30
0
        public void Detach()
        {
            if(_inIMEComposition) ClearIMEComposition();
            if(InFreeSelectionMode) ExitFreeSelectionMode();
            if(InAutoSelectionMode) ExitAutoSelectionMode();

            if(_tag!=null) _tag.Pane = null;
            _tag = null;
            _caretTimer.Stop();
            _VScrollBar.Enabled = false;
        }
示例#31
0
 public void BringToActivationOrderTop(ConnectionTag ct)
 {
     _activeIndex = _connections.IndexOf(ct);
     _activatedOrder.Remove(ct);
     _activatedOrder.Add(ct);
 }
示例#32
0
        public ConnectionTag PrevConnection(ConnectionTag c)
        {
            int i = IndexOf(c);

            return(TagAt(i == 0? _connections.Count - 1 : i - 1));
        }
示例#33
0
        //�w��̐ڑ���A�N�e�B�u�ɂ���
        public void ActivateConnection(ConnectionTag ct)
        {
            //ct.PaneType = CalcPaneType(ct);
            TerminalPane pane = GetPane(ct.PositionIndex);
            //���ɃR�l�N�V����������΂����UI����t���b�V��
            if(pane.Connection!=null) {
                ConnectionTag k = GEnv.Connections.FindTag(pane.Connection);
                if(k!=null) { //�����Ŋ��ɕ‚����ڑ��������Ă��܂����Ƃ�����B�{���͐ڑ���‚���Ƃ��ɎQ�Ƃ������ׂ������蔲��
                    pane.Detach();
                    GEnv.Frame.RefreshConnection(k);
                }
            }

            pane.FakeVisible = true;
            pane.Attach(ct);
            if(!pane.AsControl().Focused)
                pane.AsControl().Focus();
            GEnv.Frame.RefreshConnection(ct);
        }
示例#34
0
        public void InitUI(ContainerOptions prev, ContainerOptions opt)
        {
            ConnectionTag[] cons = new ConnectionTag[_panes.Length];
            for(int i=0; i<_panes.Length; i++) {
                cons[i] = (_panes[i]==null || !_panes[i].FakeVisible)? null : _panes[i].ConnectionTag;
                if(_panes[i]!=null) _panes[i].Detach();
                _panes[i] = null;
            }

            Controls.Clear();

            GFrameStyle style = opt.FrameStyle;
            int pane_count = StyleToPaneCount(style);
            int prev_pane_count = prev==null? 1 : StyleToPaneCount(prev.FrameStyle);
            bool is_vertical = style==GFrameStyle.DivVertical || style==GFrameStyle.DivVertical3;

            //Control�̏�����
            this.SuspendLayout();
            for(int i = pane_count-1; i>=0; i--) {
                TerminalPane p = new TerminalPane();
                _panes[i] = p;
                p.Visible = true;
                p.Dock = i==pane_count-1? DockStyle.Fill : is_vertical? DockStyle.Left : DockStyle.Top;
                if(i<pane_count-1) {
                    int a = (int)((is_vertical? this.Width : this.Height) * (i==0? 0 : _splitterRatio[pane_count-2][i-1]));
                    int b = (int)((is_vertical? this.Width : this.Height) * (_splitterRatio[pane_count-2][i] - (i==0? 0 : _splitterRatio[pane_count-2][i-1])));
                    if(is_vertical) {
                        p.Left = a;
                        p.Width = b;
                    }
                    else {
                        p.Top = a;
                        p.Height = b;
                    }
                }
                this.Controls.Add(p);

                if(i>0) {
                    Splitter s = new Splitter();
                    _splitters[i-1] = s;
                    s.SplitterMoving += new SplitterEventHandler(this.OnSplitterMoving);
                    s.SplitterMoved  += new SplitterEventHandler(this.OnSplitterMoved);
                    s.Dock = is_vertical? DockStyle.Left : DockStyle.Top;
                    s.BorderStyle = BorderStyle.Fixed3D;
                    s.MinSize = 8;
                    s.SplitPosition = (int)((is_vertical? this.Width : this.Height) * _splitterRatio[pane_count-2][i-1]);
                    this.Controls.Add(s);
                }
            }
            this.ResumeLayout(true);

            //�K�v�Ȃ�̂�Attach
            foreach(ConnectionTag ct in GEnv.Connections.OrderedConnections) {
                int pos = ct.PositionIndex;
                if(prev_pane_count<pane_count && ct.PreservedPositionIndex>=prev_pane_count) { //�������y�C���ւ̋������蓖��
                    pos = ct.PreservedPositionIndex;
                    if(pos >= pane_count) pos = pane_count-1;
                    ct.PositionIndex = pos;
                    if(_panes[pos].ConnectionTag==null) {
                        _panes[pos].Attach(ct);
                        _panes[pos].FakeVisible = true;
                        GEnv.Frame.RefreshConnection(ct);
                    }
                }
                else if(pos < pane_count) { //���a�ȏꍇ
                    if(_panes[pos].ConnectionTag==null) {
                        _panes[pos].Attach(ct);
                        _panes[pos].FakeVisible = true;
                        GEnv.Frame.RefreshConnection(ct);
                    }
                }
                else { //�B���ꍇ
                    ct.PositionIndex = pane_count-1;
                    if(ct!=null && _panes[pane_count-1].ConnectionTag==null) {
                        _panes[pane_count-1].Attach(ct);
                        _panes[pane_count-1].FakeVisible = true;
                        GEnv.Frame.RefreshConnection(ct);
                    }
                }
            }
        }
示例#35
0
文件: GApp.cs 项目: nospy/EasyConnect
 public void ActivateConnection(ConnectionTag ct)
 {
     GApp.GlobalCommandTarget.ActivateConnection2(ct);
 }
示例#36
0
文件: GApp.cs 项目: nospy/EasyConnect
 public static ContainerConnectionCommandTarget GetConnectionCommandTarget(ConnectionTag tag)
 {
     return new ContainerConnectionCommandTarget(tag.Connection);
 }
        //TerminalConnection
        protected override void AddNewTerminalInternal(ConnectionTag con)
        {
            GApp.ConnectionHistory.Update(con.Connection.Param);
            _frame.AddConnection(con);
            _frame.AdjustMRUMenu();

            ActivateConnection(con.Connection);
            _frame.RefreshConnection(con);
        }
示例#38
0
文件: GApp.cs 项目: nospy/EasyConnect
 public void RefreshConnection(ConnectionTag ct)
 {
     GApp.Frame.RefreshConnection(ct);
 }
 public override CommandResult SetConnectionLocation(ConnectionTag ct, TerminalPane pane)
 {
     if(ct.AttachedPane==pane) return CommandResult.Ignored;
     _frame.PaneContainer.SetConnectionLocation(ct, pane);
     return CommandResult.Success;
 }
示例#40
0
文件: GApp.cs 项目: nospy/EasyConnect
        public void ShowContextMenu(System.Drawing.Point pt, ConnectionTag ct)
        {
            //GApp.Frame.CommandTargetConnection = ct.Connection;
            //���j���[��UI����
            //GApp.Frame.AdjustContextMenu(true, ct.Connection);
            //GApp.Frame.ContextMenu.Show(GApp.Frame.PaneContainer, pt);

            //foreach (TerminalPane p in GApp.Frame._multiPaneControl._panes)
            //{
                //if (p.Visible)
                    //GApp.Frame.ContextMenu.Show(p, pt);
            //}
        }
示例#41
0
        public void Attach(ConnectionTag tag)
        {
            _tag = tag;
            _tag.Pane = this;
            lock(_tag.Document) {

                _ignoreValueChangeEvent = true;
                _tag.Receiver.CommitScrollBar(_VScrollBar, false);
                _ignoreValueChangeEvent = false;

                if(!GetConnection().IsClosed) {
                    Size ts = TerminalSize;
                    if(ts.Width!=GetConnection().TerminalWidth || ts.Height!=GetConnection().TerminalHeight)
                        ResizeTerminal(ts.Width, ts.Height);
                }

                if(_fakeVisible)
                    this.BackColor = GetRenderProfile().BackColor;
            }

            if(!_caretTimer.Enabled) _caretTimer.Start();

            Invalidate(true);
        }