WIP Rename Inbox files to eml files
This commit is contained in:
parent
2101f51816
commit
527b15c01c
@ -27,35 +27,57 @@ Public Class ClassFilehandle
|
|||||||
|
|
||||||
Dim oTempFilePath = pFilepath
|
Dim oTempFilePath = pFilepath
|
||||||
|
|
||||||
If oTempFilePath.ToUpper.EndsWith(".MSG") Or oTempFilePath.ToUpper.EndsWith(".EML") Then
|
Dim oInboxRegex As New Regex("\.INBOX\d+$")
|
||||||
CURRENT_MESSAGEID = ""
|
|
||||||
Dim oMail As IMail = EMAIL.Load_Email(oTempFilePath)
|
|
||||||
If oMail.Attachments.Count > 0 Then
|
|
||||||
Dim oTitle As String
|
|
||||||
Dim oMessage As String
|
|
||||||
|
|
||||||
If USER_LANGUAGE = "de-DE" Then
|
If oInboxRegex.IsMatch(oTempFilePath) Then
|
||||||
oTitle = "Nachfrage zur Indexierung:"
|
LOGGER.Info("Renaming INBOX file to EML")
|
||||||
oMessage = "Achtung: Die Email enthält Anhänge!" & vbNewLine & "Wollen Sie die Anhänge separat indexieren und herauslösen?"
|
|
||||||
Else
|
|
||||||
oTitle = "Question about Indexing:"
|
|
||||||
oMessage = "Attention: This Email contains Attachments!" & vbNewLine & "Do you want to extract the attachments and index them seperately?"
|
|
||||||
End If
|
|
||||||
Dim oResult As DialogResult
|
|
||||||
|
|
||||||
' Weird hack to force messagebox to be topmost
|
Try
|
||||||
' https://stackoverflow.com/questions/1220882/keep-messagebox-show-on-top-of-other-application-using-c-sharp
|
Dim oInfo As New FileInfo(oTempFilePath)
|
||||||
oResult = MessageBox.Show(oMessage, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
|
LOGGER.Info("Old Name: {0}", oInfo.Name)
|
||||||
|
Dim oNewName = $"{oInfo.Name}.eml"
|
||||||
|
LOGGER.Info("New Name: {0}", oNewName)
|
||||||
|
Dim oTempDirectory = IO.Path.GetTempPath()
|
||||||
|
Dim oNewPath = IO.Path.Combine(oTempDirectory, oNewName)
|
||||||
|
|
||||||
|
IO.File.Copy(oInfo.Name, oNewPath)
|
||||||
|
TEMP_FILES.Add(oNewPath)
|
||||||
|
|
||||||
If oResult = MsgBoxResult.Yes Then
|
oTempFilePath = oNewPath
|
||||||
Dim oIsFolderWatch = pHandletype.StartsWith("|FW")
|
Catch ex As Exception
|
||||||
Return Save_EmailAndAttachmentsToDisk(oTempFilePath, oIsFolderWatch)
|
LOGGER.Error(ex)
|
||||||
End If
|
End Try
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oTempFilePath.ToUpper.EndsWith(".LNK") Then
|
If oTempFilePath.ToUpper.EndsWith(".MSG") Or oTempFilePath.ToUpper.EndsWith(".EML") Then
|
||||||
|
CURRENT_MESSAGEID = ""
|
||||||
|
Dim oMail As IMail = EMAIL.Load_Email(oTempFilePath)
|
||||||
|
If oMail.Attachments.Count > 0 Then
|
||||||
|
Dim oTitle As String
|
||||||
|
Dim oMessage As String
|
||||||
|
|
||||||
|
If USER_LANGUAGE = "de-DE" Then
|
||||||
|
oTitle = "Nachfrage zur Indexierung:"
|
||||||
|
oMessage = "Achtung: Die Email enthält Anhänge!" & vbNewLine & "Wollen Sie die Anhänge separat indexieren und herauslösen?"
|
||||||
|
Else
|
||||||
|
oTitle = "Question about Indexing:"
|
||||||
|
oMessage = "Attention: This Email contains Attachments!" & vbNewLine & "Do you want to extract the attachments and index them seperately?"
|
||||||
|
End If
|
||||||
|
Dim oResult As DialogResult
|
||||||
|
|
||||||
|
' Weird hack to force messagebox to be topmost
|
||||||
|
' https://stackoverflow.com/questions/1220882/keep-messagebox-show-on-top-of-other-application-using-c-sharp
|
||||||
|
oResult = MessageBox.Show(oMessage, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
|
||||||
|
|
||||||
|
|
||||||
|
If oResult = MsgBoxResult.Yes Then
|
||||||
|
Dim oIsFolderWatch = pHandletype.StartsWith("|FW")
|
||||||
|
Return Save_EmailAndAttachmentsToDisk(oTempFilePath, oIsFolderWatch)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oTempFilePath.ToUpper.EndsWith(".LNK") Then
|
||||||
If USER_LANGUAGE = "de-DE" Then
|
If USER_LANGUAGE = "de-DE" Then
|
||||||
MsgBox("Verknüpfungen können nicht abgelegt werden!", MsgBoxStyle.Critical, "Global Indexer")
|
MsgBox("Verknüpfungen können nicht abgelegt werden!", MsgBoxStyle.Critical, "Global Indexer")
|
||||||
Else
|
Else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user