TLS Anpassungen und Logging

This commit is contained in:
Developer01
2025-06-26 16:42:22 +02:00
parent 2ea8178aaa
commit c5715e7c89
5 changed files with 461 additions and 347 deletions

View File

@@ -32,21 +32,43 @@ Public Class frmMain
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName)
_limilab = New Limilab(LogConfig)
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath)
Logger = LogConfig.GetLogger()
_limilab = New Limilab(LogConfig)
Dim oUserAppDataPath As String = Application.UserAppDataPath
Dim oCommonAppDataPath = Application.CommonAppDataPath
Dim oStartupPath = Application.StartupPath
Dim oAppconfig As String = "AppConfig.xml"
Dim oAppConfigFilePath As String = Path.Combine(oStartupPath, oAppconfig)
If File.Exists(oAppConfigFilePath) Then
Logger.Info("Die Datei AppConfig.xml ist im StartUp-Path vorhanden.")
' UserAppDataPath = StartupPath
oCommonAppDataPath = oStartupPath
Else
Logger.Info("Keine AppConfig.xml-Konfiguration!")
End If
ConfigManager = New ConfigManager(Of Config)(LogConfig, oUserAppDataPath, oCommonAppDataPath, oStartupPath)
ConfigManager.Save()
LogConfig.Debug = ConfigManager.Config.Debug
If ConfigManager.Config.Debug = True Then
Logger.Info("!! DEBUG is ACTIVE !!")
End If
LogConfig.Debug = ConfigManager.Config.Debug
InitDatabase()
ToolStripProgressBar2.Visible = False
Logger.Debug($"AppConfig is located at: [{AppDomain.CurrentDomain.SetupInformation.ConfigurationFile}]")
Try
If ConfigManager.Config.UseWindream Then
_windream = New clsWindream_allgemein(LogConfig)
End If
Catch ex As Exception
Logger.Error(ex)
ConfigManager.Save()
End Try
If ConfigManager.Config.UseWindream Then
_windream = New clsWindream_allgemein(LogConfig)
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in FormLoad")
End Try
@@ -60,9 +82,15 @@ Public Class frmMain
Active_Color(ACTIVECheckBox3)
Active_Color(ACTIVECheckBox4)
End If
If ConfigManager.Config.UseWindream Then
ObjektTypenEintragen()
End If
Try
If ConfigManager.Config.UseWindream Then
ObjektTypenEintragen()
End If
Catch ex As Exception
Logger.Error(ex)
ConfigManager.Save()
End Try
_Encryption = New clsEncryption("!35452didalog=", LogConfig)
End Sub
@@ -99,6 +127,7 @@ Public Class frmMain
Me.TBEMLP_POLL_INDEXING_STEPSTableAdapter.Fill(Me.MyDataset.TBEMLP_POLL_INDEXING_STEPS)
Catch ex As Exception
MsgBox("Unexpected Error in Load_AllData: " & ex.Message, MsgBoxStyle.Critical)
ConfigManager.Save()
End Try
End Sub
Sub Load_Profiles()
@@ -738,10 +767,14 @@ Public Class frmMain
Dim PWPlain = _Encryption.DecryptData(EMAIL_PWTextBox.Text)
'NEW
_MailSender = New Mail.MailSender(LogConfig)
Dim oDefault As Boolean = True
If CheckBoxEnableTls1_1.Checked Or CheckBoxEnableTls1_2.Checked Then
oDefault = False
End If
Dim oOptions As New Mail.MailSession.MailSessionOptions() With {
.EnableTls1_1 = False,
.EnableTls1_2 = False,
.EnableDefault = True
.EnableTls1_1 = CheckBoxEnableTls1_1.Checked,
.EnableTls1_2 = CheckBoxEnableTls1_2.Checked,
.EnableDefault = oDefault
}
Dim oResult As Mail.MailSession.SessionInfo = _MailSender.Connect(EMAIL_SMTPTextBox.Text, PORTTextBox.Text, EMAIL_USERTextBox.Text, PWPlain, AUTH_TYPEComboBox.Text, oOptions)
@@ -994,4 +1027,8 @@ Public Class frmMain
PATH_ORIGINALTextBox.Text = FolderBrowserDialog1.SelectedPath
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ConfigManager.Save()
End Sub
End Class