ZooFlow: Include Globix fixes

This commit is contained in:
Jonathan Jenne 2021-06-14 11:53:03 +02:00
parent ebef306a72
commit 8530005b6b
9 changed files with 212 additions and 112 deletions

View File

@ -5,19 +5,14 @@
<section name="DigitalData.GUIs.ZooFlow.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DigitalData.GUIs.ZooFlow.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="DigitalData.GUIs.ZooFlow.Settings.IDBConnectionStringDEFAULT"
connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=IDB_TEST;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
<add name="DigitalData.GUIs.ZooFlow.Settings.ECMConnectionStringDEFAULT"
connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;Persist Security Info=True;User ID=sa;Password=dd" />
<add name="DigitalData.GUIs.ZooFlow.Settings.DD_ECM_TESTConnectionString"
connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
<add name="DigitalData.GUIs.ZooFlow.Settings.IDBConnectionStringDEFAULT" connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=IDB_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient" />
<add name="DigitalData.GUIs.ZooFlow.Settings.ECMConnectionStringDEFAULT" connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;Persist Security Info=True;User ID=sa;Password=dd" />
<add name="DigitalData.GUIs.ZooFlow.Settings.DD_ECM_TESTConnectionString" connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient" />
</connectionStrings>
<applicationSettings>
<DigitalData.GUIs.ZooFlow.Settings>
@ -57,7 +52,7 @@
<value></value>
</setting>
<setting name="DPIAwarenessMode" serializeAs="String">
<value></value>
<value>System</value>
</setting>
<setting name="CustomPaletteCollection" serializeAs="Xml">
<value>

View File

