This commit is contained in:
SchreiberM 2020-12-18 08:04:34 +01:00
commit a81f6dba11
5 changed files with 46 additions and 12 deletions

View File

@ -14,6 +14,9 @@
<setting name="UseAppConfigConString" serializeAs="String">
<value>True</value>
</setting>
<setting name="UserConfig_Prefix" serializeAs="String">
<value>TEST</value>
</setting>
</DD_ProcessManager.My.MySettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String">

View File

@ -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
<STAThread()>
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

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.1.5.9")>
<Assembly: AssemblyVersion("2.1.6.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -297,6 +297,15 @@ Namespace My
Return CType(Me("UseAppConfigConString"),Boolean)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("TEST")> _
Public ReadOnly Property UserConfig_Prefix() As String
Get
Return CType(Me("UserConfig_Prefix"),String)
End Get
End Property
End Class
End Namespace

View File

@ -67,5 +67,8 @@
<Setting Name="UseAppConfigConString" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="UserConfig_Prefix" Type="System.String" Scope="Application">
<Value Profile="(Default)">TEST</Value>
</Setting>
</Settings>
</SettingsFile>