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

@ -1,7 +1,7 @@
Imports System.Data.SqlClient
Imports Oracle.ManagedDataAccess.Client
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Language
Public Class ClassControls
Private Property Form As frmIndex
@ -406,9 +406,9 @@ Public Class ClassControls
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)

View File

@ -4,34 +4,35 @@ Imports Microsoft.Office.Interop
Public Class ClassFileDrop
Public Shared files_dropped As String()
'Public Shared Property FilesDropped As String()
Public Shared Property FilesDropped As New List(Of String)
' Tobit David Drag Drop: https://www.david-forum.de/thread/12671-drag-and-drop-von-faxen-und-mails-in-net-anwendung/
'Private Declare Function DVEmlFromMailItem Lib "DvApi32" (ByVal oMailItem As MailItem, ByVal strFileName As String) As Long
Public Shared Function Drop_File(e As DragEventArgs)
Try
LOGGER.Debug("Available Drop Formats:")
For Each oFormat As String In e.Data.GetFormats()
LOGGER.Debug(oFormat)
Next
LOGGER.Info("Drop_File")
files_dropped = Nothing
FilesDropped.Clear()
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String
Dim i As Integer
Dim oFilesFromEvent() As String
Dim oIndex As Integer
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats.FileDrop)
oFilesFromEvent = e.Data.GetData(DataFormats.FileDrop)
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
LOGGER.Info("Simple FileDrop - File: " & MyFiles(i))
ReDim Preserve files_dropped(i)
files_dropped(i) = "|DROPFROMFSYSTEM|" & MyFiles(i)
For oIndex = 0 To oFilesFromEvent.Length - 1
LOGGER.Info("Simple FileDrop - File: " & oFilesFromEvent(oIndex))
FilesDropped.Add("|DROPFROMFSYSTEM|" & oFilesFromEvent(oIndex))
'ReDim Preserve FilesDropped(oIndex)
'FilesDropped(oIndex) = "|DROPFROMFSYSTEM|" & oFilesFromEvent(oIndex)
' ListBox1.Items.Add(MyFiles(i))
Next
Return True
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
'// the first step here is to get the stbFileName
'// of the attachment and
@ -40,9 +41,9 @@ Public Class ClassFileDrop
'//
'// set up to obtain the aryFileGroupDescriptor
'// and extract the file name
Dim stmInput As IO.Stream = CType(e.Data.GetData("FileGroupDescriptor"), IO.Stream)
Dim oStream As IO.Stream = CType(e.Data.GetData("FileGroupDescriptor"), IO.Stream)
Dim aryFileGroupDescriptor(512) As Byte ' = new byte[512]
stmInput.Read(aryFileGroupDescriptor, 0, 512)
oStream.Read(aryFileGroupDescriptor, 0, 512)
'// used to build the stbFileName from the aryFileGroupDescriptor block
Dim stbFileName As System.Text.StringBuilder = New System.Text.StringBuilder("")
'// this trick gets the stbFileName of the passed attached file
@ -51,13 +52,11 @@ Public Class ClassFileDrop
stbFileName.Append(Convert.ToChar(aryFileGroupDescriptor(intCnt), System.Globalization.CultureInfo.CreateSpecificCulture("de-DE")))
intCnt += 1
Loop
stmInput.Close()
oStream.Close()
'Sonderzeichen entfernen
Dim Tempfilename = DigitalData.Modules.Language.Utils.RemoveInvalidCharacters(stbFileName.ToString)
Dim anhaenge = e.Data.GetDataPresent("FileContents")
'Dim path As String = "C:\VBProjekte\Dateien"
'// put the zip file into the temp directory
Dim strOutFile As String = Path.GetTempPath() & Tempfilename
Dim oTempFileName = DigitalData.Modules.Language.Utils.RemoveInvalidCharacters(stbFileName.ToString)
Dim oAttachments = e.Data.GetDataPresent("FileContents")
Dim strOutFile As String = Path.Combine(Path.GetTempPath(), oTempFileName)
'// create the full-path name
'//
'// Second step: we have the file name.
@ -65,13 +64,13 @@ Public Class ClassFileDrop
'// data for the attached file and copy it to disk so we work on it.
'//
'// get the actual raw file into memory
Dim msInput As IO.MemoryStream = CType(e.Data.GetData("FileContents", True), IO.MemoryStream) 'This returns nothing for an Email
If msInput Is Nothing = False Then
Dim oMemoryStreamInput As IO.MemoryStream = CType(e.Data.GetData("FileContents", True), IO.MemoryStream) 'This returns nothing for an Email
If oMemoryStreamInput Is Nothing = False Then
'// allocate enough bytes to hold the raw date
Dim aryFileBytes(CType(msInput.Length, Int32)) As Byte
Dim aryFileBytes(CType(oMemoryStreamInput.Length, Int32)) As Byte
'// set starting position at first byte and read in the raw data
msInput.Position = 0
msInput.Read(aryFileBytes, 0, CType(msInput.Length, Int32))
oMemoryStreamInput.Position = 0
oMemoryStreamInput.Read(aryFileBytes, 0, CType(oMemoryStreamInput.Length, Int32))
'// create a file and save the raw zip file to it
Dim fsOutput As IO.FileStream = New IO.FileStream(strOutFile, IO.FileMode.Create) ';
fsOutput.Write(aryFileBytes, 0, aryFileBytes.Length)
@ -83,9 +82,12 @@ Public Class ClassFileDrop
Dim finTemp As IO.FileInfo = New IO.FileInfo(strOutFile)
'// always good to make sure we actually created the file
If (finTemp.Exists = True) Then
ReDim Preserve files_dropped(0)
files_dropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile
LOGGER.Info("Drop an Attachment - File: " & strOutFile)
FilesDropped.Add("|OUTLOOK_ATTACHMENT|" & strOutFile)
'ReDim Preserve FilesDropped(0)
'FilesDropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile
Return True
Else
LOGGER.Info("Attachment File from Outlook could not be created")
@ -111,12 +113,6 @@ Public Class ClassFileDrop
If subj = "" Then
subj = "NO_SUBJECT"
End If
If subj.Contains("\") Then
subj = subj.Replace("\", "-")
End If
If subj.Contains("/") Then
subj = subj.Replace("/", "-")
End If
'Sonderzeichen entfernen
subj = DigitalData.Modules.Language.Utils.RemoveInvalidCharacters(subj)
@ -138,8 +134,10 @@ Public Class ClassFileDrop
"Weitere Informationen finden Sie im Log.", MsgBoxStyle.Critical, "Global Indexer")
End Try
ReDim Preserve files_dropped(i)
files_dropped(i) = "|OUTLOOK_MESSAGE|" & oFilename
FilesDropped.Add("|OUTLOOK_MESSAGE|" & oFilename)
'ReDim Preserve FilesDropped(i)
'FilesDropped(i) = "|OUTLOOK_MESSAGE|" & oFilename
Next

View File

@ -6,11 +6,25 @@ Imports DigitalData.Modules.Language
Imports Limilabs.Mail
Public Class ClassFilehandle
Public Shared Function Decide_FileHandle(pFilename As String, pHandletype As String)
Public Shared Function Decide_FileHandle(pFilepath As String, pHandletype As String)
Try
If pFilename.ToUpper.EndsWith(".MSG") Or pFilename.ToUpper.EndsWith(".EML") Then
'TODO: Before doing anything, clean the filename
Dim oFilename = IO.Path.GetFileName(pFilepath)
Dim oCleanFileName = Utils.RemoveInvalidCharacters(oFilename)
Dim oTempDirectory = IO.Path.GetTempPath()
Dim oTempFilePath = IO.Path.Combine(oTempDirectory, oCleanFileName)
Try
TEMP_FILES.Add(oTempFilePath)
IO.File.Copy(pFilepath, oTempFilePath, True)
Catch ex As Exception
LOGGER.Error(ex)
Throw ex
End Try
If oTempFilePath.ToUpper.EndsWith(".MSG") Or oTempFilePath.ToUpper.EndsWith(".EML") Then
CURRENT_MESSAGEID = ""
Dim oMail As IMail = EMAIL.Load_Email(pFilename)
Dim oMail As IMail = EMAIL.Load_Email(oTempFilePath)
If oMail.Attachments.Count > 0 Then
Dim oTitle As String
Dim oMessage As String
@ -28,14 +42,15 @@ Public Class ClassFilehandle
' 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(pFilename, oIsFolderWatch)
Return Save_EmailAndAttachmentsToDisk(oTempFilePath, oIsFolderWatch)
End If
End If
End If
If pFilename.ToUpper.EndsWith(".LNK") Then
If oTempFilePath.ToUpper.EndsWith(".LNK") Then
If USER_LANGUAGE = "de-DE" Then
MsgBox("Verknüpfungen können nicht abgelegt werden!", MsgBoxStyle.Critical, "Global Indexer")
Else
@ -44,7 +59,7 @@ Public Class ClassFilehandle
Return False
End If
Return Insert_GI_File(pFilename, pHandletype)
Return Insert_GI_File(oTempFilePath, pHandletype)
Catch ex As Exception
MsgBox("Unexpected Error in Decide_FileHandle: " & ex.Message, MsgBoxStyle.Critical)
Return False

View File

@ -79,7 +79,7 @@ Public Class ClassInit
Else
If IDB_ACTIVE = False Then
Try
WINDREAM = New Windream(LOGCONFIG, False, WMDrive, "\\windream\objects", True, "", "", "", "")
WINDREAM = New Windream(LOGCONFIG, False, WMDrive, WINDREAM_BASEPATH, True, "", "", "", "")
If Not IsNothing(WINDREAM) Then
If WINDREAM.SessionLoggedin = True Then
LOGGER.Debug("windream initialisiert")

View File

@ -1,6 +1,7 @@
Imports System.Text.RegularExpressions
Imports DevExpress.XtraEditors
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Language
Imports DigitalData.GUIs.GlobalIndexer
Imports WINDREAMLib
@ -239,7 +240,7 @@ Public Class ClassPatterns
LOGGER.Warn("Lookup Control with [{0}] is not supported!", oFoundType)
End Select
Else
oValue = NotNull(oLookupControl.Properties.SelectedValues.Item(0), "")
oValue = Utils.NotNull(oLookupControl.Properties.SelectedValues.Item(0), "")
End If
Catch ex As Exception
LOGGER.Error(ex)

View File

@ -385,7 +385,6 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="ModuleCURRENT.vb" />
<Compile Include="ModuleHelpers.vb" />
<Compile Include="ModuleRuntime.vb" />
<Compile Include="ModuleUserSavings.vb" />
<Compile Include="ModuleWindowHandles.vb" />

View File

@ -4,90 +4,83 @@ Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Messaging
Module ModuleCURRENT
Public ERROR_STATE As String
Public START_INCOMPLETE As Boolean = False
Public CURRENT_FILENAME As String
Public CURRENT_NEWFILENAME As String
Public CURRENT_WORKFILE_GUID As Integer
Public CURRENT_WORKFILE_HASH As String
Public CURRENT_WORKFILE As String
Public CURR_WORKFILE_EXTENSION As String
Public Property TEMP_FILES As List(Of String) = New List(Of String)
Public CONFIG As ConfigManager(Of ClassConfig)
Public LOGCONFIG As LogConfig
Public LOGGER As Logger
Public FILESYSTEM As File
Public EMAIL As Email2
Public Property ERROR_STATE As String
Public Property START_INCOMPLETE As Boolean = False
Public Property CURRENT_FILENAME As String
Public Property CURRENT_NEWFILENAME As String
Public Property CURRENT_WORKFILE_GUID As Integer
Public Property CURRENT_WORKFILE_HASH As String
Public Property CURRENT_WORKFILE As String
Public Property CURR_WORKFILE_EXTENSION As String
Public CURRENT_DOKART_ID As Integer
Public CURRENT_DOKART_DUPLICATE_HANDLING As String = "Default"
Public CURRENT_LASTDOKART As String = ""
Public CURRENT_INDEXMAN As Integer
Public CURRENT_INDEXAUTO As Integer
Public CURRENT_SQL_CONFIG As String
Public Property CONFIG As ConfigManager(Of ClassConfig)
Public Property LOGCONFIG As LogConfig
Public Property LOGGER As Logger
Public Property FILESYSTEM As File
Public Property EMAIL As Email2
Public VERSION_DELIMITER As String
Public FILE_DELIMITER As String
Public CURRENT_MESSAGEID As String
Public CURRENT_MESSAGEDATE As String
Public CURRENT_MESSAGESUBJECT As String
Public CURRENT_ISATTACHMENT As Boolean = False
Public Property CURRENT_DOKART_ID As Integer
Public Property CURRENT_DOKART_DUPLICATE_HANDLING As String = "Default"
Public Property CURRENT_LASTDOKART As String = ""
Public Property CURRENT_INDEXMAN As Integer
Public Property CURRENT_INDEXAUTO As Integer
Public USER_ID
Public USER_IN_MODULE As Boolean = False
Public USER_IS_ADMIN As Boolean = False
Public Property VERSION_DELIMITER As String
Public Property FILE_DELIMITER As String
Public Property CURRENT_MESSAGEID As String
Public Property CURRENT_MESSAGEDATE As String
Public Property CURRENT_MESSAGESUBJECT As String
Public Property CURRENT_ISATTACHMENT As Boolean = False
Public USER_SHORTNAME As String = ""
Public USER_PRENAME As String = ""
Public USER_SURNAME As String = ""
Public USER_EMAIL As String = ""
Public USER_LANGUAGE As String = "DE"
Public USER_USERNAME As String = ""
Public USERCOUNT_LOGGED_IN As Integer = 0
Public Property USER_ID
Public Property USER_IN_MODULE As Boolean = False
Public Property USER_IS_ADMIN As Boolean = False
Public CURRENT_FOLDERWATCH As String = ""
Public CURRENT_SCAN_FOLDERWATCH As String = ""
Public Property USER_SHORTNAME As String = ""
Public Property USER_PRENAME As String = ""
Public Property USER_SURNAME As String = ""
Public Property USER_EMAIL As String = ""
Public Property USER_LANGUAGE As String = "DE"
Public Property USER_USERNAME As String = ""
Public Property USERCOUNT_LOGGED_IN As Integer = 0
Public FWFunction_STARTED As Boolean = False
Public Property CURRENT_FOLDERWATCH As String = ""
Public Property CURRENT_SCAN_FOLDERWATCH As String = ""
Public CURR_DOKART_WD_DIRECT As Boolean = False
Public CURR_DOKART_OBJECTTYPE As String
Public CURRENT_WD_TEMPSEARCH As String = ""
Public Property FWFunction_STARTED As Boolean = False
Public LICENSE_EXPIRED As Boolean = False
Public LICENSE_COUNT As Integer = 0
Public LICENSE_DOCTYPE_COUNT As Integer = 0
Public DOCTYPE_COUNT_ACTUAL As Integer = 0
Public LicenseHotKey As Integer = 0
Public Property CURR_DOKART_WD_DIRECT As Boolean = False
Public Property CURR_DOKART_OBJECTTYPE As String
Public CURRENT_HTML_DOC As String
Public Property LICENSE_EXPIRED As Boolean = False
Public Property LICENSE_COUNT As Integer = 0
Public Property LICENSE_DOCTYPE_COUNT As Integer = 0
Public Property DOCTYPE_COUNT_ACTUAL As Integer = 0
Public Property LicenseHotKey As Integer = 0
Public INDEXING_ACTIVE As Boolean = False
Public MULTIINDEXING_ACTIVE As Boolean = False
Public ABORT_INDEXING As Boolean = False
Public Property INDEXING_ACTIVE As Boolean = False
Public Property MULTIINDEXING_ACTIVE As Boolean = False
Public Property ABORT_INDEXING As Boolean = False
Public DTACTUAL_FILES As DataTable
Public DTEXCLUDE_FILES As DataTable
Public DTTBGI_REGEX_DOCTYPE As DataTable
Public Property DTACTUAL_FILES As DataTable
Public Property DTEXCLUDE_FILES As DataTable
Public Property DTTBGI_REGEX_DOCTYPE As DataTable
Public CURRENT_SQLRESULT As String
Public DTSQL_RESULT As DataTable
Public TEMP_FILES As List(Of String) = New List(Of String)
Public Property CURRENT_SQLRESULT As String
Public Property DTSQL_RESULT As DataTable
Public CURRENT_FOCUSES_WINDOWNAME As String
Public Property LANGUAGE_CHANGED As Boolean = False
Public Property CURR_MISSING_PATTERN_NAME As String
Public Property CURR_MISSING_SEARCH_STRING As String
Public Property CURR_MISSING_MANUAL_VALUE As String
Public Property CURR_DELETE_ORIGIN As Boolean = False
Public Property CURRENT_DT_REGEX As DataTable
Public Property REGEX_CLEAN_FILENAME As String = "[?*^""<>|]"
Public Property CURRENT_DROPTYPE
Public LANGUAGE_CHANGED As Boolean = False
Public CURR_MISSING_PATTERN_NAME As String
Public CURR_MISSING_SEARCH_STRING As String
Public CURR_MISSING_MANUAL_VALUE As String
Public CURR_DELETE_ORIGIN As Boolean = False
Public CURRENT_DT_REGEX As DataTable
Public REGEX_CLEAN_FILENAME As String = "[?*^""<>|]"
Public CURRENT_DROPTYPE
Public VIEWER_LICENSE As String = ""
Public INDEX_FORM_LOADED As Boolean
Public Property VIEWER_LICENSE As String = ""
End Module

View File

@ -1,15 +0,0 @@
Module ModuleHelpers
''' <summary>
''' Überprüft einen Wert auf verschiedene Arten von "Null" und gibt einen Standard-Wert zurück, wenn der Wert "Null" ist.
''' </summary>
''' <param name="value">Der zu überprüfende Wert</param>
''' <param name="defaultValue">Der Standard Wert</param>
''' <returns>value oder wenn dieser "Null" ist, defaultValue</returns>
Public Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
End Module

View File

@ -5,6 +5,7 @@ Module ModuleRuntime
'Dim ConfigPath As String = Path.Combine(Application.UserAppDataPath(), "UserConfig.xml")
Public Const USER_CONFIG_FILE = "UserConfig.xml"
Public Const COMPUTER_CONFIG_FILE = "ComputerConfig.xml"
Public Const WINDREAM_BASEPATH = "\\windream\objects"
Public MyConnectionString As String = ""
Public LogErrorsOnly As Boolean = True
@ -23,5 +24,5 @@ Module ModuleRuntime
Public IDB_DOC_ID As Int64
Public IDB_LOG_INDEX As String
Public WINDREAM As Windream
Public Property WINDREAM As Windream
End Module

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()

View File

@ -5,6 +5,7 @@ Imports System.Text
Imports System.Globalization
Imports System.Threading
Imports System.Runtime.InteropServices
Imports DigitalData.Modules.Language
Public Class frmStart
Public _lizenzManager As ClassLicenseManager
@ -160,7 +161,7 @@ Public Class frmStart
Try
ClassDatabase.Execute_non_Query($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')")
For Each oFiledropString As String In ClassFileDrop.files_dropped
For Each oFiledropString As String In ClassFileDrop.FilesDropped
If oFiledropString IsNot Nothing Then
LOGGER.Info(">> Check Drop-File: " & oFiledropString.ToString)
Dim oLastPipe = oFiledropString.LastIndexOf("|")
@ -211,11 +212,13 @@ Public Class frmStart
CURRENT_FILENAME = Filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_GUID = Filerow.Item(0)
CURRENT_WORKFILE = Filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_HASH = NotNull(Filerow.Item("FILE_HASH"), "")
CURRENT_WORKFILE_HASH = Utils.NotNull(Filerow.Item("FILE_HASH"), "")
LOGGER.Info(">> CURRENT_WORKFILE: " & CURRENT_WORKFILE)
If File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then
Open_IndexDialog()
Else
Throw New FileNotFoundException("Dropped file does not exist anymore!")
End If
' If multi-indexing is active, all files have been indexed by now, so we can leave the loop
@ -254,17 +257,6 @@ Public Class frmStart
MsgBox("Unexpected Error in Closing Application: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
EMAIL.Clear_TempFiles()
'TempDateien löschen
For Each oFile In TEMP_FILES
Try
System.IO.File.Delete(oFile)
Catch ex As Exception
LOGGER.Error(ex)
End Try
Next
Try
IndexForm.DisposeViewer()
IndexForm.Dispose()
@ -613,14 +605,13 @@ Public Class frmStart
}
If oOpenFileDialog.ShowDialog() = DialogResult.OK Then
Dim i As Integer = 0
ClassFileDrop.files_dropped = Nothing
ClassFileDrop.FilesDropped.Clear()
For Each oFileName In oOpenFileDialog.FileNames
ReDim Preserve ClassFileDrop.files_dropped(i)
LOGGER.Info(">> Chosen File: " & oFileName)
ClassFileDrop.files_dropped(i) = "|DROPFROMFSYSTEM|" & oFileName
i += 1
ClassFileDrop.FilesDropped.Add("|DROPFROMFSYSTEM|" & oFileName)
Next
TimerCheckDroppedFiles.Start()
End If
Catch ex As Exception