This commit is contained in:
SchreiberM
2017-02-01 12:47:07 +01:00
parent 5023a28d75
commit 6c1d38e67f
3 changed files with 60 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ Public Class ClassInit
End Function
Public Sub InitBasics()
Try
InitAddons()
Dim sql = String.Format("SELECT * FROM TBPMO_KONFIGURATION WHERE GUID = 1")
Dim KONFIG_DT As DataTable = clsDatabase.Return_Datatable(sql, False)
If KONFIG_DT.Rows.Count = 1 Then
@@ -80,6 +81,45 @@ Public Class ClassInit
End Try
End Function
Public Sub InitAddons()
Try
Dim CurrentDir As String = My.Application.Info.DirectoryPath
' Dim Sql As String = "SELECT PATH_ADDONS from TBPMO_KONFIGURATION WHERE GUID = 1"
Dim AddonPath As String = MY_ADDON_PATH ' ClassDatabase.Execute_Scalar(Sql)
Dim Dev_AddonPath As String = System.IO.Path.GetFullPath(System.IO.Path.Combine(CurrentDir, "..\..\..\..\app"))
If AddonPath Is Nothing OrElse AddonPath = "" Then
' Addon Pfad in der Datenbank ist leer
Dim path = System.IO.Path.Combine(CurrentDir, "Addons")
Dim AddonDir As New DirectoryInfo(path)
If AddonDir.Exists Then
AddonPath = path
Else
AddonPath = Dev_AddonPath
End If
Else
' Addon Pfad steht in der Datenbank
Dim path = AddonPath
Dim AddonDir As New DirectoryInfo(path)
If (AddonDir.Exists) Then
If AddonDir.Name = "Addons" Then
AddonPath = path
Else
AddonPath = Dev_AddonPath
End If
Else
AddonPath = Dev_AddonPath
End If
End If
MY_ADDON_PATH = AddonPath
Catch ex As Exception
MsgBox("Unexpected Error in InitAddons:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class