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