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)
<ConnectionStringAppServer>
Public Property ConnectionStringAppServer As String = ""
<AppServerConfig>
<GlobalSetting>
Public Property AppServerConfig As String = ""
End Class

View File

@ -87,15 +87,32 @@ Public Class ClassInit
End Function
Public Function InitBasics()
Dim UserAppDataPath = Application.UserAppDataPath
Dim CommonAppDataPath = Application.CommonAppDataPath
Dim StartupPath = Application.StartupPath
If My.Settings.UseAppConfigConString = True Then
' UserAppDataPath = StartupPath
CommonAppDataPath = StartupPath
Dim oUserAppDataPath As String = Application.UserAppDataPath
Dim oLegacyAppDataPath As String = Application.UserAppDataPath
Dim oCommonAppDataPath = Application.CommonAppDataPath
Dim oStartupPath = Application.StartupPath
Dim oConfigPrefix As String = My.Settings.UserConfig_Prefix
' 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
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
MyConnectionString = DecryptConnectionString(.ConnectionString)