diff --git a/Filesystem/File.vb b/Filesystem/File.vb
index 3a20856d..c8823aca 100644
--- a/Filesystem/File.vb
+++ b/Filesystem/File.vb
@@ -404,6 +404,34 @@ Public Class File
Return oIsDirectory
End Function
+ '''
+ ''' Checks the size of the supplied file.
+ '''
+ '''
+ '''
+ '''
+ Public Function TestFileSizeIsLessThanMaxFileSize(pFilePath As String, pMaxFileSizeInMegabytes As Integer) As Boolean
+ Dim oFileInfo As New FileInfo(pFilePath)
+
+ _Logger.Info("Checking Filesize of {0}", oFileInfo.Name)
+ _Logger.Debug("Filesize threshold is {0} MB.", pMaxFileSizeInMegabytes)
+
+ If pMaxFileSizeInMegabytes <= 0 Then
+ _Logger.Debug("Filesize is not configured. Skipping check.")
+ Return True
+ End If
+
+ Dim oMaxSize = pMaxFileSizeInMegabytes * 1024 * 1024
+
+ If oMaxSize > 0 And oFileInfo.Length > oMaxSize Then
+ _Logger.Debug("Filesize is bigger than threshold.")
+ Return False
+ Else
+ _Logger.Debug("Filesize is smaller than threshold. All fine.")
+ Return True
+ End If
+ End Function
+
Public Function GetDateDirectory(pBaseDirectory As String, pDate As Date) As String
Dim oDateDirectory = GetDateString(pDate)
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
diff --git a/Filesystem/My Project/AssemblyInfo.vb b/Filesystem/My Project/AssemblyInfo.vb
index dffefb47..4136ea50 100644
--- a/Filesystem/My Project/AssemblyInfo.vb
+++ b/Filesystem/My Project/AssemblyInfo.vb
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
-
+
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/Jobs/My Project/AssemblyInfo.vb b/Jobs/My Project/AssemblyInfo.vb
index 393c6a9a..1f675ad7 100644
--- a/Jobs/My Project/AssemblyInfo.vb
+++ b/Jobs/My Project/AssemblyInfo.vb
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
-
+
@@ -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/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
index 00fd4714..e14b4ec9 100644
--- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
+++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb
@@ -222,7 +222,7 @@ Public Class ImportZUGFeRDFiles
oEmailAttachmentFiles.Add(oFile)
' Checking filesize for attachment files
- If Check_FileSize(oFile, oArgs.MaxAttachmentSizeInMegaBytes) = False Then
+ If _filesystem.TestFileSizeIsLessThanMaxFileSize(oFile.FullName, oArgs.MaxAttachmentSizeInMegaBytes) = False Then
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
End If
@@ -233,7 +233,7 @@ Public Class ImportZUGFeRDFiles
_logger.Info("Start processing file {0}", oFile.Name)
' Checking filesize for pdf files
- If Check_FileSize(oFile, oArgs.MaxAttachmentSizeInMegaBytes) = False Then
+ If _filesystem.TestFileSizeIsLessThanMaxFileSize(oFile.FullName, oArgs.MaxAttachmentSizeInMegaBytes) = False Then
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
End If
@@ -844,30 +844,4 @@ Public Class ImportZUGFeRDFiles
Return oMD5CheckSum
End Function
-
- '''
- ''' Checks the size of the supplied file.
- '''
- '''
- '''
- '''
- Private Function Check_FileSize(pFileInfo As FileInfo, pMaxFileSizeInMegaBytes As Integer) As Boolean
- _logger.Info("Checking Filesize of {0}", pFileInfo.Name)
- _logger.Debug("Filesize threshold is {0} MB.", pMaxFileSizeInMegaBytes)
-
- If pMaxFileSizeInMegaBytes <= 0 Then
- _logger.Debug("Filesize is not configured. Skipping check.")
- Return True
- End If
-
- Dim oMaxSize = pMaxFileSizeInMegaBytes * 1024 * 1024
-
- If oMaxSize > 0 And pFileInfo.Length > oMaxSize Then
- _logger.Debug("Filesize is bigger than threshold. Rejecting.")
- Return False
- Else
- _logger.Debug("Filesize is smaller than threshold. All fine.")
- Return True
- End If
- End Function
End Class
diff --git a/Language/DataTableEx.vb b/Language/DataTableEx.vb
index 936d29c0..70f3ac78 100644
--- a/Language/DataTableEx.vb
+++ b/Language/DataTableEx.vb
@@ -19,6 +19,16 @@ Public Module DataTableEx
End Try
End Function
+
+ Public Function FieldOrDefault(Of T)(pRow As DataRow, pFieldName As String, Optional pDefaultValue As T = Nothing) As T
+ Return ItemEx(pRow, pFieldName, pDefaultValue)
+ End Function
+
+
+ Public Function FieldOrDefault(Of T)(pRow As DataRow, pFieldIndex As Integer, Optional pDefaultValue As T = Nothing) As T
+ Return ItemEx(pRow, pFieldIndex, pDefaultValue)
+ End Function
+
Public Function First(pTable As DataTable) As DataRow
Try
diff --git a/Language/My Project/AssemblyInfo.vb b/Language/My Project/AssemblyInfo.vb
index 4788f939..374ae372 100644
--- a/Language/My Project/AssemblyInfo.vb
+++ b/Language/My Project/AssemblyInfo.vb
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
-
-
+
+
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+