Dumdidummdummda
This commit is contained in:
@@ -31,6 +31,8 @@ Public Class Class1
|
||||
Public Shared HostList As New List(Of String)
|
||||
Public Shared TerminalServerList As New List(Of String)
|
||||
|
||||
Public Shared ini As New cINI
|
||||
|
||||
|
||||
Public Shared Sub EnableDoubleBuffered(ByRef dgv As DataGridView)
|
||||
Dim dgvType As Type = dgv.[GetType]()
|
||||
|
||||
@@ -14,6 +14,8 @@ Public Class cDomUser
|
||||
Property du_Dom As String = ""
|
||||
Property du_sAMAc As String = ""
|
||||
Property du_Info As String = ""
|
||||
Property du_autologoff As Boolean = False
|
||||
Property du_autologofftime As DateTime
|
||||
Property mit_username As String = ""
|
||||
Property mit_pwd As String = ""
|
||||
'-----------------------------------------
|
||||
@@ -41,6 +43,8 @@ Public Class cDomUser
|
||||
list.Add(New SQLVariable("du_Dom", du_Dom))
|
||||
list.Add(New SQLVariable("du_sAMAc", du_sAMAc))
|
||||
list.Add(New SQLVariable("du_Info", du_Info))
|
||||
list.Add(New SQLVariable("du_autologoff", du_autologoff))
|
||||
list.Add(New SQLVariable("du_autologofftime", du_autologofftime))
|
||||
list.Add(New SQLVariable("mit_username", mit_username))
|
||||
list.Add(New SQLVariable("mit_pwd", mit_pwd))
|
||||
Return list
|
||||
|
||||
123
Dokumentation/Classes/cINI.vb
Normal file
123
Dokumentation/Classes/cINI.vb
Normal file
@@ -0,0 +1,123 @@
|
||||
Imports System.Reflection
|
||||
Imports System.IO
|
||||
|
||||
Public Class cINI
|
||||
|
||||
Public sAppPath As String = Application.StartupPath
|
||||
|
||||
Dim cINIPropertys = New List(Of MemberInfo)
|
||||
Dim INIfile As String = sAppPath & "\config.ini"
|
||||
Property prop_TSSitzungenAnzeigen As Boolean = True
|
||||
Property prop_Kompansicht As Boolean = True
|
||||
Property prop_FreiHostsAnzeigen As Boolean = False
|
||||
Property prop_DHCPClientsAnzeigen As Boolean = False
|
||||
Property prop_ToolsPanelAnzeizgen As Boolean = False
|
||||
|
||||
Property prop_Pano As Boolean = False
|
||||
|
||||
|
||||
Public Function LoadParameters()
|
||||
If Not File.Exists(Application.StartupPath & "\config.ini") Then
|
||||
File.Create(Application.StartupPath & "\config.ini")
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
|
||||
Dim test As String = ""
|
||||
Dim cINIPropertysNames = New List(Of String)
|
||||
Dim t As Type = GetType(cINI)
|
||||
|
||||
For Each member As MemberInfo In t.GetMembers
|
||||
If member.Name.ToString Like "prop_*" Then
|
||||
cINIPropertys.Add(member)
|
||||
cINIPropertysNames.Add(member.Name)
|
||||
'MsgBox(member.Name)
|
||||
End If
|
||||
Next
|
||||
|
||||
Try
|
||||
Dim lines = IO.File.ReadAllLines(sAppPath & "\config.ini")
|
||||
If lines.Count <= 1 Then Me.save()
|
||||
Try
|
||||
Dim colCount = lines.First.Split(";"c).Length
|
||||
Catch
|
||||
'
|
||||
Me.save(True)
|
||||
End Try
|
||||
|
||||
' Dim cINIPropertys = New List(Of MemberInfo)
|
||||
|
||||
|
||||
|
||||
|
||||
For Each meh In cINIPropertys
|
||||
test &= meh.Name.ToString & vbCrLf
|
||||
Next
|
||||
|
||||
' MsgBox(test)
|
||||
|
||||
For Each member As MemberInfo In cINIPropertys
|
||||
For Each line In lines
|
||||
Dim objFields = From field In line.Split(";"c)
|
||||
|
||||
Select Case objFields(0).ToString
|
||||
Case member.Name
|
||||
' MsgBox(objFields(0).ToString)
|
||||
'MsgBox(objFields(1).ToString)
|
||||
SetPropertyValueByName(Me, member.Name, objFields(1))
|
||||
' _ConType = objFields(1).ToString
|
||||
' Return True
|
||||
' Exit Function
|
||||
End Select
|
||||
Next
|
||||
Next
|
||||
' MsgBox(prop_TSSitzungenAnzeigen)
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler beim Lesen config.ini: " & vbCrLf & ex.Message)
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function SetPropertyValueByName(obj As [Object], name As String, value As [Object]) As Boolean
|
||||
Dim prop = obj.[GetType]().GetProperty(name, BindingFlags.[Public] Or BindingFlags.Instance)
|
||||
If prop Is Nothing OrElse Not prop.CanWrite Then
|
||||
Return False
|
||||
End If
|
||||
Try
|
||||
prop.SetValue(obj, value, Nothing)
|
||||
Catch
|
||||
Dim b As Boolean = False
|
||||
If value = "True" Or value = "1" Then
|
||||
b = True
|
||||
Else
|
||||
b = False
|
||||
End If
|
||||
prop.SetValue(obj, b, Nothing)
|
||||
End Try
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Shared Function GETPropertyValueByName(obj As [Object], name As String)
|
||||
Dim prop = obj.[GetType]().GetProperty(name, BindingFlags.[Public] Or BindingFlags.Instance)
|
||||
Return prop.GetValue(obj)
|
||||
End Function
|
||||
|
||||
Function save(Optional ByVal echostring As Boolean = False)
|
||||
Dim savestring As String = ""
|
||||
For Each member As MemberInfo In cINIPropertys
|
||||
savestring &= member.Name & ";" & GETPropertyValueByName(Me, member.Name) & ";" & vbCrLf
|
||||
Next
|
||||
If echostring = True Then
|
||||
MsgBox(savestring)
|
||||
Exit Function
|
||||
End If
|
||||
Dim objWriter As New System.IO.StreamWriter(INIfile)
|
||||
objWriter.Write(savestring)
|
||||
objWriter.Close()
|
||||
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user