Fix issue MR-196 - Cannot export list without usernames and passwords

This commit is contained in:
Riley McArdle
2013-02-14 20:56:09 -06:00
parent f841f4b41c
commit 182b097902
8 changed files with 122 additions and 120 deletions

View File

@@ -19,6 +19,7 @@
Fix issue MR-172 - RDGatewayPassword is unencrypted in confCons.xml file
Fix issue MR-176 - Del key while editing connection name triggers 'Delete Connection'
Fix issue MR-181 - Sessions on startup
Fix issue MR-196 - Cannot export list without usernames and passwords
Fix issue MR-199 - when using screen inside putty, screen becomes dead when reduce mremoteNG
Fix issue MR-202 - The Connection "Tab" show Ampersands as underscores.
Fix issue MR-214 - Hostname/IP reset

View File

@@ -239,8 +239,8 @@ Namespace App
Public Shared quickyPanel As New DockContent
Public Shared optionsForm As frmOptions
Public Shared optionsPanel As New DockContent
Public Shared saveasForm As UI.Window.SaveAs
Public Shared saveasPanel As New DockContent
Public Shared exportForm As UI.Window.Export
Public Shared exportPanel As New DockContent
Public Shared aboutForm As UI.Window.About
Public Shared aboutPanel As New DockContent
Public Shared updateForm As UI.Window.Update
@@ -278,11 +278,11 @@ Namespace App
Case UI.Window.Type.Options
Windows.optionsForm = New frmOptions(Windows.optionsPanel)
Windows.optionsForm.Show(frmMain.pnlDock)
Case UI.Window.Type.SaveAs
Windows.saveasForm = New UI.Window.SaveAs(Windows.saveasPanel)
Windows.saveasPanel = Windows.saveasForm
Case UI.Window.Type.Export
Windows.exportForm = New UI.Window.Export(Windows.exportPanel)
Windows.exportPanel = Windows.exportForm
Windows.saveasForm.Show(frmMain.pnlDock)
Windows.exportForm.Show(frmMain.pnlDock)
Case UI.Window.Type.SSHTransfer
Windows.sshtransferForm = New UI.Window.SSHTransfer(Windows.sshtransferPanel)
Windows.sshtransferPanel = Windows.sshtransferForm
@@ -1356,18 +1356,16 @@ Namespace App
End Sub
Public Shared Sub SaveConnections(Optional ByVal Update As Boolean = False)
Dim previousTimerState As Boolean = False
Try
If Update = True And My.Settings.UseSQLServer = False Then
Exit Sub
End If
Dim tmrWasEnabled As Boolean
If TimerSqlWatcher IsNot Nothing Then
tmrWasEnabled = TimerSqlWatcher.Enabled
If TimerSqlWatcher.Enabled = True Then
TimerSqlWatcher.Stop()
End If
previousTimerState = TimerSqlWatcher.Enabled
TimerSqlWatcher.Enabled = False
End If
Dim conS As New Config.Connections.Save
@@ -1399,70 +1397,78 @@ Namespace App
If My.Settings.UseSQLServer = True Then
LastSqlUpdate = Now
End If
If tmrWasEnabled Then
TimerSqlWatcher.Start()
End If
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, My.Language.strConnectionsFileCouldNotBeSaved & vbNewLine & ex.Message)
Finally
If TimerSqlWatcher IsNot Nothing Then
TimerSqlWatcher.Enabled = previousTimerState
End If
End Try
End Sub
Public Shared Sub SaveConnectionsAs(ByVal SaveSecurity As Security.Save, ByVal RootNode As TreeNode)
Dim conS As New Config.Connections.Save
Try
Dim tmrWasEnabled As Boolean
Public Shared Sub SaveConnectionsAs(Optional ByVal rootNode As TreeNode = Nothing, Optional ByVal saveSecurity As Security.Save = Nothing)
Dim connectionsSave As New Config.Connections.Save
Dim previousTimerState As Boolean = False
Try
If TimerSqlWatcher IsNot Nothing Then
tmrWasEnabled = TimerSqlWatcher.Enabled
If TimerSqlWatcher.Enabled = True Then
TimerSqlWatcher.Stop()
End If
previousTimerState = TimerSqlWatcher.Enabled
TimerSqlWatcher.Enabled = False
End If
Dim export As Boolean = False
Dim saveAsDialog As SaveFileDialog
If rootNode Is Nothing Then
rootNode = Windows.treeForm.tvConnections.Nodes(0)
saveAsDialog = Controls.ConnectionsSaveAsDialog
Else
export = True
saveAsDialog = Controls.ConnectionsExportDialog
End If
Dim sD As SaveFileDialog = Tools.Controls.ConnectionsSaveAsDialog
If sD.ShowDialog = System.Windows.Forms.DialogResult.OK Then
conS.ConnectionFileName = sD.FileName
If saveAsDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then
connectionsSave.ConnectionFileName = saveAsDialog.FileName
Else
Exit Sub
End If
Select Case sD.FilterIndex
Case 1
conS.SaveFormat = Config.Connections.Save.Format.mRXML
Case 2
conS.SaveFormat = Config.Connections.Save.Format.mRCSV
Case 3
conS.SaveFormat = Config.Connections.Save.Format.vRDCSV
End Select
If export Then
Select Case saveAsDialog.FilterIndex
Case 1
connectionsSave.SaveFormat = Config.Connections.Save.Format.mRXML
Case 2
connectionsSave.SaveFormat = Config.Connections.Save.Format.mRCSV
Case 3
connectionsSave.SaveFormat = Config.Connections.Save.Format.vRDCSV
End Select
Else
connectionsSave.SaveFormat = Config.Connections.Save.Format.mRXML
If RootNode Is Windows.treeForm.tvConnections.Nodes(0) Then
If conS.SaveFormat <> Config.Connections.Save.Format.mRXML And conS.SaveFormat <> Config.Connections.Save.Format.None Then
If connectionsSave.ConnectionFileName = Info.Connections.DefaultConnectionsPath & "\" & Info.Connections.DefaultConnectionsFile Then
My.Settings.LoadConsFromCustomLocation = False
Else
If conS.ConnectionFileName = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile Then
My.Settings.LoadConsFromCustomLocation = False
Else
My.Settings.LoadConsFromCustomLocation = True
My.Settings.CustomConsPath = conS.ConnectionFileName
End If
My.Settings.LoadConsFromCustomLocation = True
My.Settings.CustomConsPath = connectionsSave.ConnectionFileName
End If
End If
conS.ConnectionList = ConnectionList
conS.ContainerList = ContainerList
If RootNode IsNot Windows.treeForm.tvConnections.Nodes(0) Then
conS.Export = True
End If
conS.SaveSecurity = SaveSecurity
conS.RootTreeNode = RootNode
connectionsSave.ConnectionList = ConnectionList
connectionsSave.ContainerList = ContainerList
connectionsSave.RootTreeNode = rootNode
conS.Save()
connectionsSave.Export = export
If saveSecurity Is Nothing Then saveSecurity = New Security.Save
connectionsSave.SaveSecurity = saveSecurity
connectionsSave.Save()
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, String.Format(My.Language.strConnectionsFileCouldNotSaveAs, conS.ConnectionFileName) & vbNewLine & ex.Message)
MessageCollector.AddMessage(MessageClass.ErrorMsg, String.Format(My.Language.strConnectionsFileCouldNotSaveAs, connectionsSave.ConnectionFileName) & vbNewLine & ex.Message)
Finally
If TimerSqlWatcher IsNot Nothing Then
TimerSqlWatcher.Enabled = previousTimerState
End If
End Try
End Sub
#End Region

