public SessionDataStartInfo ToSessionStartInfo()
        {
            SessionDataStartInfo ssi = null;
            if (this.SessionId != null)
            {
                // first try to resolve by sessionId
                SessionData session = SuperPuTTY.GetSessionByName(this.SessionId);
                if (session == null)
                {
                    Log.WarnFormat("Session from command line not found, id={0}", this.SessionId);
                }
                else
                {
                    ssi = new SessionDataStartInfo
                    {
                        Session = session,
                        UseScp = this.UseScp
                    };
                }
            }
            else if (this.Host != null ||  this.PuttySession != null)
            {
                // Host or puttySession provided
                string sessionName;
                if (this.Host != null)
                {
                    // Decode URL type host spec, if provided (e.g. ssh://localhost:2020)
                    HostConnectionString connStr = new HostConnectionString(this.Host);
                    this.Host = connStr.Host;
                    this.Protocol = connStr.Protocol.GetValueOrDefault(this.Protocol.GetValueOrDefault(ConnectionProtocol.SSH));
                    this.Port = connStr.Port.GetValueOrDefault(this.Port.GetValueOrDefault(dlgEditSession.GetDefaultPort(this.Protocol.GetValueOrDefault())));
                    sessionName = this.Host;
                }
                else
                {
                    // no host provided so assume sss
                    sessionName = this.PuttySession;
                }

                ssi = new SessionDataStartInfo();
                ssi.Session = new SessionData
                {
                    Host = this.Host,
                    SessionName = sessionName,
                    //SessionId = SuperPuTTY.MakeUniqueSessionId(SessionData.CombineSessionIds("CLI", this.Host)),
                    Port = this.Port.GetValueOrDefault(22),
                    Proto = this.Protocol.GetValueOrDefault(ConnectionProtocol.SSH),
                    Username = this.UserName,
                    Password = this.Password,
                    PuttySession = this.PuttySession
                };
                ssi.UseScp = this.UseScp;
            }

            if (ssi == null)
            {
                Log.WarnFormat("Could not determine session or host to connect.  SessionId or Host or PuttySession must be provided");
            }

            return ssi;
        }
        public static void OpenSession(SessionDataStartInfo ssi)
        {
            if (MainForm.InvokeRequired)
            {
                MainForm.BeginInvoke(new Action<SessionDataStartInfo>(OpenSession), ssi);
                return;
            }

            if (ssi != null)
            {
                if (ssi.UseScp)
                {
                    SuperPuTTY.OpenScpSession(ssi.Session);
                }
                else
                {
                    SuperPuTTY.OpenPuttySession(ssi.Session);
                }
            }
        }