/// <summary>
        /// プロファイルを新規作成
        /// </summary>
        /// <param name="proflist">プロファイルリスト</param>
        public void NewProfileCommand(ConnectProfileList proflist)
        {
            ProfileEditForm dlg = new ProfileEditForm(null);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                AddProfileCommand(proflist, dlg.ResultProfile);
            }
        }
        /// <summary>
        /// プロファイルをコピーして編集
        /// </summary>
        /// <param name="proflist">プロファイルリスト</param>
        /// <param name="prof">コピー元プロファイル</param>
        public void CopyEditProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof)
        {
            ProfileEditForm dlg = new ProfileEditForm(prof);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                proflist.AddProfile(dlg.ResultProfile);
            }
        }
        /// <summary>
        /// カレントセッションプロファイルを新規作成
        /// </summary>
        /// <param name="ts">ターミナルセッション</param>
        public void NewProfileCurrentSessionCommand(ITerminalSession ts)
        {
            ISSHLoginParameter   ssh    = (ISSHLoginParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ISSHLoginParameter));
            ITelnetParameter     telnet = (ITelnetParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITelnetParameter));
            ITCPParameter        tcp    = null;
            ConnectProfileStruct prof   = new ConnectProfileStruct();

            // プロトコルチェック
            if (telnet != null)
            {
                // Telnet
                tcp                = (ITCPParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITCPParameter));
                prof.Protocol      = ConnectionMethod.Telnet;
                prof.HostName      = tcp.Destination;
                prof.Port          = tcp.Port;
                prof.TelnetNewLine = telnet.TelnetNewLine;
            }
            else
            {
                // SSH
                tcp            = (ITCPParameter)ssh.GetAdapter(typeof(ITCPParameter));
                prof.HostName  = tcp.Destination;
                prof.Port      = tcp.Port;
                prof.UserName  = ssh.Account;
                prof.Password  = ssh.PasswordOrPassphrase;
                prof.KeyFile   = ssh.IdentityFileName;
                prof.AutoLogin = true;
                if (ssh.Method.ToString() == "SSH1")
                {
                    prof.Protocol = ConnectionMethod.SSH1;
                }
                else if (ssh.Method.ToString() == "SSH2")
                {
                    prof.Protocol = ConnectionMethod.SSH2;
                }
                if (ssh.AuthenticationType.ToString() == "Password")
                {
                    prof.AuthType = AuthType.Password;
                }
                else if (ssh.AuthenticationType.ToString() == "PublicKey")
                {
                    prof.AuthType = AuthType.PublicKey;
                }
                else if (ssh.AuthenticationType.ToString() == "KeyboardInteractive")
                {
                    prof.AuthType = AuthType.KeyboardInteractive;
                }
            }

            // その他設定
            prof.CharCode     = ts.TerminalSettings.Encoding;
            prof.NewLine      = ts.TerminalSettings.TransmitNL;
            prof.TerminalType = ts.TerminalSettings.TerminalType;
            if (ts.TerminalSettings.RenderProfile == null)
            {
                prof.RenderProfile            = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile();
                prof.RenderProfile.ESColorSet = new EscapesequenceColorSet();
                prof.RenderProfile.ESColorSet.ResetToDefault();
            }
            else
            {
                prof.RenderProfile = ts.TerminalSettings.RenderProfile;
            }
            prof.CommandSendInterval = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL;
            prof.PromptRecvTimeout   = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT;
            prof.ProfileItemColor    = System.Drawing.Color.Black;

            // ウィンドウ表示/プロファイル追加
            ProfileEditForm dlg = new ProfileEditForm(prof);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                AddProfileCommand(ConnectProfilePlugin.Profiles, dlg.ResultProfile);
            }
        }
        /// <summary>
        /// カレントセッションプロファイルを新規作成
        /// </summary>
        /// <param name="ts">ターミナルセッション</param>
        public void NewProfileCurrentSessionCommand(ITerminalSession ts)
        {
            ISSHLoginParameter ssh = (ISSHLoginParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ISSHLoginParameter));
            ITelnetParameter telnet = (ITelnetParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITelnetParameter));
            ITCPParameter tcp = null;
            ConnectProfileStruct prof = new ConnectProfileStruct();

            // プロトコルチェック
            if (telnet != null) {
                // Telnet
                tcp = (ITCPParameter)ts.TerminalConnection.Destination.GetAdapter(typeof(ITCPParameter));
                prof.Protocol = ConnectionMethod.Telnet;
                prof.HostName = tcp.Destination;
                prof.Port = tcp.Port;
                prof.TelnetNewLine = telnet.TelnetNewLine;
            } else {
                // SSH
                tcp = (ITCPParameter)ssh.GetAdapter(typeof(ITCPParameter));
                prof.HostName = tcp.Destination;
                prof.Port = tcp.Port;
                prof.UserName = ssh.Account;
                prof.Password = ssh.PasswordOrPassphrase;
                prof.KeyFile = ssh.IdentityFileName;
                prof.AutoLogin = true;
                if (ssh.Method.ToString() == "SSH1") { prof.Protocol = ConnectionMethod.SSH1; }
                else if (ssh.Method.ToString() == "SSH2") { prof.Protocol = ConnectionMethod.SSH2; }
                if (ssh.AuthenticationType.ToString() == "Password") { prof.AuthType = AuthType.Password; }
                else if (ssh.AuthenticationType.ToString() == "PublicKey") { prof.AuthType = AuthType.PublicKey; }
                else if (ssh.AuthenticationType.ToString() == "KeyboardInteractive") { prof.AuthType = AuthType.KeyboardInteractive; }
            }

            // その他設定
            prof.CharCode = ts.TerminalSettings.Encoding;
            prof.NewLine = ts.TerminalSettings.TransmitNL;
            prof.TerminalType = ts.TerminalSettings.TerminalType;
            if (ts.TerminalSettings.RenderProfile == null) {
                prof.RenderProfile = ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions.CreateRenderProfile();
                prof.RenderProfile.ESColorSet = new EscapesequenceColorSet();
                prof.RenderProfile.ESColorSet.ResetToDefault();
            } else {
                prof.RenderProfile = ts.TerminalSettings.RenderProfile;
            }
            prof.CommandSendInterval = ConnectProfileStruct.DEFAULT_CMD_SEND_INTERVAL;
            prof.PromptRecvTimeout = ConnectProfileStruct.DEFAULT_PROMPT_RECV_TIMEOUT;
            prof.ProfileItemColor = System.Drawing.Color.Black;

            // ウィンドウ表示/プロファイル追加
            ProfileEditForm dlg = new ProfileEditForm(prof);
            if (dlg.ShowDialog() == DialogResult.OK) {
                AddProfileCommand(ConnectProfilePlugin.Profiles, dlg.ResultProfile);
            }
        }
 /// <summary>
 /// プロファイルを新規作成
 /// </summary>
 /// <param name="proflist">プロファイルリスト</param>
 public void NewProfileCommand(ConnectProfileList proflist)
 {
     ProfileEditForm dlg = new ProfileEditForm(null);
     if (dlg.ShowDialog() == DialogResult.OK) {
         AddProfileCommand(proflist, dlg.ResultProfile);
     }
 }
 /// <summary>
 /// プロファイルを編集
 /// </summary>
 /// <param name="proflist">プロファイルリスト</param>
 /// <param name="prof">プロファイル</param>
 public void EditProfileCommand(ConnectProfileList proflist, ConnectProfileStruct prof)
 {
     ProfileEditForm dlg = new ProfileEditForm(prof);
     if (dlg.ShowDialog() == DialogResult.OK) {
         proflist.ReplaceProfile(prof, dlg.ResultProfile);
     }
 }