diff --git a/mRemoteV1/App/App.Runtime.vb b/mRemoteV1/App/App.Runtime.vb
index cc279382c..ad77c806c 100644
--- a/mRemoteV1/App/App.Runtime.vb
+++ b/mRemoteV1/App/App.Runtime.vb
@@ -729,6 +729,8 @@ Namespace App
End Sub
Public Shared Sub LoadConnections(Optional ByVal WithDialog As Boolean = False, Optional ByVal Update As Boolean = False)
+ Dim conL As New Config.Connections.Load
+
Try
Dim tmrWasEnabled As Boolean
If tmrSqlWatcher IsNot Nothing Then
@@ -747,41 +749,18 @@ Namespace App
cL = New Connection.List
ctL = New Container.List
- Dim conL As New Config.Connections.Load
-
If My.Settings.UseSQLServer = False Then
If WithDialog Then
Dim lD As OpenFileDialog = Tools.Controls.ConnectionsLoadDialog
If lD.ShowDialog = System.Windows.Forms.DialogResult.OK Then
conL.ConnectionFileName = lD.FileName
-
- If conL.ConnectionFileName = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile Then
- My.Settings.LoadConsFromCustomLocation = False
- Else
- My.Settings.LoadConsFromCustomLocation = True
- My.Settings.CustomConsPath = conL.ConnectionFileName
- End If
Else
Exit Sub
End If
Else
- If My.Settings.LoadConsFromCustomLocation = False Then
- Dim oldPath As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\" & My.Application.Info.ProductName & "\" & App.Info.Connections.DefaultConnectionsFile
- Dim newPath As String = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile
-#If Not PORTABLE Then
- If File.Exists(oldPath) Then
- conL.ConnectionFileName = oldPath
- Else
- conL.ConnectionFileName = newPath
- End If
-#Else
- conL.ConnectionFileName = newPath
-#End If
- Else
- conL.ConnectionFileName = My.Settings.CustomConsPath
- End If
- End If
+ conL.ConnectionFileName = GetStartupConnectionFileName()
+ End If
If File.Exists(conL.ConnectionFileName) = False Then
If WithDialog Then
@@ -832,6 +811,13 @@ Namespace App
If My.Settings.UseSQLServer = True Then
LastSQLUpdate = Now
+ Else
+ If conL.ConnectionFileName = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile Then
+ My.Settings.LoadConsFromCustomLocation = False
+ Else
+ My.Settings.LoadConsFromCustomLocation = True
+ My.Settings.CustomConsPath = conL.ConnectionFileName
+ End If
End If
If tmrWasEnabled And tmrSqlWatcher IsNot Nothing Then
@@ -839,9 +825,40 @@ Namespace App
End If
Catch ex As Exception
mC.AddMessage(Messages.MessageClass.ErrorMsg, My.Resources.strConnectionsFileCouldNotBeLoaded & vbNewLine & ex.Message)
+ If My.Settings.UseSQLServer = False Then
+ If Not conL.ConnectionFileName = GetStartupConnectionFileName() Then
+ LoadConnections()
+ Exit Sub
+ Else
+ MsgBox(String.Format(My.Resources.strErrorStartupConnectionFileLoad, vbNewLine, Application.ProductName, GetStartupConnectionFileName(), ex.Message), MsgBoxStyle.OkOnly + MsgBoxStyle.Critical)
+ Application.Exit()
+ End If
+ End If
End Try
End Sub
+ Protected Shared Function GetStartupConnectionFileName() As String
+ Dim fileName As New String("")
+
+ If My.Settings.LoadConsFromCustomLocation = False Then
+ Dim oldPath As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\" & My.Application.Info.ProductName & "\" & App.Info.Connections.DefaultConnectionsFile
+ Dim newPath As String = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile
+#If Not PORTABLE Then
+ If File.Exists(oldPath) Then
+ fileName = oldPath
+ Else
+ fileName = newPath
+ End If
+#Else
+ fileName = newPath
+#End If
+ Else
+ fileName = My.Settings.CustomConsPath
+ End If
+
+ Return fileName
+ End Function
+
Public Shared Sub ImportConnections()
Try
Dim lD As OpenFileDialog = Tools.Controls.ConnectionsLoadDialog
diff --git a/mRemoteV1/CHANGELOG.TXT b/mRemoteV1/CHANGELOG.TXT
index f7a33db5d..b0ffc6e95 100644
--- a/mRemoteV1/CHANGELOG.TXT
+++ b/mRemoteV1/CHANGELOG.TXT
@@ -1,5 +1,6 @@
1.69 (2011-07-29):
Fixed issue #66 - Fresh Install Fails to Create Config
+ Fixed issue #67 - Connection file gets erased
Disabled automatic updates in the portable edition
Updated PuTTY to version 0.61
Binaries are now digitally signed
diff --git a/mRemoteV1/Config/Config.Connections.Load.vb b/mRemoteV1/Config/Config.Connections.Load.vb
index 0f7c4081d..497121e8d 100644
--- a/mRemoteV1/Config/Config.Connections.Load.vb
+++ b/mRemoteV1/Config/Config.Connections.Load.vb
@@ -716,6 +716,7 @@ Namespace Config
Catch ex As Exception
App.Runtime.ConnectionsFileLoaded = False
mC.AddMessage(Messages.MessageClass.ErrorMsg, My.Resources.strLoadFromXmlFailed & vbNewLine & ex.Message, True)
+ Throw
End Try
End Sub
diff --git a/mRemoteV1/My Project/Resources.Designer.vb b/mRemoteV1/My Project/Resources.Designer.vb
index 02cf14593..cdd1ccad2 100644
--- a/mRemoteV1/My Project/Resources.Designer.vb
+++ b/mRemoteV1/My Project/Resources.Designer.vb
@@ -2186,6 +2186,15 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Looks up a localized string similar to The startup connection file could not be loaded.{0}{0}{2}{0}{3}{0}{0}In order to prevent data loss, {1} will now exit..
+ '''
+ Friend ReadOnly Property strErrorStartupConnectionFileLoad() As String
+ Get
+ Return ResourceManager.GetString("strErrorStartupConnectionFileLoad", resourceCulture)
+ End Get
+ End Property
+
'''
''' Looks up a localized string similar to VerifyDatabaseVersion (Config.Connections.Save) failed. {0}.
'''
diff --git a/mRemoteV1/My Project/Resources.resx b/mRemoteV1/My Project/Resources.resx
index 319debe62..61d11bf37 100644
--- a/mRemoteV1/My Project/Resources.resx
+++ b/mRemoteV1/My Project/Resources.resx
@@ -2349,4 +2349,7 @@ Error Description: {1}
mRemoteNG Portable Edition does not currently support automatic updates.
+
+ The startup connection file could not be loaded.{0}{0}{2}{0}{3}{0}{0}In order to prevent data loss, {1} will now exit.
+
\ No newline at end of file