From 540f9f417676d43e863a5b426e9f4caffc397e5b Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 24 Feb 2022 11:27:43 +0100 Subject: [PATCH 1/2] MS --- GUIs.ZooFlow/frmFlowForm.vb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index 8cfcf14e..d0bbbfb0 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -793,6 +793,7 @@ Public Class frmFlowForm If FileHandle.CheckDuplicateFiles(fileName, "FolderWatch/Scan") Then FileHandle.Decide_FileHandle(fileName, handleType) Else + IO.File.Delete(fileName) Logger.Info("Scanfolder Startup: File already exists:" & fileName) End If Next fileName @@ -1228,5 +1229,9 @@ Public Class frmFlowForm Private Sub BarButtonItem9_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem9.ItemClick frmGlobixBasicConfig.ShowDialog() End Sub + + Private Sub frmFlowForm_Shown(sender As Object, e As EventArgs) Handles Me.Shown + + End Sub End Class From 80a541ff36bbe3eabc5360320cab25b4e740936a Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 24 Feb 2022 12:08:52 +0100 Subject: [PATCH 2/2] =?UTF-8?q?MS=20Doppeltpr=C3=BCfung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb | 26 ++++++++++++++----- GUIs.ZooFlow/frmFlowForm.vb | 24 ++++++++++++++--- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb b/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb index 68bf5f2f..ff612404 100644 --- a/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb +++ b/GUIs.ZooFlow/Modules/Globix/ClassUserFiles.vb @@ -1,19 +1,33 @@ Imports DigitalData.Modules.Base +Imports DigitalData.Modules.Filesystem Imports DigitalData.Modules.Logging +Imports System.IO +Imports File = DigitalData.Modules.Filesystem.File Public Class ClassUserFiles Inherits BaseClass - + Private Property FILESYSTEM As Modules.Filesystem.File Public Sub New(pLogConfig As LogConfig) MyBase.New(pLogConfig) + FILESYSTEM = New File(pLogConfig) End Sub Public Function Insert_GI_File(filename As String, handleType As String) As Boolean Try filename = filename.Replace("'", "''") - Dim filename_only As String = IO.Path.GetFileName(filename) - Dim ins As String = "INSERT INTO TBGI_FILES_USER (FILENAME2WORK, USER@WORK,HANDLE_TYPE,FILENAME_ONLY) VALUES ('" & filename & "','" & Environment.UserName & "','" & handleType & "','" & filename_only & "')" + Dim oHash As String = String.Empty + + If IO.File.Exists(filename) Then + If (filename.ToUpper.EndsWith(".MSG") Or filename.ToUpper.EndsWith(".EML")) And (handleType = "|OUTLOOK_MESSAGE|" Or handleType = "|MSGONLY|") Then + oHash = FILESYSTEM.GetChecksumFromString(filename) + Else + oHash = FILESYSTEM.GetChecksum(filename) + End If + End If + + Dim filename_only As String = Path.GetFileName(filename) + Dim ins As String = $"INSERT INTO TBGI_FILES_USER (FILENAME2WORK, USER@WORK, HANDLE_TYPE, FILENAME_ONLY, FILE_HASH) VALUES ('{filename}','{Environment.UserName}','{handleType}','{filename_only}', '{oHash}')" Return My.DatabaseECM.ExecuteNonQuery(ins) Catch ex As Exception @@ -37,7 +51,7 @@ Public Class ClassUserFiles oHash = "" End Try - oSQL = "SELECT * FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0 ORDER BY ADDED_WHEN" + oSQL = "SELECT * FROM TBGI_FILES_USER WHERE FILE_HASH = '" & oHash & "' AND WORKED = 0 ORDER BY ADDED_WHEN" Dim oResult As DataTable = My.DatabaseECM.GetDatatable(oSQL) If oResult Is Nothing Then @@ -45,8 +59,8 @@ Public Class ClassUserFiles End If If oResult.Rows.Count = 0 Then - oSQL = "SELECT * FROM TBGI_HISTORY WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') ORDER BY ADDED_WHEN" - oResult = My.DatabaseECM.GetDatatable(oSQL) + oSQL = "SELECT * FROM TBIDB_FILE_OBJECT WHERE FILE_HASH = '" & oHash & "' ORDER BY ADDED_WHEN" + oResult = My.DatabaseIDB.GetDatatable(oSQL) If oResult Is Nothing Then Return Nothing diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index d0bbbfb0..fc5412f9 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -794,6 +794,7 @@ Public Class frmFlowForm FileHandle.Decide_FileHandle(fileName, handleType) Else IO.File.Delete(fileName) + Logger.Info("Scanfolder Startup: File already exists:" & fileName) End If Next fileName @@ -831,6 +832,7 @@ Public Class frmFlowForm FileHandle.Decide_FileHandle(fileName, handleType) Else Logger.Info("Folderwatch Startup: File already exists:" & fileName) + IO.File.Delete(fileName) End If Next fileName @@ -875,6 +877,7 @@ Public Class frmFlowForm Me.TimerFolderwatch.Stop() For Each row As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows Dim FILEGUID = row.Item("GUID") + Dim oDel = String.Format("DELETE FROM TBGI_FILES_USER WHERE GUID = {0}", FILEGUID) If My.Application.Globix.ABORT_INDEXING = True Then Exit For End If @@ -886,16 +889,31 @@ Public Class frmFlowForm Dim fileexists As Boolean = System.IO.File.Exists(FileForWork) If fileInUse = False Then If fileexists = True Then - My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With { + Dim handleType As String + If FileForWork.ToLower.EndsWith(".msg") Then + handleType = "|FW_OUTLOOK_MESSAGE|" + Else + handleType = "|FW_SIMPLEINDEXER|" + End If + If FileHandle.CheckDuplicateFiles(FileForWork, "FolderWatch") Then + My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With { .Id = DirectCast(row.Item("GUID"), Integer), .FilePath = FileForWork, .HotfolderFile = True } + Globix_Open_IndexDialog() + Else + My.Database.ExecuteNonQueryECM(oDel) + IO.File.Delete(FileForWork) + Logger.Info("Folderwatch: File has been deleted:" & FileForWork) + End If + + + - Globix_Open_IndexDialog() Else Logger.Info(" File not existing - Row will be deleted!") - Dim oDel = String.Format("DELETE FROM TBGI_FILES_USER WHERE GUID = {0}", FILEGUID) + My.Database.ExecuteNonQueryECM(oDel) End If Else