Integration of LimiLabs, Init
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
Imports System.IO
|
||||
Imports System.Guid
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports Independentsoft
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports Limilabs.Mail
|
||||
|
||||
Public Class ClassFilehandle
|
||||
Public Shared Function Decide_FileHandle(pFilename As String, pHandletype As String)
|
||||
@@ -30,9 +32,9 @@ Public Class ClassFilehandle
|
||||
|
||||
If oResult = MsgBoxResult.Yes Then
|
||||
If pHandletype.StartsWith("|FW") Then
|
||||
Return Email_Decay(pFilename, True)
|
||||
Return Save_EmailAndAttachmentsToDisk(pFilename, True)
|
||||
Else
|
||||
Return Email_Decay(pFilename)
|
||||
Return Save_EmailAndAttachmentsToDisk(pFilename)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -53,6 +55,59 @@ Public Class ClassFilehandle
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Shared Function Save_EmailAndAttachmentsToDisk(pEmailFilePath As String, Optional pFolderWatch As Boolean = False) As Boolean
|
||||
Try
|
||||
Dim oMessageOnlyMarker As String = "|MSGONLY|"
|
||||
Dim oExtractedAttachmentMarker As String = "|ATTMNTEXTRACTED|"
|
||||
If pFolderWatch = True Then
|
||||
oMessageOnlyMarker = "|FW_MSGONLY|"
|
||||
oExtractedAttachmentMarker = "|FW_ATTMNTEXTRACTED|"
|
||||
End If
|
||||
Dim oSuccess As Boolean = False
|
||||
|
||||
LOGGER.Info("Converting file to Eml if needed: [{0}]", pEmailFilePath)
|
||||
Dim oEmailFilePath = EMAIL.Convert_MsgToEml(pEmailFilePath)
|
||||
Dim oEmail As IMail = EMAIL.Load_Email(oEmailFilePath)
|
||||
|
||||
If oEmail.MessageID IsNot Nothing Then
|
||||
CURRENT_MESSAGEID = oEmail.MessageID
|
||||
Else
|
||||
LOGGER.Info("Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!")
|
||||
CURRENT_MESSAGEID = NewGuid.ToString()
|
||||
End If
|
||||
|
||||
Dim oEmailFilePathWithoutAttachments = EMAIL.Remove_AttachmentsFromEmail(oEmailFilePath, "_excl_attachments")
|
||||
TEMP_FILES.Add(oEmailFilePathWithoutAttachments)
|
||||
|
||||
If Insert_GI_File(oEmailFilePathWithoutAttachments, oMessageOnlyMarker) = True Then
|
||||
oSuccess = True
|
||||
|
||||
Dim oAttachments As List(Of String) = EMAIL.Save_AttachmentsToDisk(oEmailFilePath)
|
||||
|
||||
LOGGER.Debug("Saved [{0}] attachments to disk.", oAttachments.Count)
|
||||
|
||||
For Each oAttachment In oAttachments
|
||||
TEMP_FILES.Add(oAttachment)
|
||||
LOGGER.Debug("Saved attachment [{0}].", oAttachment)
|
||||
oSuccess = Insert_GI_File(oAttachment, oExtractedAttachmentMarker)
|
||||
|
||||
If oSuccess = False Then
|
||||
LOGGER.Warn("Saving attachment to disk failed: [{0}]", oAttachment)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Return oSuccess
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Saving email to disk failed (Email_Decay)")
|
||||
LOGGER.Error(ex)
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Shared Function Email_Decay(msgname As String, Optional FW As Boolean = False)
|
||||
Try
|
||||
Dim msgonly As String = "|MSGONLY|"
|
||||
@@ -64,10 +119,10 @@ Public Class ClassFilehandle
|
||||
Dim erfolgreich As Boolean = False
|
||||
Dim msg As New Msg.Message(msgname)
|
||||
|
||||
If Not msg.InternetMessageId Is Nothing Then
|
||||
If msg.InternetMessageId IsNot Nothing Then
|
||||
CURRENT_MESSAGEID = msg.InternetMessageId
|
||||
Else
|
||||
LOGGER.Info(">> Email_Decay: Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!")
|
||||
LOGGER.Info("Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!")
|
||||
Dim sGUID As String
|
||||
sGUID = System.Guid.NewGuid.ToString()
|
||||
CURRENT_MESSAGEID = sGUID
|
||||
@@ -109,6 +164,7 @@ Public Class ClassFilehandle
|
||||
|
||||
If tempfile <> String.Empty Then
|
||||
Dim oMessage = attachment.EmbeddedMessage
|
||||
oMessage.IsEmbedded = False
|
||||
oMessage.Save(tempfile)
|
||||
TEMP_FILES.Add(tempfile)
|
||||
LOGGER.Info(">> Attachment (" & i1 & "):" & tempfile)
|
||||
@@ -190,7 +246,7 @@ Public Class ClassFilehandle
|
||||
Try
|
||||
Dim version As Integer = 1
|
||||
|
||||
Dim Stammname As String = Path.GetDirectoryName(Dateiname) & "\" & Path.GetFileNameWithoutExtension(Dateiname)
|
||||
Dim Stammname As String = Path.GetDirectoryName(Dateiname) & "\" & Path.GetFileNameWithoutExtension(Dateiname).Trim()
|
||||
extension = Path.GetExtension(Dateiname)
|
||||
|
||||
Dim _neuername As String = Stammname
|
||||
|
||||
Reference in New Issue
Block a user