2021-01-19 16:23:19 +01:00

134 lines
5.9 KiB
VB.net

Imports System.IO
Namespace Globix
Public Class State
Public Property DT_FUNCTION_REGEX As DataTable
Public Property DTACTUAL_FILES As DataTable
Public Property DTTBGI_REGEX_DOCTYPE As DataTable
Public Property REGEX_CLEAN_FILENAME As String = "[?*^""<>|]"
Public Property TEMP_FILES As List(Of String) = New List(Of String)
Public Property CurrMessageID As String
Public Property CURRENT_FILENAME As String
Public Property CurrentFolderWatchPath As String
Public Property CURRENT_SCAN_FOLDERWATCH As String
Public Property CURRENT_WORKFILE_GUID As Long
Public Property CURRENT_WORKFILE As String
Public Property CURRENT_WORKFILE_EXTENSION As String
Public Property CURRENT_NEWFILENAME As String
Public Property CURRENT_MESSAGEDATE As String
Public Property CURRENT_MESSAGESUBJECT As String
Public Property CURRENT_IDB_OBJ_ID As Long
Public Property INDEXING_ACTIVE As Boolean = False
Public Property ABORT_INDEXING As Boolean = False
Public Property CURRENT_ISATTACHMENT As Boolean = False
Public Property CURR_DELETE_ORIGIN As Boolean = False
Public Property CURRENT_DROPTYPE As String
Public Property CURRENT_LASTDOCTYPE As String
Public Property CURRENT_DOCTYPE_ID As Int16
Public Property CURRENT_DOCTYPE_DuplicateHandling As String
Public Property MULTIINDEXING_ACTIVE As Boolean = False
Public Property ECMDirect As Boolean = True
Public Property CURRENT_PROFILE_LOG_INDEX As String
Public Property ShowIndexResult As Boolean = True
Public Property CURR_DT_MAN_INDEXE As DataTable
Public Property CURR_DT_AUTO_INDEXE As DataTable
Public Property CURR_DT_DOCTYPE As DataTable
Public Property CURR_INDEX_MAN_POSTPROCESSING As DataTable
Public Property FILE_DELIMITER As String
Public Property VERSION_DELIMITER As String
Public Property CURRENT_MESSAGEID As String
Public Property CURRENT_BusinessEntity As String
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
End Class
End Namespace