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"> <setting name="UseAppConfigConString" serializeAs="String">
<value>True</value> <value>True</value>
</setting> </setting>
<setting name="UserConfig_Prefix" serializeAs="String">
<value>TEST</value>
</setting>
</DD_ProcessManager.My.MySettings> </DD_ProcessManager.My.MySettings>
<DevExpress.LookAndFeel.Design.AppSettings> <DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String"> <setting name="DefaultAppSkin" serializeAs="String">

View File

@ -23,7 +23,7 @@ Public Class ClassInit
LOGGER.Info("## ProcessManager started - {0}", Now) LOGGER.Info("## ProcessManager started - {0}", Now)
Try 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 For Each file As IO.FileInfo In directory.GetFiles
If (Now - file.CreationTime).Days > 29 Then If (Now - file.CreationTime).Days > 29 Then
@ -42,15 +42,32 @@ Public Class ClassInit
<STAThread()> <STAThread()>
Public Sub InitUserConfig() Public Sub InitUserConfig()
Try Try
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
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") LOGGER.Info("Config loaded")
If CONFIG.Config.ConnectionStringTest <> String.Empty And CONFIG.Config.TestMode = True Then If CONFIG.Config.ConnectionStringTest <> String.Empty And CONFIG.Config.TestMode = True Then
@ -69,9 +86,11 @@ Public Class ClassInit
CONNECTION_STRING_READ = CONNECTION_STRING CONNECTION_STRING_READ = CONNECTION_STRING
End If End If
If CONFIG.Config.EDMIAppServer <> String.Empty Then If CONFIG.Config.AppServerConfig <> String.Empty Then
Try Try
Dim oSplit() = CONFIG.Config.EDMIAppServer.ToString.Split(";") Dim oSplit() = CONFIG.Config.AppServerConfig.ToString.Split(";")
Dim oAppServer = oSplit(0) Dim oAppServer = oSplit(0)
Dim oAppServerPort = 9000 Dim oAppServerPort = 9000
If oSplit.Length = 2 Then If oSplit.Length = 2 Then
@ -80,7 +99,7 @@ Public Class ClassInit
_Client = New Client(LOGCONFIG, oAppServer, oAppServerPort) _Client = New Client(LOGCONFIG, oAppServer, oAppServerPort)
If Not IsNothing(_Client) Then If Not IsNothing(_Client) Then
If _Client.Connect() Then If _Client.Connect() Then
EDMIAppServerActive = True APPSERVER_ACTIVE = True
End If End If
End If End If

View File

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

View File

@ -297,6 +297,15 @@ Namespace My
Return CType(Me("UseAppConfigConString"),Boolean) Return CType(Me("UseAppConfigConString"),Boolean)
End Get End Get
End Property 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 Class
End Namespace End Namespace

View File

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