View File

@@ -471,14 +471,12 @@ Namespace Config
If IsConnectionsFileLoaded = False Then Exit Sub
Dim treeNode As TreeNode
Dim isExport As Boolean = False
If Tree.Node.GetNodeType(RootTreeNode) = Tree.Node.Type.Root Then
treeNode = RootTreeNode.Clone
Else
treeNode = New TreeNode("mR|Export (" + Tools.Misc.DBDate(Now) + ")")
treeNode.Nodes.Add(RootTreeNode.Clone)
isExport = True
End If
Dim tempFileName As String = Path.GetTempFileName()
@@ -491,9 +489,9 @@ Namespace Config
_xmlTextWriter.WriteStartElement("Connections") ' Do not localize
_xmlTextWriter.WriteAttributeString("Name", "", treeNode.Text)
_xmlTextWriter.WriteAttributeString("Export", "", isExport)
_xmlTextWriter.WriteAttributeString("Export", "", Export)
If isExport Then
If Export Then
_xmlTextWriter.WriteAttributeString("Protected", "", Security.Crypt.Encrypt("ThisIsNotProtected", _password))
Else
If TryCast(treeNode.Tag, Root.Info).Password = True Then
@@ -514,12 +512,14 @@ Namespace Config
_xmlTextWriter.WriteEndElement()
_xmlTextWriter.Close()
Dim backupFileName As String = ConnectionFileName & ".backup"
File.Delete(backupFileName)
File.Move(ConnectionFileName, backupFileName)
If Not Export And File.Exists(ConnectionFileName) Then
Dim backupFileName As String = ConnectionFileName & ".backup"
File.Delete(backupFileName)
File.Move(ConnectionFileName, backupFileName)
End If
File.Move(tempFileName, ConnectionFileName)
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveToXml failed" & vbNewLine & ex.Message, True)
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SaveToXml failed" & vbNewLine & ex.Message, False)
End Try
End Sub

