Exemple #1
0
 public void IsolateSettings()
 {
     AssureContent();
     //TerminalParam, Settingsそれぞれでクローンを持つように変化させる
     _terminalParam    = (ITerminalParameter)_terminalParam.Clone();
     _terminalSettings = _terminalSettings.Clone();
 }
        private void ApplyParam(ICygwinParameter shellparam, ITerminalSettings terminalSettings)
        {
            _param = (ICygwinParameter)shellparam.Clone();
            this.TerminalSettings = terminalSettings.Clone();

            this.Text = TEnv.Strings.GetString("Form.CygwinLoginDialog.TextCygwin");
        }
Exemple #3
0
        public void ApplyParam(IAdaptable destination, ITerminalSettings terminal)
        {
            _initializing = true;
            Debug.Assert(destination != null);
            Debug.Assert(terminal != null);
            this.TerminalSettings = terminal.Clone();

            ITCPParameter      tcp_destination = (ITCPParameter)destination.GetAdapter(typeof(ITCPParameter));
            ISSHLoginParameter ssh_destination = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter));
            bool is_telnet = ssh_destination == null;

            _methodBox.SelectedIndex = is_telnet? 0 : ssh_destination.Method == SSHProtocol.SSH1? 1 : 2;
            _portBox.SelectedIndex   = _portBox.FindStringExact(PortDescription(tcp_destination.Port));
            if (ssh_destination != null)
            {
                _userNameBox.SelectedIndex = _userNameBox.FindStringExact(ssh_destination.Account);
                _passphraseBox.Text        = ssh_destination.PasswordOrPassphrase;

                if (ssh_destination.AuthenticationType == AuthenticationType.PublicKey)
                {
                    _privateKeyFile.Text = ssh_destination.IdentityFileName;
                }
                else
                {
                    _privateKeyFile.Text = "";
                }
                _authOptions.SelectedIndex = ToAuthenticationIndex(ssh_destination.AuthenticationType);
            }

            IAutoExecMacroParameter autoExecParams = destination.GetAdapter(typeof(IAutoExecMacroParameter)) as IAutoExecMacroParameter;

            if (autoExecParams != null && TelnetSSHPlugin.Instance.MacroEngine != null)
            {
                _autoExecMacroPathBox.Text = (autoExecParams.AutoExecMacroPath != null) ? autoExecParams.AutoExecMacroPath : String.Empty;
            }
            else
            {
                _autoExecMacroPathLabel.Enabled    = false;
                _autoExecMacroPathBox.Enabled      = false;
                _selectAutoExecMacroButton.Enabled = false;
            }

            _encodingBox.SelectedIndex     = (int)terminal.Encoding;
            _newLineBox.SelectedIndex      = (int)terminal.TransmitNL;
            _localEchoBox.SelectedIndex    = terminal.LocalEcho? 1 : 0;
            _terminalTypeBox.SelectedIndex = (int)terminal.TerminalType;
            _initializing = false;

            EnableValidControls();
        }
        private void ApplyParam(ICygwinParameter shellparam, ITerminalSettings terminalSettings) {
            _param = (ICygwinParameter)shellparam.Clone();
            this.TerminalSettings = terminalSettings.Clone();

            this.Text = TEnv.Strings.GetString("Form.CygwinLoginDialog.TextCygwin");

        }
        public void ApplyParam(IAdaptable destination, ITerminalSettings terminal) {
            _initializing = true;
            Debug.Assert(destination != null);
            Debug.Assert(terminal != null);
            this.TerminalSettings = terminal.Clone();

            ITCPParameter tcp_destination = (ITCPParameter)destination.GetAdapter(typeof(ITCPParameter));
            ISSHLoginParameter ssh_destination = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter));
            bool is_telnet = ssh_destination == null;

            _methodBox.SelectedItem =
                is_telnet ? ConnectionMethod.Telnet :
                    ssh_destination.Method == SSHProtocol.SSH1 ? ConnectionMethod.SSH1 : ConnectionMethod.SSH2; // select ListItem<T> by T
            _portBox.SelectedIndex = _portBox.FindStringExact(PortDescription(tcp_destination.Port));
            if (ssh_destination != null) {
                _userNameBox.SelectedIndex = _userNameBox.FindStringExact(ssh_destination.Account);
                _passphraseBox.Text = ssh_destination.PasswordOrPassphrase;

                if (ssh_destination.AuthenticationType == AuthenticationType.PublicKey)
                    _privateKeyFile.Text = ssh_destination.IdentityFileName;
                else
                    _privateKeyFile.Text = "";
                _authOptions.SelectedItem = ToAuthType(ssh_destination.AuthenticationType); // select EnumListItem<T> by T
            }

            IAutoExecMacroParameter autoExecParams = destination.GetAdapter(typeof(IAutoExecMacroParameter)) as IAutoExecMacroParameter;
            if (autoExecParams != null && TelnetSSHPlugin.Instance.MacroEngine != null) {
                _autoExecMacroPathBox.Text = (autoExecParams.AutoExecMacroPath != null) ? autoExecParams.AutoExecMacroPath : String.Empty;
            }
            else {
                _autoExecMacroPathLabel.Enabled = false;
                _autoExecMacroPathBox.Enabled = false;
                _selectAutoExecMacroButton.Enabled = false;
            }

            if (is_telnet) {
                ITelnetParameter telnetParams = (ITelnetParameter)destination.GetAdapter(typeof(ITelnetParameter));
                _telnetNewLine.Checked = (telnetParams != null) ? telnetParams.TelnetNewLine : true;
            }
            else {
                _telnetNewLine.Checked = true;
            }

            _encodingBox.SelectedItem = terminal.Encoding;              // select EnumListItem<T> by T
            _newLineBox.SelectedItem = terminal.TransmitNL;             // select EnumListItem<T> by T
            _localEchoBox.SelectedItem = terminal.LocalEcho;            // select ListItem<T> by T
            _terminalTypeBox.SelectedItem = terminal.TerminalType;      // select EnumListItem<T> by T
            _initializing = false;

            EnableValidControls();
        }