ZooFlow: Include Globix fixes
This commit is contained in:
56
GUIs.ZooFlow/Globix/ClassExclusions.vb
Normal file
56
GUIs.ZooFlow/Globix/ClassExclusions.vb
Normal 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
|
||||
Reference in New Issue
Block a user