Clean filename for temp files, centralize windream basepath

This commit is contained in:
Jonathan Jenne
2021-09-21 16:36:34 +02:00
parent ab2a0134f7
commit 9c0c31e141
11 changed files with 211 additions and 218 deletions

View File

@@ -5,6 +5,7 @@ Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.DirectoryServices
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.GlobalIndexer
Imports DevExpress.XtraEditors.Controls
@@ -538,7 +539,7 @@ Public Class frmIndex
CURR_WORKFILE_EXTENSION = extension
oRAWZielordner = WINDREAM.GetNormalizedPath(DT.Rows(0).Item("ZIEL_PFAD"))
oRAWZielordner = Path.Combine("\\windream\objects", oRAWZielordner)
oRAWZielordner = Path.Combine(WINDREAM_BASEPATH, oRAWZielordner)
'####
' Regulären Ausdruck zum Auslesen der Indexe definieren
@@ -835,7 +836,7 @@ Public Class frmIndex
End If
Next
End If
If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".msg") Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".eml") Then
If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".MSG") Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".EML") Then
indexierung_erfolgreich = SetEmailIndicies(pIndexAttachment:=False)
If indexierung_erfolgreich = False Then
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
@@ -894,7 +895,7 @@ Public Class frmIndex
' If file is an attachment, rely on the previously extracted value
If pIndexAttachment = False Then
Dim oMsgFilePath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
Dim oMsgFilePath As String = Path.Combine(WINDREAM_BASEPATH, CURRENT_NEWFILENAME)
Dim oMail As IMail = EMAIL.Load_Email(oMsgFilePath)
Dim oMessageId As String = oMail.MessageID
@@ -965,7 +966,7 @@ Public Class frmIndex
' Dim _step As String = "1"
' Try
' Dim oTempPath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
' Dim oTempPath As String = Path.Combine(WINDREAM_BASEPATH, CURRENT_NEWFILENAME)
' Dim msg As Msg.Message = New Msg.Message(oTempPath)
' Dim msgDisplayTo = msg.DisplayTo
' Dim msgInternetAccountName = msg.InternetAccountName
@@ -1349,7 +1350,7 @@ Public Class frmIndex
End If
Dim oStreamSuccessful = WINDREAM.NewFileStream(CURRENT_WORKFILE, CURRENT_NEWFILENAME)
Dim oTempPath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
Dim oTempPath As String = Path.Combine(WINDREAM_BASEPATH, CURRENT_NEWFILENAME)
_Logger.Debug("Checks for file [{0}]", oTempPath)
_Logger.Debug("File streamed to Windream: {0}", oStreamSuccessful)
@@ -1835,7 +1836,7 @@ Public Class frmIndex
Dim AddNewItems As Boolean = oRow.Item("VKT_ADD_ITEM")
Dim PreventDuplicates As Boolean = oRow.Item("VKT_PREVENT_MULTIPLE_VALUES")
Dim oControlName As String = oRow.Item("NAME")
Dim oConnectionId = NotNull(oRow.Item("CONNECTION_ID"), 0)
Dim oConnectionId = Utils.NotNull(oRow.Item("CONNECTION_ID"), 0)
Dim oSQLSuggestion = oRow.Item("SUGGESTION")
Dim oSQLResult = oRow.Item("SQL_RESULT")
@@ -1961,9 +1962,9 @@ Public Class frmIndex
LOGGER.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, Control.Name)
For Each oRow As DataRow In oDatatable.Rows
Dim oControlName As String = NotNull(oRow.Item("NAME"), "")
Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), -1)
Dim oControlSql As String = NotNull(oRow.Item("SQL_RESULT"), "")
Dim oControlName As String = Utils.NotNull(oRow.Item("NAME"), "")
Dim oConnectionId As Integer = Utils.NotNull(oRow.Item("CONNECTION_ID"), -1)
Dim oControlSql As String = Utils.NotNull(oRow.Item("SQL_RESULT"), "")
If oConnectionId = -1 Or oControlSql = String.Empty Then
LOGGER.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName)
@@ -2716,74 +2717,83 @@ Public Class frmIndex
End Sub
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnOK.Click
ClearError()
ClearNotice()
Try
ClearError()
ClearNotice()
Me.Cursor = Cursors.WaitCursor
ClassHelper.Refresh_RegexTable()
For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows
If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then
REGEX_CLEAN_FILENAME = rowregex.Item("REGEX")
End If
Next
If checkMultiindex.Visible = True And checkMultiindex.Checked = True Then
'Die erste Datei indexieren
If WORK_FILE() = True Then
'Und nun die folgenden
Dim DTFiles2Work As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
If Not DTFiles2Work Is Nothing Then
Dim err = False
For Each filerow As DataRow In DTFiles2Work.Rows
CURRENT_WORKFILE_GUID = filerow.Item("GUID")
CURRENT_WORKFILE = filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_HASH = NotNull(filerow.Item("FILE_HASH"), "")
DropType = filerow.Item("HANDLE_TYPE")
Me.Cursor = Cursors.WaitCursor
ClassHelper.Refresh_RegexTable()
For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows
If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then
REGEX_CLEAN_FILENAME = rowregex.Item("REGEX")
End If
Next
If checkMultiindex.Visible = True And checkMultiindex.Checked = True Then
'Die erste Datei indexieren
If WORK_FILE() = True Then
'Und nun die folgenden
Dim DTFiles2Work As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
If Not DTFiles2Work Is Nothing Then
Dim err = False
For Each filerow As DataRow In DTFiles2Work.Rows
CURRENT_WORKFILE_GUID = filerow.Item("GUID")
CURRENT_WORKFILE = filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_HASH = Utils.NotNull(filerow.Item("FILE_HASH"), "")
DropType = filerow.Item("HANDLE_TYPE")
If WORK_FILE() = False Then
err = True
Exit For
If WORK_FILE() = False Then
err = True
Exit For
End If
Next
Me.Cursor = Cursors.Default
If err = False Then
If USER_LANGUAGE = LANG_DE Then
MsgBox("Alle Dateien wurden mit Multiindexing erfolgreich verarbeitet!", MsgBoxStyle.Information, "Erfolgsmeldung:")
Else
MsgBox("All files were successfully processed through Multiindexing", MsgBoxStyle.Information, "Success")
End If
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
CancelAttempts = 2
Me.Close()
End If
Next
End If
End If
Else
If WORK_FILE() = True Then
Me.Cursor = Cursors.Default
If err = False Then
If CONFIG.Config.ShowIndexResult = True Then
If USER_LANGUAGE = LANG_DE Then
MsgBox("Alle Dateien wurden mit Multiindexing erfolgreich verarbeitet!", MsgBoxStyle.Information, "Erfolgsmeldung:")
MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung")
Else
MsgBox("All files were successfully processed through Multiindexing", MsgBoxStyle.Information, "Success")
MsgBox("File sucessfully processed!" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success")
End If
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
CancelAttempts = 2
Me.Close()
End If
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
CancelAttempts = 2
Me.Close()
End If
End If
Else
If WORK_FILE() = True Then
Me.Cursor = Cursors.Default
If CONFIG.Config.ShowIndexResult = True Then
If USER_LANGUAGE = LANG_DE Then
MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung")
Else
MsgBox("File sucessfully processed!" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success")
End If
End If
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
' Clear all temp files after indexing
Clear_Tempfiles()
EMAIL.Clear_TempFiles()
CancelAttempts = 2
Me.Close()
End If
End If
Catch ex As Exception
MsgBox("Uncaught error while indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
' Clear all temp files after indexing
Clear_Tempfiles()
EMAIL.Clear_TempFiles()
Me.Cursor = Cursors.Default
' Clear all temp files after indexing
Clear_Tempfiles()
EMAIL.Clear_TempFiles()
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
Private Sub Clear_Tempfiles()