View File

@@ -347,7 +347,7 @@ Public Class frmMain
End Sub
Private Sub mMenFileSaveAs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mMenFileSaveAs.Click
App.Runtime.Windows.Show(UI.Window.Type.SaveAs)
SaveConnectionsAs()
End Sub
Private Sub mMenFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mMenFileExit.Click

View File

@@ -179,15 +179,27 @@ Namespace Tools
End Class
Public Shared Function ConnectionsSaveAsDialog() As SaveFileDialog
Dim sDlg As New SaveFileDialog()
sDlg.CheckPathExists = True
sDlg.InitialDirectory = App.Info.Connections.DefaultConnectionsPath
sDlg.FileName = App.Info.Connections.DefaultConnectionsFile
sDlg.OverwritePrompt = True
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.CheckPathExists = True
saveFileDialog.InitialDirectory = App.Info.Connections.DefaultConnectionsPath
saveFileDialog.FileName = App.Info.Connections.DefaultConnectionsFile
saveFileDialog.OverwritePrompt = True
sDlg.Filter = My.Language.strFiltermRemoteXML & "|*.xml|" & My.Language.strFiltermRemoteCSV & "|*.csv|" & My.Language.strFiltervRD2008CSV & "|*.csv|" & My.Language.strFilterAll & "|*.*"
saveFileDialog.Filter = My.Language.strFiltermRemoteXML & "|*.xml|" & My.Language.strFilterAll & "|*.*"
Return sDlg
Return saveFileDialog
End Function
Public Shared Function ConnectionsExportDialog() As SaveFileDialog
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.CheckPathExists = True
saveFileDialog.InitialDirectory = App.Info.Connections.DefaultConnectionsPath
saveFileDialog.FileName = App.Info.Connections.DefaultConnectionsFile
saveFileDialog.OverwritePrompt = True
saveFileDialog.Filter = My.Language.strFiltermRemoteXML & "|*.xml|" & My.Language.strFiltermRemoteCSV & "|*.csv|" & My.Language.strFiltervRD2008CSV & "|*.csv|" & My.Language.strFilterAll & "|*.*"
Return saveFileDialog
End Function
Public Shared Function ConnectionsLoadDialog() As OpenFileDialog

View File

