40 lines
1.0 KiB
VB.net
40 lines
1.0 KiB
VB.net
Imports System.Reflection
|
|
Imports System.Xml
|
|
Imports Windream.WebService.Logging
|
|
|
|
Public Class Helpers
|
|
Private _logger As ILogging
|
|
|
|
Public Sub New(pLogger As ILogging)
|
|
_logger = pLogger
|
|
End Sub
|
|
|
|
Private Function GetPluginPath() As String
|
|
Dim s = Assembly.GetExecutingAssembly().CodeBase
|
|
s = New Uri(s).AbsolutePath
|
|
s = Uri.UnescapeDataString(s)
|
|
s = IO.Path.GetFullPath(s)
|
|
s = IO.Path.GetDirectoryName(s)
|
|
|
|
Return s
|
|
End Function
|
|
|
|
Public Function GetConfig() As XmlDocument
|
|
Dim path As String = GetPluginPath()
|
|
Dim configFile = path & "\config.xml"
|
|
|
|
_logger.Write($"[CONFIG] Lade Konfigurations Datei {configFile}", LogLevel.DEBUG)
|
|
|
|
If IO.File.Exists(configFile) Then
|
|
Dim Doc As New XmlDocument()
|
|
Doc.Load(configFile)
|
|
|
|
Return Doc
|
|
Else
|
|
_logger.Write($"[CONFIG] Konfigurations Datei {configFile} wurde NICHT gefunden!")
|
|
|
|
Return Nothing
|
|
End If
|
|
End Function
|
|
End Class
|