Merge branch 'master' of http://git.dd:3000/AppStd/Modules
This commit is contained in:
commit
ed7aea5b72
@ -404,6 +404,34 @@ Public Class File
|
|||||||
Return oIsDirectory
|
Return oIsDirectory
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Checks the size of the supplied file.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="pFilePath"></param>
|
||||||
|
''' <param name="pMaxFileSizeInMegaBytes"></param>
|
||||||
|
''' <returns></returns>
|
||||||
|
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
|
Public Function GetDateDirectory(pBaseDirectory As String, pDate As Date) As String
|
||||||
Dim oDateDirectory = GetDateString(pDate)
|
Dim oDateDirectory = GetDateString(pDate)
|
||||||
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
|
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("Modules.Filesystem")>
|
<Assembly: AssemblyProduct("Modules.Filesystem")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||||
<Assembly: AssemblyTrademark("1.4.1.0")>
|
<Assembly: AssemblyTrademark("1.5.0.0")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@ -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("1.4.1.0")>
|
<Assembly: AssemblyVersion("1.5.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.4.1.0")>
|
<Assembly: AssemblyFileVersion("1.5.0.0")>
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||||
<Assembly: AssemblyTrademark("1.12.1.0")>
|
<Assembly: AssemblyTrademark("1.13.0.0")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.12.1.0")>
|
<Assembly: AssemblyVersion("1.13.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.12.1.0")>
|
<Assembly: AssemblyFileVersion("1.13.0.0")>
|
||||||
|
|||||||
@ -222,7 +222,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
oEmailAttachmentFiles.Add(oFile)
|
oEmailAttachmentFiles.Add(oFile)
|
||||||
|
|
||||||
' Checking filesize for attachment files
|
' 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)
|
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
||||||
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
||||||
End If
|
End If
|
||||||
@ -233,7 +233,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
_logger.Info("Start processing file {0}", oFile.Name)
|
_logger.Info("Start processing file {0}", oFile.Name)
|
||||||
|
|
||||||
' Checking filesize for pdf files
|
' 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)
|
_logger.Warn("Filesize for File [{0}] exceeded limit of {1} MB", oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
||||||
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
Throw New FileSizeLimitReachedException(oFile.Name, oArgs.MaxAttachmentSizeInMegaBytes)
|
||||||
End If
|
End If
|
||||||
@ -844,30 +844,4 @@ Public Class ImportZUGFeRDFiles
|
|||||||
|
|
||||||
Return oMD5CheckSum
|
Return oMD5CheckSum
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
''' <summary>
|
|
||||||
''' Checks the size of the supplied file.
|
|
||||||
''' </summary>
|
|
||||||
''' <param name="pFileInfo"></param>
|
|
||||||
''' <param name="pMaxFileSizeInMegaBytes"></param>
|
|
||||||
''' <returns></returns>
|
|
||||||
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
|
End Class
|
||||||
|
|||||||
@ -19,6 +19,16 @@ Public Module DataTableEx
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
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
|
||||||
|
|
||||||
|
<Extension()>
|
||||||
|
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
|
||||||
|
|
||||||
<Extension()>
|
<Extension()>
|
||||||
Public Function First(pTable As DataTable) As DataRow
|
Public Function First(pTable As DataTable) As DataRow
|
||||||
Try
|
Try
|
||||||
|
|||||||
@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("")>
|
<Assembly: AssemblyCompany("")>
|
||||||
<Assembly: AssemblyProduct("Language")>
|
<Assembly: AssemblyProduct("Language")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||||
<Assembly: AssemblyTrademark("1.7.0.0")>
|
<Assembly: AssemblyTrademark("1.7.1.0")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@ -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("1.7.0.0")>
|
<Assembly: AssemblyVersion("1.7.1.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.7.0.0")>
|
<Assembly: AssemblyFileVersion("1.7.1.0")>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user