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

View File

@ -15,6 +15,7 @@ Module ModuleMySettings
Public VERSION_USER As String = "1.0.0.0"
Public FOLDER_TEMP As String
Public LogErrorsOnly As Boolean = True
Public MY_ADDON_PATH As String
Public Function LoadFileExclusion()
Dim rowresult As String = ""

View File

@ -77,6 +77,8 @@ Public Class frmVersionCheck
End If
Console.WriteLine(fri.Name)
Next fri
Replace_Files()
Try
'Delete the tempfolder and all data
System.IO.Directory.Delete(FOLDER_TEMP, True)
@ -94,6 +96,7 @@ Public Class frmVersionCheck
' InitInterface wurde in frmMain integriert
'Init.InitInterface(mainForm)
System.Threading.Thread.Sleep(200)
Start_RO()
Else
End If
@ -101,10 +104,24 @@ Public Class frmVersionCheck
' MsgBox("Unexpected Error in Init Classes: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
'End Try
End Sub
Sub Replace_Files()
Try
Dim ProductionPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "Record Organizer")
Dim DevelPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "DD-Record-Organiser\bin\Debug")
Dim COPY_FROM_PATH As String
If Directory.Exists(ProductionPath) Then
COPY_FROM_PATH = ProductionPath
Else
COPY_FROM_PATH = DevelPath
End If
Catch ex As Exception
MsgBox("Unexpected Error in Replace_Files: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Start_RO()
Try
Dim ProductionPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "RightManager", "RecordOrganizer_RightManager.exe")
Dim DevelPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "RecordOrganizer_RightManager\bin\Debug", "RecordOrganizer_RightManager.exe")
Dim ProductionPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "Record Organizer", "DD-Record-Organiser.exe")
Dim DevelPath As String = System.IO.Path.Combine(MY_ADDON_PATH, "DD-Record-Organiser\bin\Debug", "DD-Record-Organiser.exe")
Dim startInfo As New ProcessStartInfo()
startInfo.Arguments = """" & MyConnectionString & """"