60 lines
2.4 KiB
VB.net
60 lines
2.4 KiB
VB.net
Public Class ClassExclusions
|
|
|
|
Public Property FileExclusionPath As String = IO.Path.Combine(My.Application.UserAppDataPath, "FileExclusions.xml")
|
|
|
|
Public Function Load() 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(FileExclusionPath) Then
|
|
My.Application.Globix.DTEXCLUDE_FILES = CreateExclusionTable()
|
|
My.Application.Globix.DTEXCLUDE_FILES.WriteXml(FileExclusionPath)
|
|
End If
|
|
My.Application.Globix.DTEXCLUDE_FILES = GetTablefromXML(FileExclusionPath)
|
|
|
|
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 With {
|
|
.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
|