mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Add feature MR-351 - Import connections from PuTTY
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Added feature MR-345 - Two separate options for confirming closure of Tabs and Connection Panels
|
||||
Added feature MR-346 - Option to show/hide the description box at the bottom of the Config panel
|
||||
Added feature MR-351 - Import connections from PuTTY
|
||||
Fixed issue MR-354 - Re-ordering tabs doesn't give good, reliable visual feedback
|
||||
Fixed issue MR-375 - Changing a connection's icon using the picture button should immediately update Icon field
|
||||
Fixed issue MR-377 - Several redundant panels can be opened
|
||||
|
||||
@@ -464,10 +464,6 @@ Namespace App
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Sub GetPuttySessions()
|
||||
Connection.PuttySession.PuttySessions = Connection.Protocol.PuttyBase.GetSessions()
|
||||
End Sub
|
||||
|
||||
Public Shared Sub CreateLogger()
|
||||
log4net.Config.XmlConfigurator.Configure()
|
||||
|
||||
@@ -1568,11 +1564,13 @@ Namespace App
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.Connection Then
|
||||
If Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.Connection Or _
|
||||
Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.PuttySession Then
|
||||
OpenConnection(Windows.treeForm.tvConnections.SelectedNode.Tag, Force)
|
||||
ElseIf Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.Container Then
|
||||
For Each tNode As TreeNode In Tree.Node.SelectedNode.Nodes
|
||||
If Tree.Node.GetNodeType(tNode) = Tree.Node.Type.Connection Then
|
||||
If Tree.Node.GetNodeType(tNode) = Tree.Node.Type.Connection Or _
|
||||
Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.PuttySession Then
|
||||
If tNode.Tag IsNot Nothing Then
|
||||
OpenConnection(tNode.Tag, Force)
|
||||
End If
|
||||
|
||||
142
mRemoteV1/Config/PuttySessions.vb
Normal file
142
mRemoteV1/Config/PuttySessions.vb
Normal file
@@ -0,0 +1,142 @@
|
||||
Imports System.ComponentModel
|
||||
Imports Microsoft.Win32
|
||||
Imports mRemoteNG.Connection.Protocol
|
||||
Imports mRemoteNG.Tree
|
||||
Imports mRemoteNG.My
|
||||
|
||||
Namespace Config
|
||||
Public Class PuttySessions
|
||||
Private Const PuttySessionsKey As String = "Software\SimonTatham\PuTTY\Sessions"
|
||||
|
||||
Public Shared Sub AddSessionsToTree(ByVal treeView As TreeView)
|
||||
Dim savedSessions() As Connection.Info = LoadSessions()
|
||||
If savedSessions Is Nothing OrElse savedSessions.Length = 0 Then Return
|
||||
|
||||
Dim puttyRootInfo As New Root.PuttySessions.Info()
|
||||
If String.IsNullOrEmpty(My.Settings.PuttySavedSessionsName) Then
|
||||
puttyRootInfo.Name = Language.strPuttySavedSessionsRootName
|
||||
Else
|
||||
puttyRootInfo.Name = My.Settings.PuttySavedSessionsName
|
||||
End If
|
||||
If String.IsNullOrEmpty(My.Settings.PuttySavedSessionsPanel) Then
|
||||
puttyRootInfo.Panel = Language.strGeneral
|
||||
Else
|
||||
puttyRootInfo.Panel = My.Settings.PuttySavedSessionsPanel
|
||||
End If
|
||||
|
||||
Dim puttyRootNode As TreeNode = New TreeNode
|
||||
puttyRootNode.Text = puttyRootInfo.Name
|
||||
puttyRootNode.Tag = puttyRootInfo
|
||||
puttyRootNode.ImageIndex = Images.Enums.TreeImage.PuttySessions
|
||||
puttyRootNode.SelectedImageIndex = Images.Enums.TreeImage.PuttySessions
|
||||
|
||||
puttyRootInfo.TreeNode = puttyRootNode
|
||||
|
||||
treeView.BeginUpdate()
|
||||
treeView.Nodes.Add(puttyRootNode)
|
||||
|
||||
Dim newTreeNode As TreeNode
|
||||
For Each sessionInfo As Connection.PuttySession.Info In savedSessions
|
||||
newTreeNode = Node.AddNode(Node.Type.PuttySession, sessionInfo.Name)
|
||||
If newTreeNode Is Nothing Then Continue For
|
||||
|
||||
sessionInfo.RootPuttySessionsInfo = puttyRootInfo
|
||||
sessionInfo.TreeNode = newTreeNode
|
||||
sessionInfo.Inherit.TurnOffInheritanceCompletely()
|
||||
|
||||
newTreeNode.Tag = sessionInfo
|
||||
newTreeNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed
|
||||
newTreeNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed
|
||||
|
||||
puttyRootNode.Nodes.Add(newTreeNode)
|
||||
Next
|
||||
|
||||
puttyRootNode.Expand()
|
||||
treeView.EndUpdate()
|
||||
End Sub
|
||||
|
||||
Protected Shared Function GetSessionNames(Optional ByVal addDefaultSettings As Boolean = False) As String()
|
||||
Dim sessionsKey As RegistryKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey)
|
||||
If sessionsKey Is Nothing Then Return Nothing
|
||||
|
||||
Dim sessionNames As New List(Of String)
|
||||
If addDefaultSettings Then sessionNames.Add("Default Settings")
|
||||
For Each sessionName As String In sessionsKey.GetSubKeyNames()
|
||||
sessionNames.Add(Web.HttpUtility.UrlDecode(sessionName))
|
||||
Next
|
||||
Return sessionNames.ToArray()
|
||||
End Function
|
||||
|
||||
Protected Shared Function LoadSessions() As Connection.PuttySession.Info()
|
||||
Dim sessionList As New List(Of Connection.PuttySession.Info)
|
||||
Dim sessionInfo As Connection.Info
|
||||
For Each sessionName As String In GetSessionNames()
|
||||
sessionInfo = SessionToConnectionInfo(sessionName)
|
||||
If sessionInfo Is Nothing Then Continue For
|
||||
sessionList.Add(sessionInfo)
|
||||
Next
|
||||
Return sessionList.ToArray()
|
||||
End Function
|
||||
|
||||
Protected Shared Function SessionToConnectionInfo(ByVal sessionName As String) As Connection.PuttySession.Info
|
||||
Dim sessionsKey As RegistryKey = Registry.CurrentUser.OpenSubKey(PuttySessionsKey)
|
||||
If sessionsKey Is Nothing Then Return Nothing
|
||||
|
||||
Dim sessionKey As RegistryKey = sessionsKey.OpenSubKey(sessionName)
|
||||
If sessionKey Is Nothing Then Return Nothing
|
||||
|
||||
Dim sessionInfo As New Connection.PuttySession.Info
|
||||
With sessionInfo
|
||||
.PuttySession = sessionName
|
||||
.Name = sessionName
|
||||
.Hostname = sessionKey.GetValue("HostName")
|
||||
.Username = sessionKey.GetValue("UserName")
|
||||
Dim protocol As String = sessionKey.GetValue("Protocol")
|
||||
Select Case protocol.ToLowerInvariant()
|
||||
Case "raw"
|
||||
.Protocol = Protocols.RAW
|
||||
Case "rlogin"
|
||||
.Protocol = Protocols.Rlogin
|
||||
Case "serial"
|
||||
Return Nothing
|
||||
Case "ssh"
|
||||
Dim sshVersion As Integer = sessionKey.GetValue("SshProt")
|
||||
If sshVersion >= 2 Then
|
||||
.Protocol = Protocols.SSH2
|
||||
Else
|
||||
.Protocol = Protocols.SSH1
|
||||
End If
|
||||
Case "telnet"
|
||||
.Protocol = Protocols.Telnet
|
||||
Case Else
|
||||
Return Nothing
|
||||
End Select
|
||||
.Port = sessionKey.GetValue("PortNumber")
|
||||
End With
|
||||
|
||||
Return sessionInfo
|
||||
End Function
|
||||
|
||||
Public Class SessionList
|
||||
Inherits StringConverter
|
||||
|
||||
Public Shared ReadOnly Property Names() As String()
|
||||
Get
|
||||
Return GetSessionNames(True)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
|
||||
Return New StandardValuesCollection(Names)
|
||||
End Function
|
||||
|
||||
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
End Class
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -13,7 +13,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameName"), _
|
||||
LocalizedDescription("strPropertyDescriptionName")> _
|
||||
Public Property Name() As String
|
||||
Public Overridable Property Name() As String
|
||||
Get
|
||||
Return Me._Name
|
||||
End Get
|
||||
@@ -27,7 +27,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameDescription"), _
|
||||
LocalizedDescription("strPropertyDescriptionDescription")> _
|
||||
Public Property Description() As String
|
||||
Public Overridable Property Description() As String
|
||||
Get
|
||||
If Me._Inherit.Description And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -54,7 +54,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameIcon"), _
|
||||
LocalizedDescription("strPropertyDescriptionIcon")> _
|
||||
Public Property Icon() As String
|
||||
Public Overridable Property Icon() As String
|
||||
Get
|
||||
If Me._Inherit.Icon And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -80,7 +80,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNamePanel"), _
|
||||
LocalizedDescription("strPropertyDescriptionPanel")> _
|
||||
Public Property Panel() As String
|
||||
Public Overridable Property Panel() As String
|
||||
Get
|
||||
If Me._Inherit.Panel And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -107,7 +107,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameAddress"), _
|
||||
LocalizedDescription("strPropertyDescriptionAddress")> _
|
||||
Public Property Hostname() As String
|
||||
Public Overridable Property Hostname() As String
|
||||
Get
|
||||
Return Me._Hostname.Trim()
|
||||
End Get
|
||||
@@ -121,7 +121,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameUsername"), _
|
||||
LocalizedDescription("strPropertyDescriptionUsername")> _
|
||||
Public Property Username() As String
|
||||
Public Overridable Property Username() As String
|
||||
Get
|
||||
If Me._Inherit.Username And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -148,7 +148,7 @@ Namespace Connection
|
||||
LocalizedDisplayName("strPropertyNamePassword"), _
|
||||
LocalizedDescription("strPropertyDescriptionPassword"), _
|
||||
PasswordPropertyText(True)> _
|
||||
Public Property Password() As String
|
||||
Public Overridable Property Password() As String
|
||||
Get
|
||||
If Me._Inherit.Password And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -202,7 +202,7 @@ Namespace Connection
|
||||
LocalizedDisplayName("strPropertyNameProtocol"), _
|
||||
LocalizedDescription("strPropertyDescriptionProtocol"), _
|
||||
TypeConverter(GetType(Tools.Misc.EnumTypeConverter))> _
|
||||
Public Property Protocol() As Connection.Protocol.Protocols
|
||||
Public Overridable Property Protocol() As Connection.Protocol.Protocols
|
||||
Get
|
||||
If Me._Inherit.Protocol And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -255,7 +255,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNamePort"), _
|
||||
LocalizedDescription("strPropertyDescriptionPort")> _
|
||||
Public Property Port() As Integer
|
||||
Public Overridable Property Port() As Integer
|
||||
Get
|
||||
If Me._Inherit.Port And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -281,8 +281,8 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNamePuttySession"), _
|
||||
LocalizedDescription("strPropertyDescriptionPuttySession"), _
|
||||
TypeConverter(GetType(mRemoteNG.Connection.PuttySession))> _
|
||||
Public Property PuttySession() As String
|
||||
TypeConverter(GetType(Config.PuttySessions.SessionList))> _
|
||||
Public Overridable Property PuttySession() As String
|
||||
Get
|
||||
If Me._Inherit.PuttySession And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -958,7 +958,7 @@ Namespace Connection
|
||||
LocalizedDisplayName("strPropertyNameExternalToolBefore"), _
|
||||
LocalizedDescription("strPropertyDescriptionExternalToolBefore"), _
|
||||
TypeConverter(GetType(Tools.ExternalAppsTypeConverter))> _
|
||||
Public Property PreExtApp() As String
|
||||
Public Overridable Property PreExtApp() As String
|
||||
Get
|
||||
If Me._Inherit.PreExtApp And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -985,7 +985,7 @@ Namespace Connection
|
||||
LocalizedDisplayName("strPropertyNameExternalToolAfter"), _
|
||||
LocalizedDescription("strPropertyDescriptionExternalToolAfter"), _
|
||||
TypeConverter(GetType(Tools.ExternalAppsTypeConverter))> _
|
||||
Public Property PostExtApp() As String
|
||||
Public Overridable Property PostExtApp() As String
|
||||
Get
|
||||
If Me._Inherit.PostExtApp And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -1011,7 +1011,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameMACAddress"), _
|
||||
LocalizedDescription("strPropertyDescriptionMACAddress")> _
|
||||
Public Property MacAddress() As String
|
||||
Public Overridable Property MacAddress() As String
|
||||
Get
|
||||
If Me._Inherit.MacAddress And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
@@ -1037,7 +1037,7 @@ Namespace Connection
|
||||
Browsable(True), _
|
||||
LocalizedDisplayName("strPropertyNameUser1"), _
|
||||
LocalizedDescription("strPropertyDescriptionUser1")> _
|
||||
Public Property UserField() As String
|
||||
Public Overridable Property UserField() As String
|
||||
Get
|
||||
If Me._Inherit.UserField And Me._Parent IsNot Nothing Then
|
||||
Dim parCon As Connection.Info = TryCast(Me._Parent, Container.Info).ConnectionInfo
|
||||
|
||||
@@ -243,27 +243,6 @@ Namespace Connection
|
||||
#End Region
|
||||
|
||||
#Region "Public Shared Methods"
|
||||
Public Shared Function GetSessions() As Array
|
||||
Try
|
||||
Dim regKey As RegistryKey
|
||||
regKey = Registry.CurrentUser.OpenSubKey("Software\SimonTatham\PuTTY\Sessions")
|
||||
|
||||
Dim arrKeys() As String
|
||||
arrKeys = regKey.GetSubKeyNames()
|
||||
Array.Resize(arrKeys, arrKeys.Length + 1)
|
||||
arrKeys(arrKeys.Length - 1) = "Default Settings"
|
||||
|
||||
For i As Integer = 0 To arrKeys.Length - 1
|
||||
arrKeys(i) = System.Web.HttpUtility.UrlDecode(arrKeys(i))
|
||||
Next
|
||||
|
||||
Return arrKeys
|
||||
Catch ex As Exception
|
||||
App.Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, My.Language.strPuttyGetSessionsFailed & vbNewLine & ex.Message, True)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function IsFilePuttyNg(file As String) As Boolean
|
||||
Dim isPuttyNg As Boolean
|
||||
Try
|
||||
@@ -282,8 +261,6 @@ Namespace Connection
|
||||
|
||||
p = Process.Start(pSI)
|
||||
p.WaitForExit()
|
||||
|
||||
mRemoteNG.Connection.PuttySession.PuttySessions = GetSessions()
|
||||
Catch ex As Exception
|
||||
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strPuttyStartFailed & vbNewLine & ex.Message, True)
|
||||
End Try
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
Imports System.ComponentModel
|
||||
|
||||
Namespace Connection
|
||||
Public Class PuttySession
|
||||
Inherits StringConverter
|
||||
|
||||
Public Shared PuttySessions As String() = New String() {}
|
||||
|
||||
Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
|
||||
Return New StandardValuesCollection(PuttySessions)
|
||||
End Function
|
||||
|
||||
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
77
mRemoteV1/Connection/PuttySession.Info.vb
Normal file
77
mRemoteV1/Connection/PuttySession.Info.vb
Normal file
@@ -0,0 +1,77 @@
|
||||
Imports System.ComponentModel
|
||||
|
||||
Namespace Connection
|
||||
Namespace PuttySession
|
||||
Public Class Info
|
||||
Inherits Connection.Info
|
||||
|
||||
<Browsable(False)> _
|
||||
Public Property RootPuttySessionsInfo() As Root.PuttySessions.Info
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property PuttySession() As String
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property Name() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property Description() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property Icon() As String
|
||||
Get
|
||||
Return "PuTTY"
|
||||
End Get
|
||||
Set(value As String)
|
||||
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property Panel() As String
|
||||
Get
|
||||
Return RootPuttySessionsInfo.Panel
|
||||
End Get
|
||||
Set(value As String)
|
||||
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property Hostname() As String
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property Username() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property Password() As String
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property Protocol() As Protocol.Protocols
|
||||
|
||||
<[ReadOnly](True)> _
|
||||
Public Overrides Property Port() As Integer
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property PreExtApp() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property PostExtApp() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property MacAddress() As String
|
||||
|
||||
<[ReadOnly](True), _
|
||||
Browsable(False)> _
|
||||
Public Overrides Property UserField() As String
|
||||
End Class
|
||||
End Namespace
|
||||
End Namespace
|
||||
|
||||
@@ -62,7 +62,6 @@ Public Class frmMain
|
||||
WindowList = New UI.Window.List
|
||||
|
||||
Startup.GetConnectionIcons()
|
||||
Startup.GetPuttySessions()
|
||||
App.Runtime.GetExtApps()
|
||||
Windows.treePanel.Focus()
|
||||
|
||||
@@ -75,6 +74,8 @@ Public Class frmMain
|
||||
Return
|
||||
End If
|
||||
|
||||
PuttySessions.AddSessionsToTree(Tree.Node.TreeView)
|
||||
|
||||
If My.Settings.StartupComponentsCheck Then
|
||||
Windows.Show(UI.Window.Type.ComponentsCheck)
|
||||
End If
|
||||
@@ -314,7 +315,8 @@ Public Class frmMain
|
||||
Private Sub tsExtAppEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||||
Dim extA As Tools.ExternalTool = sender.Tag
|
||||
|
||||
If Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.Connection Then
|
||||
If Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.Connection Or _
|
||||
Tree.Node.GetNodeType(Tree.Node.SelectedNode) = Tree.Node.Type.PuttySession Then
|
||||
extA.Start(Tree.Node.SelectedNode.Tag)
|
||||
Else
|
||||
extA.Start()
|
||||
@@ -341,8 +343,10 @@ Public Class frmMain
|
||||
#Region "Menu"
|
||||
#Region "File"
|
||||
Private Sub mMenFile_DropDownOpening(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mMenFile.DropDownOpening
|
||||
Select Case Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode)
|
||||
Select Case Tree.Node.GetNodeType(Tree.Node.SelectedNode)
|
||||
Case Tree.Node.Type.Root
|
||||
mMenFileNewConnection.Enabled = True
|
||||
mMenFileNewFolder.Enabled = True
|
||||
mMenFileImportExport.Enabled = True
|
||||
mMenFileDelete.Enabled = False
|
||||
mMenFileRename.Enabled = True
|
||||
@@ -351,6 +355,8 @@ Public Class frmMain
|
||||
mMenFileRename.Text = My.Language.strMenuRenameFolder
|
||||
mMenFileDuplicate.Text = My.Language.strMenuDuplicate
|
||||
Case Tree.Node.Type.Container
|
||||
mMenFileNewConnection.Enabled = True
|
||||
mMenFileNewFolder.Enabled = True
|
||||
mMenFileImportExport.Enabled = True
|
||||
mMenFileDelete.Enabled = True
|
||||
mMenFileRename.Enabled = True
|
||||
@@ -359,6 +365,8 @@ Public Class frmMain
|
||||
mMenFileRename.Text = My.Language.strMenuRenameFolder
|
||||
mMenFileDuplicate.Text = My.Language.strMenuDuplicateFolder
|
||||
Case Tree.Node.Type.Connection
|
||||
mMenFileNewConnection.Enabled = True
|
||||
mMenFileNewFolder.Enabled = True
|
||||
mMenFileImportExport.Enabled = False
|
||||
mMenFileDelete.Enabled = True
|
||||
mMenFileRename.Enabled = True
|
||||
@@ -366,7 +374,19 @@ Public Class frmMain
|
||||
mMenFileDelete.Text = My.Language.strMenuDeleteConnection
|
||||
mMenFileRename.Text = My.Language.strMenuRenameConnection
|
||||
mMenFileDuplicate.Text = My.Language.strMenuDuplicateConnection
|
||||
Case Tree.Node.Type.PuttyRoot, Tree.Node.Type.PuttySession
|
||||
mMenFileNewConnection.Enabled = False
|
||||
mMenFileNewFolder.Enabled = False
|
||||
mMenFileImportExport.Enabled = False
|
||||
mMenFileDelete.Enabled = False
|
||||
mMenFileRename.Enabled = False
|
||||
mMenFileDuplicate.Enabled = False
|
||||
mMenFileDelete.Text = My.Language.strMenuDelete
|
||||
mMenFileRename.Text = My.Language.strMenuRename
|
||||
mMenFileDuplicate.Text = My.Language.strMenuDuplicate
|
||||
Case Else
|
||||
mMenFileNewConnection.Enabled = True
|
||||
mMenFileNewFolder.Enabled = True
|
||||
mMenFileImportExport.Enabled = False
|
||||
mMenFileDelete.Enabled = False
|
||||
mMenFileRename.Enabled = False
|
||||
@@ -735,7 +755,8 @@ Public Class frmMain
|
||||
|
||||
menToolStrip.DropDownItems.Add(tMenItem)
|
||||
AddNodeToMenu(tNode.Nodes, tMenItem)
|
||||
ElseIf Tree.Node.GetNodeType(tNode) = Tree.Node.Type.Connection Then
|
||||
ElseIf Tree.Node.GetNodeType(tNode) = Tree.Node.Type.Connection Or _
|
||||
Tree.Node.GetNodeType(tNode) = Tree.Node.Type.PuttySession Then
|
||||
tMenItem.Image = Windows.treeForm.imgListTree.Images(tNode.ImageIndex)
|
||||
tMenItem.Tag = tNode.Tag
|
||||
|
||||
|
||||
BIN
mRemoteV1/Icons/PuTTY.ico
Normal file
BIN
mRemoteV1/Icons/PuTTY.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
@@ -5,6 +5,7 @@ Namespace Images
|
||||
Container = 1
|
||||
ConnectionOpen = 2
|
||||
ConnectionClosed = 3
|
||||
PuttySessions = 4
|
||||
End Enum
|
||||
|
||||
Public Enum ErrorImage
|
||||
|
||||
9
mRemoteV1/Language/Language.Designer.vb
generated
9
mRemoteV1/Language/Language.Designer.vb
generated
@@ -4358,6 +4358,15 @@ Namespace My
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to PuTTY Saved Sessions.
|
||||
'''</summary>
|
||||
Friend Shared ReadOnly Property strPuttySavedSessionsRootName() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("strPuttySavedSessionsRootName", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to PuTTY Settings.
|
||||
'''</summary>
|
||||
|
||||
@@ -2214,4 +2214,7 @@ mRemoteNG will now quit and begin with the installation.</value>
|
||||
<data name="strMenuShowHelpText" xml:space="preserve">
|
||||
<value>&Show Help Text</value>
|
||||
</data>
|
||||
<data name="strPuttySavedSessionsRootName" xml:space="preserve">
|
||||
<value>PuTTY Saved Sessions</value>
|
||||
</data>
|
||||
</root>
|
||||
9
mRemoteV1/My Project/Resources.Designer.vb
generated
9
mRemoteV1/My Project/Resources.Designer.vb
generated
@@ -1,7 +1,7 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.239
|
||||
' Runtime Version:4.0.30319.296
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
@@ -585,6 +585,13 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property PuttySessions() As System.Drawing.Bitmap
|
||||
Get
|
||||
Dim obj As Object = ResourceManager.GetObject("PuttySessions", resourceCulture)
|
||||
Return CType(obj,System.Drawing.Bitmap)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend ReadOnly Property Quit() As System.Drawing.Bitmap
|
||||
Get
|
||||
Dim obj As Object = ResourceManager.GetObject("Quit", resourceCulture)
|
||||
|
||||
@@ -445,4 +445,8 @@
|
||||
<data name="News" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Images_FamFamFam\News.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="PuttySessions" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Images\PuttySessions.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
26
mRemoteV1/My Project/Settings.Designer.vb
generated
26
mRemoteV1/My Project/Settings.Designer.vb
generated
@@ -2358,6 +2358,32 @@ Namespace My
|
||||
Me("ShowConfigHelpText") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Configuration.SettingsProviderAttribute(GetType(mRemoteNG.Config.Settings.Providers.ChooseProvider)), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public Property PuttySavedSessionsName() As String
|
||||
Get
|
||||
Return CType(Me("PuttySavedSessionsName"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("PuttySavedSessionsName") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Configuration.SettingsProviderAttribute(GetType(mRemoteNG.Config.Settings.Providers.ChooseProvider)), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public Property PuttySavedSessionsPanel() As String
|
||||
Get
|
||||
Return CType(Me("PuttySavedSessionsPanel"),String)
|
||||
End Get
|
||||
Set
|
||||
Me("PuttySavedSessionsPanel") = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@@ -536,5 +536,11 @@
|
||||
<Setting Name="ShowConfigHelpText" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="PuttySavedSessionsName" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="PuttySavedSessionsPanel" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
BIN
mRemoteV1/Resources/Images/PuttySessions.png
Normal file
BIN
mRemoteV1/Resources/Images/PuttySessions.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 322 B |
29
mRemoteV1/Root/PuttySessions.Info.vb
Normal file
29
mRemoteV1/Root/PuttySessions.Info.vb
Normal file
@@ -0,0 +1,29 @@
|
||||
Imports mRemoteNG.Tools.LocalizedAttributes
|
||||
|
||||
Namespace Root
|
||||
Namespace PuttySessions
|
||||
Public Class Info
|
||||
Inherits Root.Info
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New(RootType.PuttySessions)
|
||||
End Sub
|
||||
|
||||
Public Overrides Property Name() As String
|
||||
|
||||
Private _panel As String = My.Language.strGeneral
|
||||
<LocalizedCategory("strCategoryDisplay", 1), _
|
||||
LocalizedDisplayName("strPropertyNamePanel"), _
|
||||
LocalizedDescription("strPropertyDescriptionPanel")> _
|
||||
Public Property Panel() As String
|
||||
Get
|
||||
Return _panel
|
||||
End Get
|
||||
Set(ByVal value As String)
|
||||
_panel = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
End Namespace
|
||||
|
||||
@@ -20,7 +20,7 @@ Namespace Root
|
||||
LocalizedDisplayName("strPropertyNameName"), _
|
||||
LocalizedDescription("strPropertyDescriptionName"), _
|
||||
Attributes.Root()> _
|
||||
Public Property Name() As String
|
||||
Public Overridable Property Name() As String
|
||||
Get
|
||||
Return Me._Name
|
||||
End Get
|
||||
@@ -104,6 +104,7 @@ Namespace Root
|
||||
Public Enum RootType
|
||||
Connection
|
||||
Credential
|
||||
PuttySessions
|
||||
End Enum
|
||||
|
||||
Public Class Attributes
|
||||
|
||||
@@ -5,10 +5,12 @@ Imports System.DirectoryServices
|
||||
Namespace Tree
|
||||
Public Class Node
|
||||
Public Enum Type
|
||||
Root = 0
|
||||
Container = 1
|
||||
Connection = 2
|
||||
NONE = 66
|
||||
None = 0
|
||||
Root = 1
|
||||
Container = 2
|
||||
Connection = 3
|
||||
PuttyRoot = 4
|
||||
PuttySession = 5
|
||||
End Enum
|
||||
|
||||
Private Shared _TreeView As TreeView
|
||||
@@ -92,10 +94,14 @@ Namespace Tree
|
||||
Return Type.NONE
|
||||
End If
|
||||
|
||||
If TypeOf treeNode.Tag Is Root.Info Then
|
||||
If TypeOf treeNode.Tag Is Root.PuttySessions.Info Then
|
||||
Return Type.PuttyRoot
|
||||
ElseIf TypeOf treeNode.Tag Is Root.Info Then
|
||||
Return Type.Root
|
||||
ElseIf TypeOf treeNode.Tag Is Container.Info Then
|
||||
Return Type.Container
|
||||
ElseIf TypeOf treeNode.Tag Is Connection.PuttySession.Info Then
|
||||
Return Type.PuttySession
|
||||
ElseIf TypeOf treeNode.Tag Is Connection.Info Then
|
||||
Return Type.Connection
|
||||
End If
|
||||
@@ -184,7 +190,7 @@ Namespace Tree
|
||||
Dim nNode As New TreeNode
|
||||
|
||||
Select Case NodeType
|
||||
Case Type.Connection
|
||||
Case Type.Connection Or Type.PuttySession
|
||||
nNode.Text = My.Language.strNewConnection
|
||||
nNode.ImageIndex = Images.Enums.TreeImage.ConnectionClosed
|
||||
nNode.SelectedImageIndex = Images.Enums.TreeImage.ConnectionClosed
|
||||
|
||||
@@ -377,7 +377,7 @@ Namespace UI
|
||||
End If
|
||||
Me.btnShowDefaultProperties.Enabled = False
|
||||
Me.btnShowDefaultInheritance.Enabled = False
|
||||
Me.btnIcon.Enabled = True
|
||||
btnIcon.Enabled = True
|
||||
Me.btnHostStatus.Enabled = True
|
||||
ElseIf Me.DefaultPropertiesVisible Then 'Defaults selected
|
||||
Me.pGrid.SelectedObject = Obj
|
||||
@@ -441,17 +441,31 @@ Namespace UI
|
||||
If conIcon IsNot Nothing Then
|
||||
Me.btnIcon.Image = conIcon.ToBitmap
|
||||
End If
|
||||
ElseIf TypeOf Obj Is mRemoteNG.Root.Info Then 'ROOT
|
||||
Me.PropertiesVisible = True
|
||||
Me.DefaultPropertiesVisible = False
|
||||
Me.btnShowProperties.Enabled = True
|
||||
Me.btnShowInheritance.Enabled = False
|
||||
Me.btnShowDefaultProperties.Enabled = True
|
||||
Me.btnShowDefaultInheritance.Enabled = True
|
||||
Me.btnIcon.Enabled = False
|
||||
Me.btnHostStatus.Enabled = False
|
||||
|
||||
Me.pGrid.SelectedObject = Obj
|
||||
ElseIf TypeOf Obj Is Root.Info Then 'ROOT
|
||||
Dim rootInfo As Root.Info = CType(Obj, Root.Info)
|
||||
Select Case rootInfo.Type
|
||||
Case Root.Info.RootType.Connection
|
||||
PropertiesVisible = True
|
||||
DefaultPropertiesVisible = False
|
||||
btnShowProperties.Enabled = True
|
||||
btnShowInheritance.Enabled = False
|
||||
btnShowDefaultProperties.Enabled = True
|
||||
btnShowDefaultInheritance.Enabled = True
|
||||
btnIcon.Enabled = False
|
||||
btnHostStatus.Enabled = False
|
||||
Case Root.Info.RootType.Credential
|
||||
Throw New NotImplementedException
|
||||
Case Root.Info.RootType.PuttySessions
|
||||
PropertiesVisible = True
|
||||
DefaultPropertiesVisible = False
|
||||
btnShowProperties.Enabled = True
|
||||
btnShowInheritance.Enabled = False
|
||||
btnShowDefaultProperties.Enabled = False
|
||||
btnShowDefaultInheritance.Enabled = False
|
||||
btnIcon.Enabled = False
|
||||
btnHostStatus.Enabled = False
|
||||
End Select
|
||||
pGrid.SelectedObject = Obj
|
||||
ElseIf TypeOf Obj Is mRemoteNG.Connection.Info.Inheritance Then 'INHERITANCE
|
||||
Me.pGrid.SelectedObject = Obj
|
||||
|
||||
@@ -605,8 +619,6 @@ Namespace UI
|
||||
If conIcon IsNot Nothing Then
|
||||
Me.btnIcon.Image = conIcon.ToBitmap
|
||||
End If
|
||||
Case My.Language.strPropertyNamePuttySession
|
||||
mRemoteNG.Connection.PuttySession.PuttySessions = mRemoteNG.Connection.Protocol.PuttyBase.GetSessions()
|
||||
Case My.Language.strPropertyNameAddress
|
||||
Me.SetHostStatus(Me.pGrid.SelectedObject)
|
||||
End Select
|
||||
@@ -616,7 +628,16 @@ Namespace UI
|
||||
End If
|
||||
End If
|
||||
|
||||
If TypeOf Me.pGrid.SelectedObject Is mRemoteNG.Root.Info Then
|
||||
If TypeOf pGrid.SelectedObject Is Root.PuttySessions.Info Then
|
||||
Dim puttyRootInfo As Root.PuttySessions.Info = pGrid.SelectedObject
|
||||
Select Case e.ChangedItem.PropertyDescriptor.Name
|
||||
Case "Name"
|
||||
puttyRootInfo.TreeNode.Text = puttyRootInfo.Name
|
||||
Settings.PuttySavedSessionsName = puttyRootInfo.Name
|
||||
Case "Panel"
|
||||
Settings.PuttySavedSessionsPanel = puttyRootInfo.Panel
|
||||
End Select
|
||||
ElseIf TypeOf Me.pGrid.SelectedObject Is mRemoteNG.Root.Info Then
|
||||
Dim rInfo As mRemoteNG.Root.Info = Me.pGrid.SelectedObject
|
||||
|
||||
Select Case e.ChangedItem.Label
|
||||
@@ -1282,8 +1303,11 @@ Namespace UI
|
||||
strHide.Add("Hostname")
|
||||
strHide.Add("Name")
|
||||
End If
|
||||
ElseIf TypeOf Me.pGrid.SelectedObject Is mRemoteNG.Root.Info Then
|
||||
strHide.Add("TreeNode")
|
||||
ElseIf TypeOf pGrid.SelectedObject Is Root.Info Then
|
||||
Dim rootInfo As Root.Info = CType(pGrid.SelectedObject, Root.Info)
|
||||
If rootInfo.Type = Root.Info.RootType.PuttySessions Then
|
||||
strHide.Add("Password")
|
||||
End If
|
||||
End If
|
||||
|
||||
Me.pGrid.HiddenProperties = strHide.ToArray
|
||||
@@ -1356,7 +1380,8 @@ Namespace UI
|
||||
|
||||
Private Sub btnIcon_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnIcon.MouseUp
|
||||
Try
|
||||
If TypeOf Me.pGrid.SelectedObject Is mRemoteNG.Connection.Info Then
|
||||
If TypeOf pGrid.SelectedObject Is mRemoteNG.Connection.Info And _
|
||||
Not TypeOf pGrid.SelectedObject Is mRemoteNG.Connection.PuttySession.Info Then
|
||||
Me.cMenIcons.Items.Clear()
|
||||
|
||||
For Each iStr As String In mRemoteNG.Connection.Icon.Icons
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports mRemoteNG.Connection
|
||||
Imports mRemoteNG
|
||||
Imports mRemoteNG.My
|
||||
Imports WeifenLuo.WinFormsUI.Docking
|
||||
Imports mRemoteNG.App.Runtime
|
||||
@@ -557,10 +557,11 @@ Namespace UI
|
||||
#Region "Private Methods"
|
||||
Private Sub FillImageList()
|
||||
Try
|
||||
Me.imgListTree.Images.Add(My.Resources.Root)
|
||||
Me.imgListTree.Images.Add(My.Resources.Folder)
|
||||
Me.imgListTree.Images.Add(My.Resources.Play)
|
||||
Me.imgListTree.Images.Add(My.Resources.Pause)
|
||||
imgListTree.Images.Add(Resources.Root)
|
||||
imgListTree.Images.Add(Resources.Folder)
|
||||
imgListTree.Images.Add(Resources.Play)
|
||||
imgListTree.Images.Add(Resources.Pause)
|
||||
imgListTree.Images.Add(Resources.PuttySessions)
|
||||
Catch ex As Exception
|
||||
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "FillImageList (UI.Window.Tree) failed" & vbNewLine & ex.Message, True)
|
||||
End Try
|
||||
@@ -586,22 +587,22 @@ Namespace UI
|
||||
Private Sub tvConnections_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvConnections.AfterSelect
|
||||
Try
|
||||
Select Case mRemoteNG.Tree.Node.GetNodeType(e.Node)
|
||||
Case mRemoteNG.Tree.Node.Type.Connection
|
||||
Case mRemoteNG.Tree.Node.Type.Connection, mRemoteNG.Tree.Node.Type.PuttySession
|
||||
Windows.configForm.SetPropertyGridObject(e.Node.Tag)
|
||||
Windows.sessionsForm.CurrentHost = TryCast(e.Node.Tag, mRemoteNG.Connection.Info).Hostname
|
||||
Case mRemoteNG.Tree.Node.Type.Container
|
||||
Windows.configForm.SetPropertyGridObject(TryCast(e.Node.Tag, mRemoteNG.Container.Info).ConnectionInfo)
|
||||
Case mRemoteNG.Tree.Node.Type.Root
|
||||
Windows.configForm.SetPropertyGridObject(TryCast(e.Node.Tag, Container.Info).ConnectionInfo)
|
||||
Case mRemoteNG.Tree.Node.Type.Root, mRemoteNG.Tree.Node.Type.PuttyRoot
|
||||
Windows.configForm.SetPropertyGridObject(e.Node.Tag)
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
|
||||
Windows.configForm.pGrid_SelectedObjectChanged()
|
||||
Me.ShowHideTreeContextMenuItems(e.Node)
|
||||
ShowHideTreeContextMenuItems(e.Node)
|
||||
Windows.sessionsForm.GetSessionsAuto()
|
||||
|
||||
App.Runtime.LastSelected = mRemoteNG.Tree.Node.GetConstantID(e.Node)
|
||||
LastSelected = mRemoteNG.Tree.Node.GetConstantID(e.Node)
|
||||
Catch ex As Exception
|
||||
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "tvConnections_AfterSelect (UI.Window.Tree) failed" & vbNewLine & ex.Message, True)
|
||||
End Try
|
||||
@@ -613,8 +614,10 @@ Namespace UI
|
||||
Me.tvConnections.SelectedNode = e.Node
|
||||
|
||||
If e.Button = System.Windows.Forms.MouseButtons.Left Then
|
||||
If My.Settings.SingleClickOnConnectionOpensIt And mRemoteNG.Tree.Node.GetNodeType(e.Node) = mRemoteNG.Tree.Node.Type.Connection Then
|
||||
App.Runtime.OpenConnection()
|
||||
If Settings.SingleClickOnConnectionOpensIt And _
|
||||
(mRemoteNG.Tree.Node.GetNodeType(e.Node) = mRemoteNG.Tree.Node.Type.Connection Or _
|
||||
mRemoteNG.Tree.Node.GetNodeType(e.Node) = mRemoteNG.Tree.Node.Type.PuttySession) Then
|
||||
OpenConnection()
|
||||
End If
|
||||
|
||||
If My.Settings.SingleClickSwitchesToOpenConnection And mRemoteNG.Tree.Node.GetNodeType(e.Node) = mRemoteNG.Tree.Node.Type.Connection Then
|
||||
@@ -627,8 +630,9 @@ Namespace UI
|
||||
End Sub
|
||||
|
||||
Private Sub tvConnections_NodeMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles tvConnections.NodeMouseDoubleClick
|
||||
If mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.Connection Then
|
||||
App.Runtime.OpenConnection()
|
||||
If mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.Connection Or _
|
||||
mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.PuttySession Then
|
||||
OpenConnection()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -656,111 +660,119 @@ Namespace UI
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Sub ShowHideTreeContextMenuItems(ByVal tNode As TreeNode)
|
||||
Try
|
||||
Me.cMenTree.Enabled = True
|
||||
|
||||
If tNode Is Nothing Then
|
||||
Exit Sub
|
||||
Private Sub EnableMenuItemsRecursive(ByVal items As ToolStripItemCollection, Optional ByVal enable As Boolean = True)
|
||||
Dim menuItem As ToolStripMenuItem
|
||||
For Each item As ToolStripItem In items
|
||||
menuItem = TryCast(item, ToolStripMenuItem)
|
||||
If menuItem Is Nothing Then Continue For
|
||||
menuItem.Enabled = enable
|
||||
If menuItem.HasDropDownItems Then
|
||||
EnableMenuItemsRecursive(menuItem.DropDownItems, enable)
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Select Case mRemoteNG.Tree.Node.GetNodeType(tNode)
|
||||
Private Sub ShowHideTreeContextMenuItems(ByVal selectedNode As TreeNode)
|
||||
If selectedNode Is Nothing Then Return
|
||||
|
||||
Try
|
||||
cMenTree.Enabled = True
|
||||
EnableMenuItemsRecursive(cMenTree.Items)
|
||||
|
||||
Select Case mRemoteNG.Tree.Node.GetNodeType(selectedNode)
|
||||
Case mRemoteNG.Tree.Node.Type.Connection
|
||||
Dim conI As mRemoteNG.Connection.Info = tNode.Tag
|
||||
Dim connectionInfo As mRemoteNG.Connection.Info = selectedNode.Tag
|
||||
|
||||
Me.cMenTreeConnect.Enabled = True
|
||||
Me.cMenTreeConnectWithOptions.Enabled = True
|
||||
|
||||
If TryCast(tNode.Tag, mRemoteNG.Connection.Info).OpenConnections.Count > 0 Then
|
||||
Me.cMenTreeDisconnect.Enabled = True
|
||||
Else
|
||||
Me.cMenTreeDisconnect.Enabled = False
|
||||
If connectionInfo.OpenConnections.Count = 0 Then
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
End If
|
||||
|
||||
If conI.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH1 Or conI.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH2 Then
|
||||
Me.cMenTreeToolsTransferFile.Enabled = True
|
||||
Else
|
||||
Me.cMenTreeToolsTransferFile.Enabled = False
|
||||
If Not (connectionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH1 Or _
|
||||
connectionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH2) Then
|
||||
cMenTreeToolsTransferFile.Enabled = False
|
||||
End If
|
||||
|
||||
If conI.Protocol = mRemoteNG.Connection.Protocol.Protocols.RDP Then
|
||||
Me.cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = True
|
||||
Me.cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = True
|
||||
ElseIf conI.Protocol = mRemoteNG.Connection.Protocol.Protocols.ICA Then
|
||||
Me.cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = True
|
||||
Me.cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
Else
|
||||
Me.cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
If Not (connectionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.RDP Or _
|
||||
connectionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.ICA) Then
|
||||
cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
End If
|
||||
|
||||
Me.cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = True
|
||||
cMenTreeToolsImportExport.Enabled = False
|
||||
Case mRemoteNG.Tree.Node.Type.PuttySession
|
||||
Dim puttySessionInfo As mRemoteNG.Connection.PuttySession.Info = selectedNode.Tag
|
||||
|
||||
Me.cMenTreeToolsImportExport.Enabled = False
|
||||
cMenTreeAddConnection.Enabled = False
|
||||
cMenTreeAddFolder.Enabled = False
|
||||
|
||||
Me.cMenTreeToolsExternalApps.Enabled = True
|
||||
If puttySessionInfo.OpenConnections.Count = 0 Then
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
End If
|
||||
|
||||
Me.cMenTreeDuplicate.Enabled = True
|
||||
Me.cMenTreeDelete.Enabled = True
|
||||
If Not (puttySessionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH1 Or _
|
||||
puttySessionInfo.Protocol = mRemoteNG.Connection.Protocol.Protocols.SSH2) Then
|
||||
cMenTreeToolsTransferFile.Enabled = False
|
||||
End If
|
||||
|
||||
Me.cMenTreeMoveUp.Enabled = True
|
||||
Me.cMenTreeMoveDown.Enabled = True
|
||||
cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
cMenTreeToolsImportExport.Enabled = False
|
||||
cMenTreeToolsSort.Enabled = False
|
||||
cMenTreeDuplicate.Enabled = False
|
||||
cMenTreeRename.Enabled = False
|
||||
cMenTreeDelete.Enabled = False
|
||||
cMenTreeMoveUp.Enabled = False
|
||||
cMenTreeMoveDown.Enabled = False
|
||||
Case mRemoteNG.Tree.Node.Type.Container
|
||||
Me.cMenTreeConnect.Enabled = True
|
||||
Me.cMenTreeConnectWithOptions.Enabled = True
|
||||
Me.cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = True
|
||||
Me.cMenTreeDisconnect.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
|
||||
For Each n As TreeNode In tNode.Nodes
|
||||
If TypeOf n.Tag Is mRemoteNG.Connection.Info Then
|
||||
Dim cI As mRemoteNG.Connection.Info = n.Tag
|
||||
If cI.OpenConnections.Count > 0 Then
|
||||
Me.cMenTreeDisconnect.Enabled = True
|
||||
Exit For
|
||||
End If
|
||||
Dim openConnections As Integer = 0
|
||||
Dim connectionInfo As mRemoteNG.Connection.Info
|
||||
For Each node As TreeNode In selectedNode.Nodes
|
||||
If TypeOf node.Tag Is mRemoteNG.Connection.Info Then
|
||||
connectionInfo = node.Tag
|
||||
openConnections = openConnections + connectionInfo.OpenConnections.Count
|
||||
End If
|
||||
Next
|
||||
If openConnections = 0 Then
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
End If
|
||||
|
||||
Me.cMenTreeToolsTransferFile.Enabled = False
|
||||
|
||||
Me.cMenTreeToolsImportExport.Enabled = True
|
||||
Me.cMenTreeToolsImportExportExportmRemoteXML.Enabled = True
|
||||
Me.cMenTreeToolsImportExportImportFromAD.Enabled = True
|
||||
Me.cMenTreeToolsImportExportImportmRemoteXML.Enabled = True
|
||||
|
||||
Me.cMenTreeToolsExternalApps.Enabled = False
|
||||
|
||||
Me.cMenTreeDuplicate.Enabled = True
|
||||
Me.cMenTreeDelete.Enabled = True
|
||||
|
||||
Me.cMenTreeMoveUp.Enabled = True
|
||||
Me.cMenTreeMoveDown.Enabled = True
|
||||
cMenTreeToolsTransferFile.Enabled = False
|
||||
cMenTreeToolsExternalApps.Enabled = False
|
||||
Case mRemoteNG.Tree.Node.Type.Root
|
||||
Me.cMenTreeConnect.Enabled = False
|
||||
Me.cMenTreeConnectWithOptions.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
Me.cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = False
|
||||
Me.cMenTreeDisconnect.Enabled = False
|
||||
|
||||
Me.cMenTreeToolsTransferFile.Enabled = False
|
||||
|
||||
Me.cMenTreeToolsImportExport.Enabled = True
|
||||
Me.cMenTreeToolsImportExportExportmRemoteXML.Enabled = True
|
||||
Me.cMenTreeToolsImportExportImportFromAD.Enabled = True
|
||||
Me.cMenTreeToolsImportExportImportmRemoteXML.Enabled = True
|
||||
|
||||
Me.cMenTreeToolsExternalApps.Enabled = False
|
||||
|
||||
Me.cMenTreeDuplicate.Enabled = False
|
||||
Me.cMenTreeDelete.Enabled = False
|
||||
|
||||
Me.cMenTreeMoveUp.Enabled = False
|
||||
Me.cMenTreeMoveDown.Enabled = False
|
||||
cMenTreeConnect.Enabled = False
|
||||
cMenTreeConnectWithOptions.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectInFullscreen.Enabled = False
|
||||
cMenTreeConnectWithOptionsConnectToConsoleSession.Enabled = False
|
||||
cMenTreeConnectWithOptionsChoosePanelBeforeConnecting.Enabled = False
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
cMenTreeToolsTransferFile.Enabled = False
|
||||
cMenTreeToolsExternalApps.Enabled = False
|
||||
cMenTreeDuplicate.Enabled = False
|
||||
cMenTreeDelete.Enabled = False
|
||||
cMenTreeMoveUp.Enabled = False
|
||||
cMenTreeMoveDown.Enabled = False
|
||||
Case mRemoteNG.Tree.Node.Type.PuttyRoot
|
||||
cMenTreeAddConnection.Enabled = False
|
||||
cMenTreeAddFolder.Enabled = False
|
||||
cMenTreeConnect.Enabled = False
|
||||
cMenTreeConnectWithOptions.Enabled = False
|
||||
cMenTreeDisconnect.Enabled = False
|
||||
cMenTreeToolsTransferFile.Enabled = False
|
||||
cMenTreeConnectWithOptions.Enabled = False
|
||||
cMenTreeToolsImportExport.Enabled = False
|
||||
cMenTreeToolsSort.Enabled = False
|
||||
cMenTreeToolsExternalApps.Enabled = False
|
||||
cMenTreeDuplicate.Enabled = False
|
||||
cMenTreeRename.Enabled = False
|
||||
cMenTreeDelete.Enabled = False
|
||||
cMenTreeMoveUp.Enabled = False
|
||||
cMenTreeMoveDown.Enabled = False
|
||||
Case Else
|
||||
Me.cMenTree.Enabled = False
|
||||
cMenTree.Enabled = False
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ShowHideTreeContextMenuItems (UI.Window.Tree) failed" & vbNewLine & ex.Message, True)
|
||||
@@ -861,26 +873,23 @@ Namespace UI
|
||||
Dim pt As Point = CType(sender, TreeView).PointToClient(New Point(e.X, e.Y))
|
||||
Dim targetNode As TreeNode = selectedTreeview.GetNodeAt(pt)
|
||||
|
||||
'See if the targetNode is currently selected,
|
||||
'if so no need to validate again
|
||||
If Not (selectedTreeview.SelectedNode Is targetNode) Then
|
||||
'Select the node currently under the cursor
|
||||
selectedTreeview.SelectedNode = targetNode
|
||||
'Select the node currently under the cursor
|
||||
selectedTreeview.SelectedNode = targetNode
|
||||
|
||||
'Check that the selected node is not the dropNode and
|
||||
'also that it is not a child of the dropNode and
|
||||
'therefore an invalid target
|
||||
Dim dropNode As TreeNode = CType(e.Data.GetData("System.Windows.Forms.TreeNode"), TreeNode)
|
||||
'Check that the selected node is not the dropNode and
|
||||
'also that it is not a child of the dropNode and
|
||||
'therefore an invalid target
|
||||
Dim dropNode As TreeNode = CType(e.Data.GetData("System.Windows.Forms.TreeNode"), TreeNode)
|
||||
|
||||
Do Until targetNode Is Nothing
|
||||
If targetNode Is dropNode Then
|
||||
e.Effect = DragDropEffects.None
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
targetNode = targetNode.Parent
|
||||
Loop
|
||||
End If
|
||||
Dim puttyRootInfo As Root.PuttySessions.Info
|
||||
Do Until targetNode Is Nothing
|
||||
puttyRootInfo = TryCast(targetNode.Tag, Root.PuttySessions.Info)
|
||||
If puttyRootInfo IsNot Nothing Or targetNode Is dropNode Then
|
||||
e.Effect = DragDropEffects.None
|
||||
Return
|
||||
End If
|
||||
targetNode = targetNode.Parent
|
||||
Loop
|
||||
|
||||
'Currently selected node is a suitable target
|
||||
e.Effect = DragDropEffects.Move
|
||||
@@ -891,6 +900,17 @@ Namespace UI
|
||||
|
||||
Private Sub tvConnections_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles tvConnections.ItemDrag
|
||||
Try
|
||||
Dim dragTreeNode As TreeNode = TryCast(e.Item, TreeNode)
|
||||
If dragTreeNode Is Nothing Then Return
|
||||
|
||||
If dragTreeNode.Tag Is Nothing Then Return
|
||||
If TypeOf dragTreeNode.Tag Is mRemoteNG.Connection.PuttySession.Info Or _
|
||||
Not (TypeOf dragTreeNode.Tag Is mRemoteNG.Connection.Info Or _
|
||||
TypeOf dragTreeNode.Tag Is Container.Info) Then
|
||||
tvConnections.SelectedNode = dragTreeNode
|
||||
Return
|
||||
End If
|
||||
|
||||
'Set the drag node and initiate the DragDrop
|
||||
DoDragDrop(e.Item, DragDropEffects.Move)
|
||||
Catch ex As Exception
|
||||
@@ -1029,7 +1049,7 @@ Namespace UI
|
||||
containerNode = containerNode.Parent
|
||||
End If
|
||||
|
||||
Dim newConnectionInfo As New Info()
|
||||
Dim newConnectionInfo As New mRemoteNG.Connection.Info()
|
||||
If mRemoteNG.Tree.Node.GetNodeType(containerNode) = mRemoteNG.Tree.Node.Type.Root Then
|
||||
newConnectionInfo.Inherit.TurnOffInheritanceCompletely()
|
||||
Else
|
||||
@@ -1068,7 +1088,7 @@ Namespace UI
|
||||
End If
|
||||
End If
|
||||
|
||||
newContainerInfo.ConnectionInfo = New Info(newContainerInfo)
|
||||
newContainerInfo.ConnectionInfo = New mRemoteNG.Connection.Info(newContainerInfo)
|
||||
|
||||
' We can only inherit from a container node, not the root node or connection nodes
|
||||
If mRemoteNG.Tree.Node.GetNodeType(parentNode) = mRemoteNG.Tree.Node.Type.Container Then
|
||||
@@ -1203,7 +1223,8 @@ Namespace UI
|
||||
|
||||
Private Sub StartExternalApp(ByVal ExtA As Tools.ExternalTool)
|
||||
Try
|
||||
If mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.Connection Then
|
||||
If mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.Connection Or _
|
||||
mRemoteNG.Tree.Node.GetNodeType(mRemoteNG.Tree.Node.SelectedNode) = mRemoteNG.Tree.Node.Type.PuttySession Then
|
||||
ExtA.Start(mRemoteNG.Tree.Node.SelectedNode.Tag)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -571,6 +571,12 @@
|
||||
<setting name="ShowConfigHelpText" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="PuttySavedSessionsName" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="PuttySavedSessionsPanel" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</mRemoteNG.My.MySettings>
|
||||
</userSettings>
|
||||
<applicationSettings>
|
||||
|
||||
@@ -187,6 +187,9 @@
|
||||
<Compile Include="Config\Config.Settings.Providers.vb" />
|
||||
<Compile Include="Config\Config.Settings.Save.vb" />
|
||||
<Compile Include="Config\ConfirmClose.vb" />
|
||||
<Compile Include="Config\PuttySessions.vb" />
|
||||
<Compile Include="Connection\PuttySession.Info.vb" />
|
||||
<Compile Include="Root\PuttySessions.Info.vb" />
|
||||
<Compile Include="Themes\ThemeManager.vb" />
|
||||
<Compile Include="Themes\ThemeSerializer.vb" />
|
||||
<Compile Include="Connection\Connection.Icon.vb" />
|
||||
@@ -215,7 +218,6 @@
|
||||
<Compile Include="Connection\Connection.Protocol.SSH2.vb" />
|
||||
<Compile Include="Connection\Connection.Protocol.Telnet.vb" />
|
||||
<Compile Include="Connection\Connection.Protocol.VNC.vb" />
|
||||
<Compile Include="Connection\Connection.PuttySession.vb" />
|
||||
<Compile Include="Connection\Connection.QuickConnect.vb" />
|
||||
<Compile Include="Themes\ThemeInfo.vb" />
|
||||
<Compile Include="Tools\CommandLineArguments.vb" />
|
||||
@@ -652,6 +654,7 @@
|
||||
<Content Include="Help\Update.htm">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Resources\Images\PuttySessions.png" />
|
||||
<None Include="Notes\Help.txt" />
|
||||
<None Include="Notes\ICA.txt" />
|
||||
<None Include="Notes\Misc.txt" />
|
||||
@@ -810,6 +813,9 @@
|
||||
<Content Include="Icons\mRemoteNG.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Icons\PuTTY.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Icons\Remote Desktop.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
Reference in New Issue
Block a user