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

@@ -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