@ -0,0 +1,56 @@
Public Class ClassExclusions
Public Function Load(ExclusionPath As String) As Boolean
Dim rowresult As String = ""
Try
'if file doesn't exist, create the file with its default xml table
If Not IO.File.Exists(My.Application.Globix.PATH_FileExclusions) Then
My.Application.Globix.DTEXCLUDE_FILES = CreateExclusionTable()
My.Application.Globix.DTEXCLUDE_FILES.WriteXml(My.Application.Globix.PATH_FileExclusions)
End If
My.Application.Globix.DTEXCLUDE_FILES = GetTablefromXML(ExclusionPath)
Return True
Catch ex As Exception
MsgBox("Error in ModuleUserSavings-LoadFileExclusion" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
End Function
Private Function CreateExclusionTable() As DataTable
Try
Dim oMyExclusions As New DataTable
oMyExclusions.TableName = "TBEXCLUSION"
' Create two columns, ID and Name.
oMyExclusions.Columns.Add("FILE_CONTAIN", GetType(System.String))
Dim newRow As DataRow = oMyExclusions.NewRow()
newRow("FILE_CONTAIN") = "Thumbs"
oMyExclusions.Rows.Add(newRow)
Dim newRow1 As DataRow = oMyExclusions.NewRow()
newRow1("FILE_CONTAIN") = "\~$"
oMyExclusions.Rows.Add(newRow1)
Dim newRow2 As DataRow = oMyExclusions.NewRow()
newRow2("FILE_CONTAIN") = ".db"
oMyExclusions.Rows.Add(newRow2)
Dim newRow3 As DataRow = oMyExclusions.NewRow()
newRow3("FILE_CONTAIN") = "desktop.ini"
oMyExclusions.Rows.Add(newRow3)
oMyExclusions.AcceptChanges()
Return oMyExclusions
Catch ex As Exception
MsgBox("Error in CreateExclusionTable" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
Private Function GetTablefromXML(FileExclusionPath As String) As DataTable
Try
Dim DS As New DataSet
DS.ReadXml(FileExclusionPath)
Return DS.Tables(0)
Catch ex As Exception
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
End Class

View File

@ -23,6 +23,33 @@ Public Class ClassFilehandle
Dim r = New Regex(String.Format("[{0}]", Regex.Escape(regexSearch)))
Return r.Replace(Input, replacement)
End Function
Public Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String)
Dim oFileInfo As New FileInfo(Filepath)
Dim oFilename As String = oFileInfo.Name
Dim oFileExists As Date = ClassHelpers.FileExistsinDropTable(Filepath)
If oFileExists.Equals(Date.MinValue) Then
Return True
Else
Dim oResult As DialogResult
Dim oDate As String = oFileExists.ToString("d")
Dim oBoxTitle = $"GLOBIX - {ModuleTitle}"
Dim oBoxOptions = MsgBoxStyle.Question Or MsgBoxStyle.YesNo
If My.Application.User.Language = "de-DE" Then
oResult = MsgBox($"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?", oBoxOptions, oBoxTitle)
Else
oResult = MsgBox($"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?", oBoxOptions, oBoxTitle)
End If
If oResult = DialogResult.Yes Then
Return True
End If
End If
Return False
End Function
Public Function Decide_FileHandle(filename As String, handletype As String) As Boolean
Try
If filename.EndsWith(".msg") Then

View File

@ -182,7 +182,8 @@ Public Class ClassFolderwatcher
End If
'Die Datei übergeben
Logger.Info(">> OnCreated-File:" & e.FullPath)
If My.Application.Globix.FileExistsinDropTable(e.FullPath) = False Then
If clsFilehandle.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then
clsFilehandle.Decide_FileHandle(e.FullPath, handleType)
Else
Logger.Info(">> Folderwatcher: File already exists:" & e.FullPath)

View File

@ -0,0 +1,48 @@
Public Class ClassHelpers
Public Shared Function FileExistsinDropTable(Filename As String) As Date
Dim oSQL As String
Dim oHash As String
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(My.LogConfig)
Try
If Filename.Contains("'") Then
Filename = Filename.Replace("'", "''")
End If
Try
oHash = oFilesystem.GetChecksum(Filename)
Catch ex As Exception
oHash = ""
End Try
oSQL = "SELECT * FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0 ORDER BY ADDED_WHEN"
Dim oResult As DataTable = My.Database.GetDatatable(oSQL)
If oResult Is Nothing Then
Return Nothing
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.Database.GetDatatable(oSQL)
If oResult Is Nothing Then
Return Nothing
End If
If oResult.Rows.Count = 0 Then
Return Nothing
Else
Dim oFirstRow As DataRow = oResult.Rows.Item(0)
Return oFirstRow.Item("ADDED_WHEN")
End If
Else
Dim oFirstRow As DataRow = oResult.Rows.Item(0)
Return oFirstRow.Item("ADDED_WHEN")
End If
Catch ex As Exception
MsgBox("Error in FileExistsinDropTable - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & oSQL, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
End Class

View File

@ -1,6 +1,7 @@
Imports System.IO
Namespace Globix
Public Class State
Public Property DT_FUNCTION_REGEX As DataTable
Public Property DTACTUAL_FILES As DataTable
@ -42,91 +43,7 @@ Namespace Globix
Public Property Folderwatchstarted As Boolean = False
Public Property DTEXCLUDE_FILES As DataTable
Public PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml")
Public Function FileExistsinDropTable(Filename As String) As Boolean
Dim oSQL As String
Try
If Filename.Contains("'") Then
Filename = Filename.Replace("'", "''")
End If
oSQL = "SELECT COUNT(*) FROM TBGI_FILES_USER WHERE UPPER(FILENAME2WORK) = UPPER('" & Filename & "') AND WORKED = 0"
Dim result = My.Database.GetScalarValue(oSQL)
If result >= 1 Then
result = True
Else
result = False
End If
Return result
Catch ex As Exception
MsgBox("Error in FileExistsinDropTable - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & oSQL, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
Public Function LoadFileExclusion() As Boolean
Dim rowresult As String = ""
Try
'if file doesn't exist, create the file with its default xml table
If Not File.Exists(PATH_FileExclusions) Then
DTEXCLUDE_FILES = CreateExclusionTable()
DTEXCLUDE_FILES.WriteXml(PATH_FileExclusions)
End If
DTEXCLUDE_FILES = GetTablefromXML()
'For Each Row As DataRow In DT.Rows
' rowresult &= Row.Item("FILE_CONTAIN")
' Select Case Row.Item("FILE_^^CONTAIN")
' End Select
'Next
Return True
Catch ex As Exception
MsgBox("Error in ModuleUserSavings-LoadFileExclusion" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
Return True
End Function
Private Function CreateExclusionTable() As DataTable
Try
' Create sample Customers table, in order
' to demonstrate the behavior of the DataTableReader.
Dim oMyExclusions As New DataTable
oMyExclusions.TableName = "TBEXCLUSION"
' Create two columns, ID and Name.
oMyExclusions.Columns.Add("FILE_CONTAIN", GetType(System.String))
Dim newRow As DataRow = oMyExclusions.NewRow()
newRow("FILE_CONTAIN") = "Thumbs"
oMyExclusions.Rows.Add(newRow)
Dim newRow1 As DataRow = oMyExclusions.NewRow()
newRow1("FILE_CONTAIN") = "\~$"
oMyExclusions.Rows.Add(newRow1)
Dim newRow2 As DataRow = oMyExclusions.NewRow()
newRow2("FILE_CONTAIN") = ".db"
oMyExclusions.Rows.Add(newRow2)
Dim newRow3 As DataRow = oMyExclusions.NewRow()
newRow3("FILE_CONTAIN") = "desktop.ini"
oMyExclusions.Rows.Add(newRow3)
oMyExclusions.AcceptChanges()
Return oMyExclusions
Catch ex As Exception
MsgBox("Error in CreateExclusionTable" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
Private Function GetTablefromXML() As DataTable
Try
Dim DS As New DataSet
DS.ReadXml(PATH_FileExclusions)
Return DS.Tables(0)
Catch ex As Exception
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
Public Property PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml")
End Class
End Namespace

View File

@ -10,6 +10,7 @@ Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Controls.LookupGrid
Imports Independentsoft
Imports DevExpress.XtraEditors.Controls
Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++"
@ -68,6 +69,8 @@ Public Class frmGlobix_Index
clsPostProcessing = New GlobixPostprocessing(LogConfig)
_idbdata = New ClassIDBData(LogConfig)
_Patterns = New GlobixPatterns(LogConfig)
Localizer.Active = New LookupGridLocalizer()
End Sub
Private Sub frmGlobix_Index_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -388,14 +391,20 @@ Public Class frmGlobix_Index
End Sub
Private Sub LoadIndexe_Man()
Try
Dim oScreen As New DigitalData.Modules.Windows.Screen()
Dim oDpiScale = oScreen.GetScreenScaling(Me)
Dim oControlCount As Integer = 1
Dim oLabelPosition As Integer = 11
Dim oControlPosition As Integer = 33
Dim oLabelPosition As Integer = 11 * oDpiScale
Dim oControlPosition As Integer = 33 * oDpiScale
' Dim oControls As New GlobixControls(_LogConfig, pnlIndex, Me)
Dim oControls As New DigitalData.GUIs.GlobalIndexer.ControlCreator(_LogConfig, pnlIndex, Me) With {
.OnControlChanged = AddressOf PrepareDependingControl,
.OnLookupData = AddressOf GetLookupData
}
_Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiScale)
_Controls = oControls
If DT_INDEXEMAN.Rows.Count = 0 Then
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert")
@ -474,8 +483,8 @@ Public Class frmGlobix_Index
End Select
oControlCount += 1
oLabelPosition += 50
oControlPosition += 50
oLabelPosition += 50 * oDpiScale
oControlPosition += 50 * oDpiScale
'make y as height in fom
Next
Dim oPanelHeight = oControlPosition - 30
@ -501,7 +510,7 @@ Public Class frmGlobix_Index
Try
Dim oMeta = DirectCast(pControl.Tag, ControlMeta)
Dim oIndexName As String = oMeta.IndexName
Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'"
Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}"
Dim oDatatable As DataTable = My.Database.GetDatatable(oSQL)
If Not IsNothing(oDatatable) Then
@ -882,6 +891,17 @@ Public Class frmGlobix_Index
_Logger.Info("Datei '" & My.Application.Globix.CURRENT_NEWFILENAME & "' erfolgreich erzeugt.")
Dim oDEL As String = "DELETE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID
My.Database.ExecuteNonQuery(oDEL)
If My.Application.Globix.CURR_DELETE_ORIGIN = True Then
_Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird gelöscht.")
Try
System.IO.File.Delete(My.Application.Globix.CURRENT_WORKFILE)
Catch ex As Exception
_Logger.Error(ex)
End Try
_Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wurde gelöscht.")
End If
Return True
End If
@ -1246,12 +1266,15 @@ Public Class frmGlobix_Index
If Directory.Exists(opath) = False Then
Directory.CreateDirectory(opath)
End If
'Die Datei wird nun verschoben
If My.Application.Globix.CURR_DELETE_ORIGIN = True Then
My.Computer.FileSystem.MoveFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME)
Else
My.Computer.FileSystem.CopyFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME)
End If
''Die Datei wird nun verschoben
'If My.Application.Globix.CURR_DELETE_ORIGIN = True Then
' My.Computer.FileSystem.MoveFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME)
'Else
' My.Computer.FileSystem.CopyFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME)
'End If
'Die Datei wird nun an den neuen Ort kopiert
My.Computer.FileSystem.MoveFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME)
Dim Insert_String As String
Try

