This commit is contained in:
SchreiberM 2020-12-17 16:12:08 +01:00
commit 73679224f8
2 changed files with 25 additions and 8 deletions

View File

@ -19,6 +19,6 @@ Public Class ClassConfig
Public Property ResultDataWindowLocation As Point = New Size(0, 0) Public Property ResultDataWindowLocation As Point = New Size(0, 0)
<ConnectionStringAppServer> <ConnectionStringAppServer>
Public Property ConnectionStringAppServer As String = "" Public Property ConnectionStringAppServer As String = ""
<AppServerConfig> <GlobalSetting>
Public Property AppServerConfig As String = "" Public Property AppServerConfig As String = ""
End Class End Class

View File

@ -87,15 +87,32 @@ Public Class ClassInit
End Function End Function
Public Function InitBasics() Public Function InitBasics()
Dim UserAppDataPath = Application.UserAppDataPath Dim oUserAppDataPath As String = Application.UserAppDataPath
Dim CommonAppDataPath = Application.CommonAppDataPath Dim oLegacyAppDataPath As String = Application.UserAppDataPath
Dim StartupPath = Application.StartupPath Dim oCommonAppDataPath = Application.CommonAppDataPath
If My.Settings.UseAppConfigConString = True Then Dim oStartupPath = Application.StartupPath
' UserAppDataPath = StartupPath Dim oConfigPrefix As String = My.Settings.UserConfig_Prefix
CommonAppDataPath = StartupPath
' If prefix is configured, use it to create a subfolder in app data and migrate existing data
If oConfigPrefix.Length > 0 Then
oUserAppDataPath = IO.Path.Combine(Application.UserAppDataPath, oConfigPrefix)
Dim oConfigUtils As New ConfigUtils(LogConfig)
If oConfigUtils.TestMigrationNeeded(oUserAppDataPath) Then
LogConfig.Debug = True
oConfigUtils.MigrateConfig(oLegacyAppDataPath, oUserAppDataPath)
LogConfig.Debug = False
End If
End If End If
ConfigManager = New ConfigManager(Of ClassConfig)(LogConfig, UserAppDataPath, CommonAppDataPath, StartupPath) ' If AppConfig from Startup Path should be forced, rewrite the common app data path
If My.Settings.UseAppConfigConString = True Then
' UserAppDataPath = StartupPath
oCommonAppDataPath = oStartupPath
End If
ConfigManager = New ConfigManager(Of ClassConfig)(LogConfig, oUserAppDataPath, oCommonAppDataPath, oStartupPath)
With ConfigManager.Config With ConfigManager.Config
MyConnectionString = DecryptConnectionString(.ConnectionString) MyConnectionString = DecryptConnectionString(.ConnectionString)