maybe fix copy2hdd error
This commit is contained in:
parent
ea8f206873
commit
8f5ec70a2a
@ -50,6 +50,9 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Filesystem">
|
||||||
|
<HintPath>..\..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Logging">
|
<Reference Include="DigitalData.Modules.Logging">
|
||||||
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@ -15,6 +15,7 @@ Public Class clsWorkEmail
|
|||||||
Private _USE_WM As Boolean
|
Private _USE_WM As Boolean
|
||||||
Private _windream As clsWindream_allgemein
|
Private _windream As clsWindream_allgemein
|
||||||
Private _windream_index As clsWindream_Index
|
Private _windream_index As clsWindream_Index
|
||||||
|
Private _filesystem As DigitalData.Modules.Filesystem.File
|
||||||
Private _firebird As Firebird
|
Private _firebird As Firebird
|
||||||
Private _worked_email As Boolean = False
|
Private _worked_email As Boolean = False
|
||||||
Sub New(LogConf As LogConfig, ConStr As String, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean)
|
Sub New(LogConf As LogConfig, ConStr As String, FB_DATASOURCE As String, FB_DATABASE As String, FB_USER As String, FB_PW As String, USE_WM As Boolean)
|
||||||
@ -22,6 +23,7 @@ Public Class clsWorkEmail
|
|||||||
Logger = LogConf.GetLogger
|
Logger = LogConf.GetLogger
|
||||||
MyLogger = LogConf
|
MyLogger = LogConf
|
||||||
_email = New clsEmail(LogConf)
|
_email = New clsEmail(LogConf)
|
||||||
|
_filesystem = New Modules.Filesystem.File(LogConf)
|
||||||
Logger.Debug("clsWorkmail _email initialized")
|
Logger.Debug("clsWorkmail _email initialized")
|
||||||
_DB_MSSQL = New clsDatabase(LogConf, ConStr)
|
_DB_MSSQL = New clsDatabase(LogConf, ConStr)
|
||||||
Logger.Debug("clsWorkmail _email initialized")
|
Logger.Debug("clsWorkmail _email initialized")
|
||||||
@ -280,6 +282,7 @@ Public Class clsWorkEmail
|
|||||||
If copy_2_hdd = True Then
|
If copy_2_hdd = True Then
|
||||||
Logger.Debug("COPY_2_HDD is ACTIVE!")
|
Logger.Debug("COPY_2_HDD is ACTIVE!")
|
||||||
PATH_ERROR = pathemail_errors
|
PATH_ERROR = pathemail_errors
|
||||||
|
|
||||||
If Directory.Exists(pathOriginal) Then
|
If Directory.Exists(pathOriginal) Then
|
||||||
Dim oTempFilename = pathOriginal
|
Dim oTempFilename = pathOriginal
|
||||||
If messageid = True Then
|
If messageid = True Then
|
||||||
@ -288,25 +291,31 @@ Public Class clsWorkEmail
|
|||||||
oTempFilename &= "\" & CURRENT_MAIL_MESSAGE.GetFileName
|
oTempFilename &= "\" & CURRENT_MAIL_MESSAGE.GetFileName
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim cleanPath As String = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
|
Logger.Debug("Temp FileName: [{0}]", oTempFilename)
|
||||||
If System.IO.File.Exists(cleanPath) = False Then
|
|
||||||
|
Dim oCleanPath As String = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
|
||||||
|
Dim oVersionedPath As String = _filesystem.GetVersionedFilename(oCleanPath)
|
||||||
|
|
||||||
|
Logger.Debug("Cleaned FileName: [{0}]", oVersionedPath)
|
||||||
|
|
||||||
|
If System.IO.File.Exists(oVersionedPath) = False Then
|
||||||
Try
|
Try
|
||||||
File.Delete(cleanPath)
|
File.Delete(oVersionedPath)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
CURRENT_MAIL_MESSAGE.Save(cleanPath, True)
|
CURRENT_MAIL_MESSAGE.Save(oVersionedPath, True)
|
||||||
Dim oFileInfo As New FileInfo(cleanPath)
|
Dim oFileInfo As New FileInfo(oVersionedPath)
|
||||||
Dim oFileLenth As Long = oFileInfo.Length
|
Dim oFileLenth As Long = oFileInfo.Length
|
||||||
If oFileLenth > 0 Then
|
If oFileLenth > 0 Then
|
||||||
Logger.Info($"[COPY2HDD] Email saved to ({cleanPath})")
|
Logger.Info($"[COPY2HDD] Email saved to ({oVersionedPath})")
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
Logger.Warn($"##!! oFileLenth is 0 !!##")
|
Logger.Warn($"##!! oFileLenth is 0 !!##")
|
||||||
Try
|
Try
|
||||||
File.Delete(cleanPath)
|
File.Delete(oVersionedPath)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
@ -315,6 +324,7 @@ Public Class clsWorkEmail
|
|||||||
|
|
||||||
Else
|
Else
|
||||||
Logger.Warn("COPY2HDD - EMail (" & CURRENT_MAIL_MESSAGE.Subject & ") already existing!", False, "RUN_THREAD.COPY_2_HDD")
|
Logger.Warn("COPY2HDD - EMail (" & CURRENT_MAIL_MESSAGE.Subject & ") already existing!", False, "RUN_THREAD.COPY_2_HDD")
|
||||||
|
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
@ -178,6 +178,8 @@ Public Class clsWorker
|
|||||||
Try
|
Try
|
||||||
'Delete all Tempfiles
|
'Delete all Tempfiles
|
||||||
For Each _file In TEMP_FILES
|
For Each _file In TEMP_FILES
|
||||||
|
Logger.Debug("Trying to delete temp file: [{0}]", _file)
|
||||||
|
|
||||||
If System.IO.File.Exists(_file) Then
|
If System.IO.File.Exists(_file) Then
|
||||||
Try
|
Try
|
||||||
System.IO.File.Delete(_file)
|
System.IO.File.Delete(_file)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user