MS_Dec2015
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports System.Xml
|
||||
|
||||
Module ModuleMySettings
|
||||
Public PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml")
|
||||
Dim ConfigPath As String = Path.Combine(Application.UserAppDataPath(), "UserConfig.xml")
|
||||
|
||||
Public MyConnectionString As String = ""
|
||||
@@ -29,7 +30,62 @@ Module ModuleMySettings
|
||||
|
||||
Public sql_UserID As String = "SELECT GUID FROM TBDD_USER WHERE (LOWER(USERNAME) = LOWER('@user'))"
|
||||
|
||||
Public FWSCAN_started As Boolean = False
|
||||
|
||||
Dim rowresult As String = ""
|
||||
Public Function LoadFileExclusion()
|
||||
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(PATH_FileExclusions)
|
||||
|
||||
'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 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 table As New DataTable
|
||||
table.TableName = "TBEXCLUSION"
|
||||
|
||||
' Create two columns, ID and Name.
|
||||
table.Columns.Add("FILE_CONTAIN", GetType(System.String))
|
||||
Dim newRow As DataRow = table.NewRow()
|
||||
newRow("FILE_CONTAIN") = "Thumbs"
|
||||
table.Rows.Add(newRow)
|
||||
Dim newRow1 As DataRow = table.NewRow()
|
||||
newRow1("FILE_CONTAIN") = "\~$"
|
||||
table.Rows.Add(newRow1)
|
||||
Dim newRow2 As DataRow = table.NewRow()
|
||||
newRow2("FILE_CONTAIN") = ".db"
|
||||
table.Rows.Add(newRow2)
|
||||
Dim newRow3 As DataRow = table.NewRow()
|
||||
newRow3("FILE_CONTAIN") = "desktop.ini"
|
||||
table.Rows.Add(newRow3)
|
||||
table.AcceptChanges()
|
||||
Return table
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in CreateExclusionTable" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Function MySettings_Load()
|
||||
Try
|
||||
Dim DT As DataTable
|
||||
@@ -40,7 +96,7 @@ Module ModuleMySettings
|
||||
DT.WriteXml(ConfigPath)
|
||||
ClassLogger.Add(">> Standardwerte wurden gespeichert.", False)
|
||||
End If
|
||||
DT = GetTablefromXML()
|
||||
DT = GetTablefromXML(ConfigPath)
|
||||
If DT Is Nothing Then
|
||||
MsgBox("Konfiguration konnte nicht geladen werden. Check LogFile!", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
@@ -100,6 +156,8 @@ Module ModuleMySettings
|
||||
WD_ShowDocs = CBool(Row.Item("Value"))
|
||||
Case "Sett_ConstructorStart"
|
||||
Sett_ConstructorStart = CInt(Row.Item("Value"))
|
||||
Case "FWSCAN_started"
|
||||
FWSCAN_started = CBool(Row.Item("Value"))
|
||||
End Select
|
||||
Next
|
||||
'update 1.1
|
||||
@@ -117,6 +175,13 @@ Module ModuleMySettings
|
||||
DT.Rows.Add(newRow)
|
||||
DT.WriteXml(ConfigPath)
|
||||
End If
|
||||
If rowresult.Contains("FWSCAN_started") = False Then
|
||||
Dim newRow As DataRow = DT.NewRow()
|
||||
newRow("ConfigName") = "FWSCAN_started"
|
||||
newRow("Value") = "False"
|
||||
DT.Rows.Add(newRow)
|
||||
DT.WriteXml(ConfigPath)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in LoadMyConfig" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
ClassLogger.Add("Error in LoadMyConfig: " & ex.Message, True)
|
||||
@@ -125,19 +190,20 @@ Module ModuleMySettings
|
||||
Return True
|
||||
|
||||
End Function
|
||||
Private Function GetTablefromXML()
|
||||
Private Function GetTablefromXML(path As String)
|
||||
Try
|
||||
Dim DS As New DataSet
|
||||
DS.ReadXml(ConfigPath)
|
||||
DS.ReadXml(path)
|
||||
Return DS.Tables(0)
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message & vbNewLine & "ConfigPath: " & vbNewLine & ConfigPath, MsgBoxStyle.Critical)
|
||||
MsgBox("Error in GetTablefromXML" & vbNewLine & ex.Message & vbNewLine & "ConfigPath: " & vbNewLine & path, MsgBoxStyle.Critical)
|
||||
ClassLogger.Add("Error in GetTablefromXML: " & ex.Message, True)
|
||||
ClassLogger.Add(">> ConfigPath: " & ConfigPath, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function CreateConfigTable() As DataTable
|
||||
Try
|
||||
' Create sample Customers table, in order
|
||||
@@ -195,6 +261,12 @@ Module ModuleMySettings
|
||||
Dim newRow9 As DataRow = table.NewRow()
|
||||
newRow9("ConfigName") = "Sett_ConstructorStart"
|
||||
newRow9("Value") = "0"
|
||||
Dim newRow10 As DataRow = table.NewRow()
|
||||
newRow10("ConfigName") = "FWSCAN_started"
|
||||
newRow10("Value") = "False"
|
||||
table.Rows.Add(newRow10)
|
||||
|
||||
|
||||
table.Rows.Add(newRow9)
|
||||
table.AcceptChanges()
|
||||
ClassLogger.Add(">> Tabelle wurde erzeugt...", False)
|
||||
@@ -204,10 +276,16 @@ Module ModuleMySettings
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Function SaveMySettingsValue(name As String, value As String)
|
||||
Public Function SaveMySettingsValue(name As String, value As String, type As String)
|
||||
Try
|
||||
Dim DT As DataTable
|
||||
DT = GetTablefromXML()
|
||||
If type = "ConfigMain" Then
|
||||
DT = GetTablefromXML(ConfigPath)
|
||||
End If
|
||||
If type = "ExcludeFilter" Then
|
||||
DT = GetTablefromXML(PATH_FileExclusions)
|
||||
End If
|
||||
|
||||
If Not DT Is Nothing Then
|
||||
For Each Row As DataRow In DT.Rows
|
||||
If Row.Item("ConfigName") = name Then
|
||||
@@ -219,7 +297,7 @@ Module ModuleMySettings
|
||||
Else
|
||||
MsgBox("Setting konnte nicht gespeichert werden! Prüfen Sie dei logfile.", MsgBoxStyle.Critical)
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in SaveConfigValue" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
Return False
|
||||
|
||||
Reference in New Issue
Block a user