From 8c829d490fbca3ad774cf0bbf8dd3f3334b39acc Mon Sep 17 00:00:00 2001 From: Developer01 Date: Wed, 26 Mar 2025 15:27:35 +0100 Subject: [PATCH] MS Baget --- Base/Base.vbproj | 9 ++--- Base/My Project/AssemblyInfo.vb | 16 ++++---- Base/packages.config | 2 + Config/App.config | 22 ++++++++++ Config/Config.vbproj | 51 ++++++++++++++++++------ Config/My Project/AssemblyInfo.vb | 6 +-- Config/README.txt | 5 +++ Config/packages.config | 8 ++++ Database/Database.vbproj | 18 +++------ Database/My Project/AssemblyInfo.vb | 10 ++--- Database/packages.config | 4 +- Encryption/Encryption.vbproj | 9 ++--- Encryption/My Project/AssemblyInfo.vb | 14 +++---- Encryption/packages.config | 1 + Interfaces/ZUGFeRDInterface/PDFEmbeds.vb | 2 +- Jobs/My Project/AssemblyInfo.vb | 4 +- Jobs/ZUGFeRD/FileFunctions.vb | 42 ++++++++++++++++--- Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb | 2 +- Logging/My Project/AssemblyInfo.vb | 10 ++--- Messaging/Limilab.vb | 2 +- Messaging/Messaging.vbproj | 7 ++-- Messaging/My Project/AssemblyInfo.vb | 16 ++++---- Messaging/packages.config | 1 + Windream/My Project/AssemblyInfo.vb | 12 +++--- Windream/Windream.vbproj | 7 ++-- Windream/packages.config | 1 + 26 files changed, 182 insertions(+), 99 deletions(-) create mode 100644 Config/App.config create mode 100644 Config/README.txt diff --git a/Base/Base.vbproj b/Base/Base.vbproj index a6b1e6c8..84cca253 100644 --- a/Base/Base.vbproj +++ b/Base/Base.vbproj @@ -45,6 +45,9 @@ On + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + ..\packages\NLog.5.0.5\lib\net46\NLog.dll @@ -139,12 +142,6 @@ - - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - - diff --git a/Base/My Project/AssemblyInfo.vb b/Base/My Project/AssemblyInfo.vb index deab368b..0c95e0e5 100644 --- a/Base/My Project/AssemblyInfo.vb +++ b/Base/My Project/AssemblyInfo.vb @@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - - - - - + + + + + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' indem Sie "*" wie unten gezeigt eingeben: ' - - + + diff --git a/Base/packages.config b/Base/packages.config index 37cb9210..e25334c4 100644 --- a/Base/packages.config +++ b/Base/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/Config/App.config b/Config/App.config new file mode 100644 index 00000000..7138a761 --- /dev/null +++ b/Config/App.config @@ -0,0 +1,22 @@ + + + + +
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Config/Config.vbproj b/Config/Config.vbproj index eb3d6e82..941e4f55 100644 --- a/Config/Config.vbproj +++ b/Config/Config.vbproj @@ -1,5 +1,6 @@  + Debug @@ -12,6 +13,8 @@ Windows v4.6.2 + + true @@ -44,19 +47,41 @@ On - - ..\Base\bin\Debug\DigitalData.Modules.Base.dll + + ..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll - - ..\Database\bin\Debug\DigitalData.Modules.Database.dll + + ..\packages\DigitalData.Modules.Database.2.3.5.4\lib\net462\DigitalData.Modules.Database.dll + + + ..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll + + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.Firebird.6.4.0\lib\net452\EntityFramework.Firebird.dll + + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll ..\packages\NLog.5.0.5\lib\net46\NLog.dll + + + ..\packages\System.Data.Odbc.6.0.1\lib\net461\System.Data.Odbc.dll + @@ -111,6 +136,7 @@ + MyApplicationCodeGenerator Application.Designer.vb @@ -123,17 +149,18 @@ - - {8a8f20fc-c46e-41ac-bee7-218366cfff99} - Encryption - - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - + powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }" + + + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". + + + + + \ No newline at end of file diff --git a/Config/My Project/AssemblyInfo.vb b/Config/My Project/AssemblyInfo.vb index f912d685..09d25984 100644 --- a/Config/My Project/AssemblyInfo.vb +++ b/Config/My Project/AssemblyInfo.vb @@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - + + - + diff --git a/Config/README.txt b/Config/README.txt new file mode 100644 index 00000000..58cbced4 --- /dev/null +++ b/Config/README.txt @@ -0,0 +1,5 @@ +BASE MODULE +=========== + +This module is intended for often used constants and datastructures. +Therefor it is important that this module does not have any dependencies on other modules!! \ No newline at end of file diff --git a/Config/packages.config b/Config/packages.config index 37cb9210..e38bd11b 100644 --- a/Config/packages.config +++ b/Config/packages.config @@ -1,4 +1,12 @@  + + + + + + + + \ No newline at end of file diff --git a/Database/Database.vbproj b/Database/Database.vbproj index c984fb30..337e1f2d 100644 --- a/Database/Database.vbproj +++ b/Database/Database.vbproj @@ -47,6 +47,12 @@ On + + ..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll + + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll @@ -145,16 +151,6 @@ - - - {8a8f20fc-c46e-41ac-bee7-218366cfff99} - Encryption - - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - - @@ -162,11 +158,9 @@ - powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }" - \ No newline at end of file diff --git a/Database/My Project/AssemblyInfo.vb b/Database/My Project/AssemblyInfo.vb index b31b002d..9705164d 100644 --- a/Database/My Project/AssemblyInfo.vb +++ b/Database/My Project/AssemblyInfo.vb @@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - + - - + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Database/packages.config b/Database/packages.config index e10c0611..afc9b87a 100644 --- a/Database/packages.config +++ b/Database/packages.config @@ -1,10 +1,10 @@  + + - - \ No newline at end of file diff --git a/Encryption/Encryption.vbproj b/Encryption/Encryption.vbproj index 16be5211..de7bccd1 100644 --- a/Encryption/Encryption.vbproj +++ b/Encryption/Encryption.vbproj @@ -45,6 +45,9 @@ On + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + ..\packages\NLog.5.0.5\lib\net46\NLog.dll @@ -114,11 +117,5 @@ - - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - - \ No newline at end of file diff --git a/Encryption/My Project/AssemblyInfo.vb b/Encryption/My Project/AssemblyInfo.vb index 05fe130a..487cdb7f 100644 --- a/Encryption/My Project/AssemblyInfo.vb +++ b/Encryption/My Project/AssemblyInfo.vb @@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - - - + + + + - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' indem Sie "*" wie unten gezeigt eingeben: ' - - + + diff --git a/Encryption/packages.config b/Encryption/packages.config index 37cb9210..b610ae85 100644 --- a/Encryption/packages.config +++ b/Encryption/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Interfaces/ZUGFeRDInterface/PDFEmbeds.vb b/Interfaces/ZUGFeRDInterface/PDFEmbeds.vb index 835b2f18..38872da5 100644 --- a/Interfaces/ZUGFeRDInterface/PDFEmbeds.vb +++ b/Interfaces/ZUGFeRDInterface/PDFEmbeds.vb @@ -183,7 +183,7 @@ Public Class PDFEmbeds Dim oFileData As Byte() = New Byte(oFileSize) {} Dim oStatus As GdPictureStatus = GDPicturePDF.ExtractEmbeddedFile(oIndex, oFileData) - + 'MsgBox($"FileSize of filename: {oFileName} is bytes: {oFileData.Length}/Filesize: {oFileSize}") If oStatus = GdPictureStatus.OK Then Logger.Debug("Embedded file [{0}] extracted sucessfully!", oFileName) diff --git a/Jobs/My Project/AssemblyInfo.vb b/Jobs/My Project/AssemblyInfo.vb index cb7c26f3..ddd0ef67 100644 --- a/Jobs/My Project/AssemblyInfo.vb +++ b/Jobs/My Project/AssemblyInfo.vb @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: - - + + diff --git a/Jobs/ZUGFeRD/FileFunctions.vb b/Jobs/ZUGFeRD/FileFunctions.vb index 98ac7bd9..5638575f 100644 --- a/Jobs/ZUGFeRD/FileFunctions.vb +++ b/Jobs/ZUGFeRD/FileFunctions.vb @@ -80,7 +80,6 @@ Namespace ZUGFeRD For Each oFile In pAttachmentFiles Try Dim oFilePath = _filesystem.GetVersionedFilename(Path.Combine(oAttachmentDirectory, oFile.Name)) - _filesystem.MoveTo(oFile.FullName, oFilePath, oAttachmentDirectory) _logger.Info("Attachment moved to {0}", oFilePath) Catch ex As Exception @@ -98,11 +97,22 @@ Namespace ZUGFeRD If Not File.Exists(oAttachmentDirectory) Then Directory.CreateDirectory(oAttachmentDirectory) End If + System.IO.File.WriteAllBytes(oFilePath, oResult.FileContents) + If CheckBytes(oFilePath, oResult.FileContents) = True Then + If FileOpenwithError(oFilePath) Then + _logger.Info("Embedded Attachment moved to {0}", oFilePath) + Else + _logger.Info("File is corrupt. Deleting the created file ...") + File.Delete(oFilePath) + End If + Else + _logger.Info("File is corrupt (CheckBytes). Deleting the created file ...") + File.Delete(oFilePath) + End If + 'Using oWriter As New FileStream(oFilePath, FileMode.Create) + ' oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length) - Using oWriter As New FileStream(oFilePath, FileMode.Create) - oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length) - _logger.Info("Embedded Attachment moved to {0}", oFilePath) - End Using + 'End Using Catch ex As Exception _logger.Warn("Could not save embedded attachment {0}", oResult.FileName) _logger.Error(ex) @@ -111,7 +121,15 @@ Namespace ZUGFeRD _logger.Info("Finished moving files") End Sub + Private Function CheckBytes(oFilePath As String, oFileContents As IEnumerable(Of Byte)) As Boolean + Dim savedBytes() As Byte = System.IO.File.ReadAllBytes(oFilePath) + If savedBytes.SequenceEqual(oFileContents) Then + Return True + Else + Return False + End If + End Function Public Function MoveAndRenameEmailToRejected(pArgs As WorkerArgs, pMessageId As String) As EmailData _logger.Info("Moving Mail with MessageId [{0}] to Rejected folder", pMessageId) _logger.Debug("Fetching Email Data") @@ -177,7 +195,19 @@ Namespace ZUGFeRD Return oEmailData End Function - + Private Function FileOpenwithError(pFilePath As String) As Boolean + Try + Using fs As FileStream = File.Open(pFilePath, FileMode.Open, FileAccess.Read, FileShare.None) + Return True ' Datei kann geöffnet werden + End Using + Catch ex As IOException + _logger.Info("file [{0}] could not be opened! Error IOException: [{1}]", pFilePath, ex.Message) + Return False ' Datei ist gesperrt oder existiert nicht + Catch ex As Exception + _logger.Info("file [{0}] could not be opened! Error: [{1}]", pFilePath, ex.Message) + Return False ' Andere Fehler + End Try + End Function Public Function GetEmailPathWithSubjectAsName(RejectedEmailDirectory As String, UncleanedSubject As String) As String Dim oCleanSubject = String.Join("", UncleanedSubject.Split(Path.GetInvalidPathChars())) Dim oAttachmentDirectory = RejectedEmailDirectory diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb index b1f8724b..7539c8b2 100644 --- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -131,7 +131,7 @@ Public Class ImportZUGFeRDFiles ' Group files by messageId Dim oGrouped As Dictionary(Of String, List(Of FileInfo)) = _zugferd.FileGroup.GroupFiles(oFiles) - _logger.Info("Found {0} file groups", oGrouped.Count) + _logger.Info("Found [{0}] file groups", oGrouped.Count) 'Process each file group together 'oGrouped equals one e-invoice diff --git a/Logging/My Project/AssemblyInfo.vb b/Logging/My Project/AssemblyInfo.vb index b1e46b29..6f048cc1 100644 --- a/Logging/My Project/AssemblyInfo.vb +++ b/Logging/My Project/AssemblyInfo.vb @@ -9,10 +9,10 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - + + - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Messaging/Limilab.vb b/Messaging/Limilab.vb index 19c3b5bb..48963170 100644 --- a/Messaging/Limilab.vb +++ b/Messaging/Limilab.vb @@ -43,6 +43,7 @@ Public Class Limilab Password = oPassword AuthType = oAuthType Initialized = True + End Sub Public Function CloseImap() As Boolean Try @@ -75,7 +76,6 @@ Public Class Limilab ''' True if connection and query were successful. False otherwise. Public Function IMAPTestLogin() As Boolean Logger.Debug("Starting IMAPTestLogin ...") - If Initialized = False Then Return False End If diff --git a/Messaging/Messaging.vbproj b/Messaging/Messaging.vbproj index 9a86015f..8bdcfa87 100644 --- a/Messaging/Messaging.vbproj +++ b/Messaging/Messaging.vbproj @@ -44,6 +44,9 @@ On + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + P:\Visual Studio Projekte\Bibliotheken\Limilabs\Mail.dll\Mail.dll False @@ -140,10 +143,6 @@ {6ea0c51f-c2b1-4462-8198-3de0b32b74f8} Base - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - diff --git a/Messaging/My Project/AssemblyInfo.vb b/Messaging/My Project/AssemblyInfo.vb index ebdfd703..8446c67f 100644 --- a/Messaging/My Project/AssemblyInfo.vb +++ b/Messaging/My Project/AssemblyInfo.vb @@ -8,12 +8,12 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - - - - - + + + + + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Messaging/packages.config b/Messaging/packages.config index 957b4e14..60a25ecb 100644 --- a/Messaging/packages.config +++ b/Messaging/packages.config @@ -1,5 +1,6 @@  + diff --git a/Windream/My Project/AssemblyInfo.vb b/Windream/My Project/AssemblyInfo.vb index 71f9c7e3..dfaec371 100644 --- a/Windream/My Project/AssemblyInfo.vb +++ b/Windream/My Project/AssemblyInfo.vb @@ -9,11 +9,11 @@ Imports System.Runtime.InteropServices ' Werte der Assemblyattribute überprüfen - - + + - - + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Windream/Windream.vbproj b/Windream/Windream.vbproj index 6f9ecb0e..aeac5eca 100644 --- a/Windream/Windream.vbproj +++ b/Windream/Windream.vbproj @@ -44,6 +44,9 @@ On + + ..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll + P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll False @@ -137,10 +140,6 @@ {6EA0C51F-C2B1-4462-8198-3DE0B32B74F8} Base - - {903b2d7d-3b80-4be9-8713-7447b704e1b0} - Logging - diff --git a/Windream/packages.config b/Windream/packages.config index 37cb9210..b610ae85 100644 --- a/Windream/packages.config +++ b/Windream/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file