From f3075f4c515a339cf59d08880b6871506dfd9b9b Mon Sep 17 00:00:00 2001 From: Riley McArdle Date: Sun, 5 May 2013 19:55:52 -0500 Subject: [PATCH] Hide PuTTY sessions from PuTTY Saved Sessions if no host is set. Show "Default Settings" if host is set. Default to SSH2 if "Protocol" or "SshProt" are not set (matching behavior of PuTTY). --- mRemoteV1/Config/PuttySessions.vb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mRemoteV1/Config/PuttySessions.vb b/mRemoteV1/Config/PuttySessions.vb index 212904b29..b3d0221e8 100644 --- a/mRemoteV1/Config/PuttySessions.vb +++ b/mRemoteV1/Config/PuttySessions.vb @@ -85,9 +85,8 @@ Namespace Config Dim sessionList As New List(Of Connection.PuttySession.Info) Dim sessionInfo As Connection.Info For Each sessionName As String In GetSessionNames(True) - If sessionName = "Default%20Settings" Then Continue For ' Do not localize sessionInfo = SessionToConnectionInfo(sessionName) - If sessionInfo Is Nothing Then Continue For + If sessionInfo Is Nothing OrElse String.IsNullOrEmpty(sessionInfo.Hostname) Then Continue For sessionList.Add(sessionInfo) Next Return sessionList.ToArray() @@ -109,7 +108,7 @@ Namespace Config .Hostname = sessionKey.GetValue("HostName") .Username = sessionKey.GetValue("UserName") Dim protocol As String = sessionKey.GetValue("Protocol") - If protocol Is Nothing Then Return Nothing + If protocol Is Nothing Then protocol = "ssh" Select Case protocol.ToLowerInvariant() Case "raw" .Protocol = Protocols.RAW @@ -118,11 +117,16 @@ Namespace Config Case "serial" Return Nothing Case "ssh" - Dim sshVersion As Integer = sessionKey.GetValue("SshProt") - If sshVersion >= 2 Then - .Protocol = Protocols.SSH2 + Dim sshVersionObject As Object = sessionKey.GetValue("SshProt") + If sshVersionObject IsNot Nothing Then + Dim sshVersion As Integer = CType(sshVersionObject, Integer) + If sshVersion >= 2 Then + .Protocol = Protocols.SSH2 + Else + .Protocol = Protocols.SSH1 + End If Else - .Protocol = Protocols.SSH1 + .Protocol = Protocols.SSH2 End If Case "telnet" .Protocol = Protocols.Telnet