@@ -3,7 +3,7 @@ Imports mRemoteNG.App.Runtime
Namespace UI
Namespace Window
Public Class SaveAs
Public Class Export
Inherits UI.Window.Base
#Region "Form Init"
@@ -112,7 +112,7 @@ Namespace UI
Me.PictureBox1.TabIndex = 112
Me.PictureBox1.TabStop = False
'
'SaveAs
'Export
'
Me.AcceptButton = Me.btnOK
Me.CancelButton = Me.btnCancel
@@ -124,9 +124,9 @@ Namespace UI
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnOK)
Me.Icon = Global.mRemoteNG.My.Resources.Resources.Connections_SaveAs_Icon
Me.Name = "SaveAs"
Me.TabText = "Save Connections As"
Me.Text = "Save Connections As"
Me.Name = "Export"
Me.TabText = "Export Connections"
Me.Text = "Export Connections"
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -135,50 +135,33 @@ Namespace UI
#End Region
#Region "Public Properties"
Private _Export As Boolean
Public Property Export() As Boolean
Get
Return _Export
End Get
Set(ByVal value As Boolean)
_Export = value
End Set
End Property
Private _TreeNode As TreeNode
Private _treeNode As TreeNode
Public Property TreeNode() As TreeNode
Get
Return _TreeNode
Return _treeNode
End Get
Set(ByVal value As TreeNode)
_TreeNode = value
_treeNode = value
End Set
End Property
#End Region
#Region "Public Methods"
Public Sub New(ByVal Panel As DockContent)
Me.New(Panel, False, Nothing)
Public Sub New(ByVal panel As DockContent)
Me.New(panel, Nothing)
End Sub
Public Sub New(ByVal Panel As DockContent, ByVal Export As Boolean, ByVal TreeNode As TreeNode)
Me.WindowType = Type.SaveAs
Me.DockPnl = Panel
Me.InitializeComponent()
Public Sub New(ByVal panel As DockContent, ByVal treeNode As TreeNode)
WindowType = Type.Export
DockPnl = panel
InitializeComponent()
If Export Then
Me.SetFormText(My.Language.strExport)
Else
Me.SetFormText(My.Language.strMenuSaveConnectionFileAs)
End If
Me._Export = Export
Me._TreeNode = TreeNode
_treeNode = treeNode
End Sub
#End Region
#Region "Form Stuff"
Private Sub SaveAs_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Private Sub Export_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ApplyLanguage()
End Sub
@@ -191,8 +174,8 @@ Namespace UI
btnOK.Text = My.Language.strButtonOK
Label1.Text = My.Language.strUncheckProperties
lblMremoteXMLOnly.Text = My.Language.strPropertiesWillOnlyBeSavedMRemoteXML
TabText = My.Language.strMenuSaveConnectionFileAs
Text = My.Language.strMenuSaveConnectionFileAs
TabText = My.Language.strExport
Text = My.Language.strExport
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
@@ -201,21 +184,21 @@ Namespace UI
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Try
If _TreeNode Is Nothing Then
_TreeNode = App.Runtime.Windows.treeForm.tvConnections.Nodes(0)
If _treeNode Is Nothing Then
_treeNode = Windows.treeForm.tvConnections.Nodes(0)
End If
Dim sS As New Security.Save()
Dim saveSecurity As New Security.Save()
sS.Username = Me.lvSecurity.Items(0).Checked
sS.Password = Me.lvSecurity.Items(1).Checked
sS.Domain = Me.lvSecurity.Items(2).Checked
sS.Inheritance = Me.lvSecurity.Items(3).Checked
saveSecurity.Username = lvSecurity.Items(0).Checked
saveSecurity.Password = lvSecurity.Items(1).Checked
saveSecurity.Domain = lvSecurity.Items(2).Checked
saveSecurity.Inheritance = lvSecurity.Items(3).Checked
App.Runtime.SaveConnectionsAs(sS, _TreeNode)
Me.Close()
SaveConnectionsAs(_treeNode, saveSecurity)
Close()
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "btnOK_Click (UI.Window.SaveAs) failed" & vbNewLine & ex.Message, True)
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "UI.Window.Export.btnOK_Click() failed" & vbNewLine & ex.Message, True)
End Try
End Sub
#End Region

View File

@@ -723,7 +723,7 @@ Namespace UI
Me.cMenTreeToolsTransferFile.Enabled = False
Me.cMenTreeToolsImportExport.Enabled = True
Me.cMenTreeToolsImportExportExportmRemoteXML.Enabled = False
Me.cMenTreeToolsImportExportExportmRemoteXML.Enabled = True
Me.cMenTreeToolsImportExportImportFromAD.Enabled = True
Me.cMenTreeToolsImportExportImportmRemoteXML.Enabled = True
@@ -1106,10 +1106,10 @@ Namespace UI
Private Sub ExportXML()
Try
If Me.tvConnections.SelectedNode IsNot Nothing Then
Windows.saveasForm = New UI.Window.SaveAs(Windows.saveasPanel, True, Me.tvConnections.SelectedNode)
Windows.saveasPanel = Windows.saveasForm
Windows.exportForm = New UI.Window.Export(Windows.exportPanel, Me.tvConnections.SelectedNode)
Windows.exportPanel = Windows.exportForm
Windows.saveasForm.Show(frmMain.pnlDock)
Windows.exportForm.Show(frmMain.pnlDock)
End If
Catch ex As Exception
MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ExportXml (UI.Window.Tree) failed" & vbNewLine & ex.Message, True)

View File

@@ -8,7 +8,7 @@ Namespace UI
ErrorsAndInfos = 4
ScreenshotManager = 5
Options = 6
SaveAs = 7
Export = 7
About = 8
Update = 9
SSHTransfer = 10