MS Override

This commit is contained in:
SchreiberM 2023-02-24 15:06:18 +01:00
parent 020d8e27c5
commit 5cb9aed5aa
10 changed files with 88 additions and 61 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
@ -17,6 +17,9 @@
<setting name="GHOSTUSER" serializeAs="String">
<value />
</setting>
<setting name="SYS_Override_Language" serializeAs="String">
<value />
</setting>
</DD_Clipboard_Watcher.My.MySettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String">
@ -87,9 +90,19 @@
</DevExpress.LookAndFeel.Design.AppSettings>
</applicationSettings>
<connectionStrings>
<add name="DD_Clipboard_Watcher.My.MySettings.DD_ECMConnectionString" connectionString="Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient"/>
<add name="DD_Clipboard_Watcher.My.MySettings.DD_ECMConnectionString"
connectionString="Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -124,33 +124,33 @@ Public Class ClassInit
oCommonAppDataPath = oStartupPath
End If
ConfigManager = New ConfigManager(Of ClassConfig)(LogConfig, oUserAppDataPath, oCommonAppDataPath, oStartupPath)
CONFIG = New ConfigManager(Of ClassConfig)(LogConfig, oUserAppDataPath, oCommonAppDataPath, oStartupPath)
With ConfigManager.Config
With CONFIG.Config
MyConnectionString = DecryptConnectionString(.ConnectionString)
LogErrorsOnly = .LogErrorsOnly
HotkeySearchKey = .HotkeySearchKey
LogConfig.Debug = Not .LogErrorsOnly
End With
If HotkeySearchKey_via_Server = False Then
HotkeyFunctionKey = ConfigManager.Config.HotkeyFunctionKey
HotkeyFunctionKey = CONFIG.Config.HotkeyFunctionKey
End If
If ConfigManager.Config.ConnectionStringAppServer <> String.Empty Then
MyConStringAppserv = DecryptConnectionString(ConfigManager.Config.ConnectionStringAppServer)
If CONFIG.Config.ConnectionStringAppServer <> String.Empty Then
MyConStringAppserv = DecryptConnectionString(CONFIG.Config.ConnectionStringAppServer)
If InitAppDatabase() Then
Logger.Debug("ConnectionStringAppServer will be used")
End If
End If
If ConfigManager.Config.AppServerConfig <> String.Empty Then
If CONFIG.Config.AppServerConfig <> String.Empty Then
Try
Dim oDynSplitCharacter As String
If ConfigManager.Config.AppServerConfig.Contains(":") Then
If CONFIG.Config.AppServerConfig.Contains(":") Then
oDynSplitCharacter = ":"
ElseIf ConfigManager.Config.AppServerConfig.Contains(";") Then
ElseIf CONFIG.Config.AppServerConfig.Contains(";") Then
oDynSplitCharacter = ";"
End If
Dim oSplit() As String = ConfigManager.Config.AppServerConfig.ToString.Split(oDynSplitCharacter)
Dim oSplit() As String = CONFIG.Config.AppServerConfig.ToString.Split(oDynSplitCharacter)
Dim oAppServerAddress As String = oSplit(0)
Dim oAppServerPort As Integer = 9000
If oSplit.Length = 2 Then
@ -161,7 +161,7 @@ Public Class ClassInit
If _Client.Connect() Then
APPSERVER_ACTIVE = True
Else
Logger.Warn($"###!!!APPServer [{ConfigManager.Config.AppServerConfig.ToString}] could not be initialized ")
Logger.Warn($"###!!!APPServer [{CONFIG.Config.AppServerConfig.ToString}] could not be initialized ")
End If
End If
Catch ex As Exception
@ -199,12 +199,6 @@ Public Class ClassInit
Dim DT_CHECKUSER_MODULE As DataTable
DT_CHECKUSER_MODULE = _DataASorDB.GetDatatable(oSql, "TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'", "", "")
'If APPSERVER_ACTIVE = True Then
' Dim oTableResult As TableResult = _Client.GetDatatableByName("TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'")
' DT_CHECKUSER_MODULE = oTableResult.Table
'Else
' DT_CHECKUSER_MODULE = Database.GetDatatable(oSql)
'End If
If DT_CHECKUSER_MODULE.Rows.Count = 0 Then
Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True)
'ERROR_STATE = "NO USER"
@ -220,7 +214,14 @@ Public Class ClassInit
USER_PRENAME = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME"), "")
USER_SHORTNAME = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME"), "")
USER_EMAIL = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL"), "")
If My.Settings.SYS_Override_Language <> String.Empty Then
USER_LANGUAGE = My.Settings.SYS_Override_Language
Logger.Info("Override Language [{0}] from Config will be used!", USER_LANGUAGE)
Else
USER_LANGUAGE = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE"), "de-DE")
End If
USER_DATE_FORMAT = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_DATE_FORMAT"), "dd.MM.yyyy")
USER_IN_MODULE = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("MODULE_ACCESS"), False)
USER_IS_ADMIN = NotNull(DT_CHECKUSER_MODULE.Rows(0).Item("IS_ADMIN"), False)
@ -361,7 +362,8 @@ Public Class ClassInit
oSQL = "DELETE FROM TBDD_USER_MODULE_LOG_IN WHERE USER_ID = " & USER_ID & " AND MODULE = 'Clipboard-Watcher'"
Database.ExecuteNonQuery(oSQL)
oSQL = String.Format("INSERT INTO TBDD_USER_MODULE_LOG_IN (USER_ID,CLIENT_ID,MODULE,VERSION_CLIENT,MACHINE_NAME) VALUES ({0},{1},'Clipboard-Watcher','{2}','{3}')", USER_ID, 0, My.Application.Info.Version.ToString, Environment.MachineName)
oSQL = String.Format("INSERT INTO TBDD_USER_MODULE_LOG_IN (USER_ID,CLIENT_ID,MODULE,VERSION_CLIENT,MACHINE_NAME,LANGUAGE_OVERRIDE) VALUES
({0},{1},'Clipboard-Watcher','{2}','{3}','{4}')", USER_ID, 0, My.Application.Info.Version.ToString, Environment.MachineName, My.Settings.SYS_Override_Language)
Database.ExecuteNonQuery(oSQL)
If USER_IS_ADMIN = True Then

View File

@ -142,8 +142,8 @@
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.11\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.2\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\Oracle.ManagedDataAccess.dll</HintPath>

View File

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

View File

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

View File

@ -19,5 +19,8 @@
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd</Value>
</Setting>
<Setting Name="SYS_Override_Language" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -39,8 +39,8 @@ Public Class frmConfig_Basic
End If
'SaveConfigValue("MyConnectionString", con)
ConfigManager.Config.ConnectionString = con
ConfigManager.Save()
CONFIG.Config.ConnectionString = con
CONFIG.Save()
Dim csb As New SqlClient.SqlConnectionStringBuilder
csb.ConnectionString = MyConnectionString
@ -148,8 +148,8 @@ Public Class frmConfig_Basic
LogErrorsOnly = chkLogErrorsOnly.Checked
LogConfig.Debug = Not LogErrorsOnly
ConfigManager.Config.LogErrorsOnly = LogErrorsOnly
ConfigManager.Save()
CONFIG.Config.LogErrorsOnly = LogErrorsOnly
CONFIG.Save()
End Sub
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
@ -181,9 +181,9 @@ Public Class frmConfig_Basic
If cmbfunctionHit.SelectedIndex <> -1 Then
Hotkey.RemoveHotKey(ClassConstants.HOTKEY_TRIGGER_WATCHER)
ConfigManager.Config.HotkeyFunctionKey = cmbfunctionHit.Text
ConfigManager.Config.HotkeySearchKey = txtHotkeySearchKey.Text
ConfigManager.Save()
CONFIG.Config.HotkeyFunctionKey = cmbfunctionHit.Text
CONFIG.Config.HotkeySearchKey = txtHotkeySearchKey.Text
CONFIG.Save()
Dim keyCode As Keys
Dim kc As New KeysConverter

View File

@ -363,8 +363,8 @@ Public Class frmMain
}
Dim oService As New State.ServiceState() With {
.Address = ConfigManager.Config.AppServerConfig,
.IsActive = ConfigManager.Config.IsIDB,
.Address = CONFIG.Config.AppServerConfig,
.IsActive = CONFIG.Config.IsIDB,
.IsOnline = False,
.Client = _Client
}

View File

@ -14,7 +14,7 @@ Module modCurrent
Public Const LANGUAGE_GERMAN As String = "de-DE"
Public ConfigManager As ConfigManager(Of ClassConfig)
Public CONFIG As ConfigManager(Of ClassConfig)
Public MyConnectionString As String = ""
Public MyConStringAppserv As String = ""

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.11" targetFramework="net461" />
<package id="NLog" version="5.0.2" targetFramework="net462" />
</packages>