diff --git a/app/DD_PM_WINDREAM/App.config b/app/DD_PM_WINDREAM/App.config index 6d9b7d1..8c5ddaa 100644 --- a/app/DD_PM_WINDREAM/App.config +++ b/app/DD_PM_WINDREAM/App.config @@ -14,6 +14,9 @@ True + + TEST + diff --git a/app/DD_PM_WINDREAM/ClassInit.vb b/app/DD_PM_WINDREAM/ClassInit.vb index 6de5b4d..74dad69 100644 --- a/app/DD_PM_WINDREAM/ClassInit.vb +++ b/app/DD_PM_WINDREAM/ClassInit.vb @@ -23,7 +23,7 @@ Public Class ClassInit LOGGER.Info("## ProcessManager started - {0}", Now) Try - Dim directory As New IO.DirectoryInfo(LOGCONFIG.LogDirectory) + Dim directory As New IO.DirectoryInfo(Application.LocalUserAppDataPath & "\Log") For Each file As IO.FileInfo In directory.GetFiles If (Now - file.CreationTime).Days > 29 Then @@ -42,15 +42,32 @@ Public Class ClassInit Public Sub InitUserConfig() Try - 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 - CONFIG = 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 + + CONFIG = New ConfigManager(Of ClassConfig)(LOGCONFIG, oUserAppDataPath, oCommonAppDataPath, oStartupPath) LOGGER.Info("Config loaded") If CONFIG.Config.ConnectionStringTest <> String.Empty And CONFIG.Config.TestMode = True Then @@ -69,9 +86,11 @@ Public Class ClassInit CONNECTION_STRING_READ = CONNECTION_STRING End If - If CONFIG.Config.EDMIAppServer <> String.Empty Then + If CONFIG.Config.AppServerConfig <> String.Empty Then + + Try - Dim oSplit() = CONFIG.Config.EDMIAppServer.ToString.Split(";") + Dim oSplit() = CONFIG.Config.AppServerConfig.ToString.Split(";") Dim oAppServer = oSplit(0) Dim oAppServerPort = 9000 If oSplit.Length = 2 Then @@ -80,7 +99,7 @@ Public Class ClassInit _Client = New Client(LOGCONFIG, oAppServer, oAppServerPort) If Not IsNothing(_Client) Then If _Client.Connect() Then - EDMIAppServerActive = True + APPSERVER_ACTIVE = True End If End If diff --git a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb index 7e0b2d7..e38ba03 100644 --- a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb +++ b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/app/DD_PM_WINDREAM/My Project/Settings.Designer.vb b/app/DD_PM_WINDREAM/My Project/Settings.Designer.vb index 73ccc60..4f03ca3 100644 --- a/app/DD_PM_WINDREAM/My Project/Settings.Designer.vb +++ b/app/DD_PM_WINDREAM/My Project/Settings.Designer.vb @@ -297,6 +297,15 @@ Namespace My Return CType(Me("UseAppConfigConString"),Boolean) End Get End Property + + _ + Public ReadOnly Property UserConfig_Prefix() As String + Get + Return CType(Me("UserConfig_Prefix"),String) + End Get + End Property End Class End Namespace diff --git a/app/DD_PM_WINDREAM/My Project/Settings.settings b/app/DD_PM_WINDREAM/My Project/Settings.settings index 5137e6a..310cf2d 100644 --- a/app/DD_PM_WINDREAM/My Project/Settings.settings +++ b/app/DD_PM_WINDREAM/My Project/Settings.settings @@ -67,5 +67,8 @@ True + + TEST + \ No newline at end of file