View File

@ -16,6 +16,21 @@
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -176,6 +191,8 @@
<Compile Include="frmtest.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Globix\ClassExclusions.vb" />
<Compile Include="Globix\ClassHelpers.vb" />
<Compile Include="Globix\frmGlobixAdministration.Designer.vb">
<DependentUpon>frmGlobixAdministration.vb</DependentUpon>
</Compile>
@ -821,6 +838,18 @@
<ItemGroup>
<None Include="Resources\actions_options.svg" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -255,12 +255,16 @@ Public Class frmFlowForm
Logger.Info("Clipboard Watcher Module is not active. Hotkey Monitoring will be disabled!")
End If
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
FileDrop = New ClassFileDrop(My.LogConfig)
FileHandle = New ClassFilehandle()
FolderWatch = New ClassFolderwatcher
Refresh_RegexTable()
If My.Application.Globix.LoadFileExclusion = False Then
Dim oFileExclusions As New ClassExclusions()
If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then
If My.Application.User.Language = "de-DE" Then
MsgBox("Die Ausschlusskriterien für Dateien in Folderwatch konnten nicht angelegt werden!", MsgBoxStyle.Information)
Else
@ -268,7 +272,7 @@ Public Class frmFlowForm
End If
End If
My.Application.Globix.LoadFileExclusion()
Init_Folderwatch()
Start_Folderwatch()
GlobixToolStripMenuItem.Visible = True
@ -612,7 +616,7 @@ Public Class frmFlowForm
Logger.Info(" Check Drop-File: " & Str.ToString)
Dim handleType As String = Str.Substring(0, Str.LastIndexOf("|") + 1)
Dim filename As String = Str.Substring(Str.LastIndexOf("|") + 1)
If My.Application.Globix.FileExistsinDropTable(filename) = False Then
If FileHandle.CheckDuplicateFiles(filename, "Manuelle Ablage") Then
FileHandle.Decide_FileHandle(filename, handleType)
i += 1
Else
@ -733,7 +737,7 @@ Public Class frmFlowForm
End If
'Die Datei übergeben
Logger.Info(" Adding file from Scanfolder after startup:" & fileName)
If My.Application.Globix.FileExistsinDropTable(fileName) = False Then
If FileHandle.CheckDuplicateFiles(fileName, "FolderWatch/Scan") Then
FileHandle.Decide_FileHandle(fileName, handleType)
Else
Logger.Info("Scanfolder Startup: File already exists:" & fileName)
@ -769,7 +773,7 @@ Public Class frmFlowForm
End If
'Die Datei übergeben
Logger.Info("Adding file from Folderwatch after startup:" & fileName)
If My.Application.Globix.FileExistsinDropTable(fileName) = False Then
If FileHandle.CheckDuplicateFiles(fileName, "FolderWatch/Scan") Then
FileHandle.Decide_FileHandle(fileName, handleType)
Else
Logger.Info("Folderwatch Startup: File already exists:" & fileName)