MS-KW39 Änderungen UpdateClass und VersionChecker

This commit is contained in:
Digital Data - Marlon Schreiber 2017-10-04 10:19:12 +02:00
parent 5d659602db
commit e8c06c46a7
7 changed files with 258 additions and 187 deletions

View File

@ -314,10 +314,12 @@ Public Class ClassControlBuilder
If TableResult.Rows.Count = 0 Then
Exit Sub
End If
If CURRENT_RECORD_ID = 0 Or CONTROL_ID = 0 Then
Exit Sub
End If
If IsNothing(value) Then 'Kein Value also abhängige Controls auf "Leer" setzen
Try
For Each row As DataRow In TableResult.Rows
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = row.Item("GUID")
Dim panel As Panel = DirectCast(control.Parent, Panel)
@ -341,6 +343,11 @@ Public Class ClassControlBuilder
Next
Exit Sub
Catch ex As Exception
MsgBox("Unexpected error in DependingControls (For Each row As DataRow In TableResult.Rows)- " & CONTROL_ID.ToString & ": " & ex.Message, MsgBoxStyle.Critical)
Exit Sub
End Try
End If
For Each row As DataRow In TableResult.Rows
@ -356,20 +363,7 @@ Public Class ClassControlBuilder
If match.Success Then
Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID)
Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid, True)
'Select Case row.Item("FORMAT_TYPE")
' Case "Currency"
' value = Decimal.Parse(value, Globalization.NumberStyles.Currency).ToString
' Case "Decimal"
' value = Decimal.Parse(value, Globalization.NumberStyles.Integer)
'End Select
'Select Case row.Item("CONTROL_TYPE_ID")
' Case 4 'DatePicker
' Try
' value = CStr(CDate(value)) 'Format(value, "dd-MM-yyyy"))
' Catch ex As Exception
' ClassLogger.Add("Unexpected Error in converting Value '" & value & "' to date - Control-ID: " & CONTROL_ID.ToString & "- Error: " & ex.Message)
' End Try
'End Select
' Diese Abfrage verhindert, dass Werte, die aus z.B. CheckedListBoxen kommen,
' nicht überschrieben werden. Diese Werte werden bereits mit UpdateMultipleValues gespeichert
If (Not value.Contains(";")) Then

View File

@ -586,9 +586,11 @@ Public Class ClassControlCommandsUI
If Not _addValue = "" Then
Dim converted_value = Check_and_Format_Value(ControlId, RecordId, _addValue)
If Not IsNothing(converted_value) Then
Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE,ADDED_WHO) VALUES({0}, {1}, '{2}','{3}')", ControlId, RecordId, converted_value, USER_USERNAME)
ClassDatabase.Execute_non_Query(ins)
ClassProxy.PRPROXY_CONTROL_VALUE_UPD_INS(CURRENT_ENTITY_ID, ControlId, RecordId, converted_value)
ClassControlCommandsUI.InsertControlValue(ControlId, RecordId, converted_value, CURRENT_ENTITY_ID)
'Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE,ADDED_WHO) VALUES({0}, {1}, '{2}','{3}')", ControlId, RecordId, converted_value, USER_USERNAME)
'ClassDatabase.Execute_non_Query(ins)
'ClassProxy.PRPROXY_CONTROL_VALUE_UPD_INS(CURRENT_ENTITY_ID, ControlId, RecordId, converted_value)
End If
End If
Next

View File

@ -21,6 +21,8 @@ Public Class ClassUpdate
Public Shared UPDATE_ERROR As Boolean = False
Private Shared RecExe_found As Boolean = False
Private Shared DT_USER_DATA As DataTable
Private Shared USER_INFO1, USER_INFO2, USER_INFO3 As String
Public Shared Function Init()
Try
If InitInstallPath() = False Then
@ -33,7 +35,7 @@ Public Class ClassUpdate
MIN_REQUIRED_VERSION = KONFIG_DT.Rows(0).Item("MIN_REQUIRED_VERSION")
End If
sql = String.Format("Select * FROM TBDD_VERSION_UPDATE WHERE GUID = (Select MAX(GUID) FROM TBDD_VERSION_UPDATE WHERE UPPER(MODULE_NAME) = UPPER('{0}'))", "Record-Organizer")
DT_UPDATE = clsDatabase.Return_Datatable(sql, False)
DT_UPDATE = clsDatabase.Return_Datatable(sql)
If Not IsNothing(DT_UPDATE) Then
If DT_UPDATE.Rows.Count = 1 Then
UPDATE_ID = DT_UPDATE.Rows(0).Item("GUID")
@ -43,6 +45,7 @@ Public Class ClassUpdate
ALL_USERS = DT_UPDATE.Rows(0).Item("ALL_USERS")
sql = String.Format("SELECT * FROM TBDD_VERSION_ITEMS WHERE UPDATE_ID = {0} AND [INFO1] IS NOT NULL ORDER BY GUID", UPDATE_ID)
DT_UPDATE_ITEMS = clsDatabase.Return_Datatable(sql)
ClassLogger.Add(String.Format("{0} items need to be updated!", DT_UPDATE_ITEMS.Rows.Count.ToString), False)
Else
ClassLogger.Add(">> No Updates Configured!", False)
End If
@ -116,15 +119,10 @@ Public Class ClassUpdate
Else
USER_GUID = USER_DT.Rows(0).Item("GUID")
USER_LANGUAGE = USER_DT.Rows(0).Item("LANGUAGE")
sql = String.Format("SELECT UPDATE_PATH FROM TBDD_VERSION_USER_UPDATE_PATH WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
Dim USER_UPDATE_PATH = clsDatabase.Execute_Scalar(sql)
If Not IsNothing(USER_UPDATE_PATH) Then
If USER_UPDATE_PATH <> String.Empty Then
MyServer_UpdatePath = USER_UPDATE_PATH
End If
Else
MyServer_UpdatePath = String.Empty
End If
sql = String.Format("SELECT UPDATE_PATH,TEMPPATH,INFO1,INFO2,INFO3 FROM TBDD_VERSION_USER_UPDATE_PATH WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
DT_USER_DATA = clsDatabase.Return_Datatable(sql)
MyServer_UpdatePath = DT_USER_DATA.Rows(0).Item("UPDATE_PATH")
sql = String.Format("SELECT CASE VERSION_CLIENT WHEN '' THEN '{3}' ELSE VERSION_CLIENT END AS VERSION_CLIENT FROM VWDD_LOGIN_USER_HISTORY WHERE GUID = (select MAX(GUID) from VWDD_LOGIN_USER_HISTORY where USER_ID = {0} AND VERSION_CLIENT <> '' AND UPPER(MACHINE_NAME) = UPPER('{1}') AND UPPER(MODULE) = UPPER('{2}'))", USER_GUID, Environment.MachineName, "Record-Organizer", VERSION_SERVER)
VERSION_USER = clsDatabase.Execute_Scalar(sql)
If IsNothing(VERSION_USER) Then
@ -145,33 +143,65 @@ Public Class ClassUpdate
End Function
Public Shared Sub RUN_UPDATE()
If (VERSION_USER = VERSION_SERVER) Or VERSION_SERVER = 1000 Or VERSION_USER = 1000 Then
Dim UPD_VC As Boolean = False
Dim UPD_RM As Boolean = False
Dim KEEP_TEMPPATH As Boolean = False
If DT_USER_DATA.Rows.Count <> 1 Then
Exit Sub
Else
USER_INFO1 = DT_USER_DATA.Rows(0).Item("INFO1")
USER_INFO2 = DT_USER_DATA.Rows(0).Item("INFO2")
USER_INFO3 = DT_USER_DATA.Rows(0).Item("INFO3")
If DT_USER_DATA.Rows(0).Item("TEMPPATH") <> "" Then
FOLDER_TEMP = DT_USER_DATA.Rows(0).Item("TEMPPATH")
Else
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
If Upd_item.Item("ITEM_INFO") = "VERSION_CHECKER.exe" Then
If Not USER_INFO1.Contains(Upd_item.Item("INFO2")) Then
UPD_VC = True
End If
ElseIf Upd_item.Item("ITEM_INFO") = "RecordOrganizer_RightManager.exe" Then
If Not USER_INFO1.Contains(Upd_item.Item("INFO2")) Then
UPD_RM = True
End If
End If
If Not IsDBNull(Upd_item.Item("INFO3")) Then
FOLDER_TEMP = Upd_item.Item("INFO3")
End If
Next
End If
End If
If UPD_VC = True Or UPD_RM = True Then
UPDATE_NECESSARY = True
If FORCE_UPDATE = False Then
If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
ClassLogger.Add(String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER), False)
ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER))
FORCE_UPDATE = True
End If
End If
If FORCE_UPDATE = False Then
If ALL_USERS = False Then
Dim sql = String.Format("SELECT COUNT(GUID) FROM TBDD_VERSION_USER_UPDATE WHERE USER_ID = {0} AND UPDATE_ID = {1}", USER_GUID, UPDATE_ID)
If clsDatabase.Execute_Scalar(sql) = 0 Then
ClassLogger.Add(String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID), False)
ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID))
If UPDATE_NECESSARY = False Then
Exit Sub
End If
End If
'If FORCE_UPDATE = False Then
' If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
' ClassLogger.Add(String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER), False)
' ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: ForceUpdate for User as Version '{0}' is used!", VERSION_USER))
' FORCE_UPDATE = True
' End If
'End If
'If FORCE_UPDATE = False Then
' If ALL_USERS = False Then
' sql = String.Format("SELECT COUNT(GUID) FROM TBDD_VERSION_USER_UPDATE WHERE USER_ID = {0} AND UPDATE_ID = {1}", USER_GUID, UPDATE_ID)
' If clsDatabase.Execute_Scalar(sql) = 0 Then
' ClassLogger.Add(String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID), False)
' ClassHelper.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("VersionChecker: User is not part of update-group - UPDATE-ID: {0}", UPDATE_ID))
' Exit Sub
' End If
' End If
Dim msg = "Auf dem Server liegt ein Update für ein ADDI-AddOn bereit!" & vbNewLine & "Wollen Sie das Update nun durchführen? Die Dauer ist abhängig von Ihrer Netzwerkverbindung!"
If USER_LANGUAGE <> "de-DE" Then
msg = "There is a new release available for an ADDI-AddOn!" & vbNewLine & "Would You like to install the update now? This might take some time (minute(s))!"
msg = "There is a new release available for an ADDI-AddOn!" & vbNewLine & "Would You like to install the update now? This might take some time minute(s)!"
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
@ -179,55 +209,122 @@ Public Class ClassUpdate
UPDATE_CANCELLED = True
Exit Sub
End If
End If
'End If
If MyServer_UpdatePath <> String.Empty Then
If Directory.Exists(MyServer_UpdatePath) Then
GetTempFolderGuid()
If FOLDER_TEMP <> String.Empty Then
If Directory.Exists(FOLDER_TEMP) Then
' GetTempFolderGuid()
' If FOLDER_TEMP <> String.Empty Then
' Make a reference to a directory.
Dim di As New DirectoryInfo(MyServer_UpdatePath)
' Get a reference to each file in that directory.
Dim fiArr As FileInfo() = di.GetFiles()
' Display the names of the files.
'Dim fri As FileInfo
Dim error_while_copying = False
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
ClassLogger.Add(String.Format("...working on item {0}: ", Upd_item.Item("ITEM_INFO")), False)
If Upd_item.Item("ITEM_INFO") = "VERSION_CHECKER.exe" Then
KEEP_TEMPPATH = Upd_item.Item("BIT3")
End If
If error_while_copying = True Then
Exit For
End If
Dim updatefile2copy = Path.Combine(MyServer_UpdatePath, Upd_item.Item("ITEM_INFO"))
Dim tempfilename = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
If File.Exists(updatefile2copy) Then
If File.Exists(tempfilename) Then
Try
System.IO.File.Copy(updatefile2copy, tempfilename)
Dim error_while_replacing = False
Dim BackUpOfFileToReplace As String = MY_INSTALL_PATH & "\" & Upd_item.Item("INFO1") & Upd_item.Item("ITEM_INFO") & ".bac"
BackUpOfFileToReplace = BackUpOfFileToReplace.Replace("//", "/")
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
Dim targetfile
If IsDBNull(Upd_item.Item("INFO1")) Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
Else
If Upd_item.Item("INFO1") <> String.Empty Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
Else
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
End If
End If
targetfile = targetfile.ToString.Replace("//", "/")
ClassLogger.Add(String.Format("...replacing targetfile '{0}': ", targetfile), False)
Try
' Replace the file.
If File.Exists(targetfile) Then
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
If File.Exists(BackUpOfFileToReplace) Then
If KEEP_TEMPPATH Then
If CopyFile(sourcefile, targetfile) = True Then
File_Delete(BackUpOfFileToReplace)
ClassLogger.Add(String.Format("...targetfile '{0}' was copied! ", targetfile), False)
Dim updinfo
If USER_INFO1 <> "" Then
updinfo = USER_INFO1 & ";" & Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
Else
updinfo = Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
End If
Dim _Sql = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET INFO1 = '{2}' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer", updinfo)
clsDatabase.Execute_non_Query(_Sql)
End If
Else
If MoveFile(sourcefile, targetfile) = True Then
File_Delete(BackUpOfFileToReplace)
ClassLogger.Add(String.Format("...targetfile '{0}' was replaced! ", targetfile), False)
Dim updinfo
If USER_INFO1 <> "" Then
updinfo = USER_INFO1 & ";" & Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
Else
updinfo = Upd_item.Item("INFO1") & "V" & Upd_item.Item("INFO2")
End If
Dim _Sql = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET INFO1 = '{2}' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer", updinfo)
clsDatabase.Execute_non_Query(_Sql)
Else
ClassLogger.Add(String.Format("MoveFile was not successfull! BackupFile will be activated!"))
'Verschieben hat nicht geklappt also die Backupdatei wieder umbenennen!
File_Rename(BackUpOfFileToReplace, targetfile)
End If
End If
End If
End If
Else
End If
Catch ex As Exception
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
error_while_copying = True
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, sourcefile, targetfile))
error_while_replacing = True
UPDATE_ERROR = True
End Try
Catch ex As Exception
ClassLogger.Add(String.Format("Unexpected Error in Replace_Files: {0}", ex.Message))
UPDATE_ERROR = True
End Try
Else
ClassLogger.Add(String.Format("UpdateFile {0} is not existing or accessible", updatefile2copy))
End If
Next
If error_while_copying = False Then
Replace_Files()
End If
Dim upd = String.Format("Update TBDD_VERSION_USER_UPDATE_PATH SET TEMPPATH = '' WHERE USER_ID = {0} AND UPPER(MODULE_NAME) = UPPER('{1}')", USER_GUID, "Record-Organizer")
clsDatabase.Execute_non_Query(upd)
Try
If KEEP_TEMPPATH = False Then
'Delete the tempfolder and all data
System.IO.Directory.Delete(FOLDER_TEMP, True)
Else
ClassLogger.Add(String.Format("TEMP FOLDER SHALL BE KEPT..."), False)
End If
Catch ex As Exception
End Try
Else
ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
End If
'Else
' ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
'End If
Else
ClassLogger.Add(String.Format("The Updatepath '{0}'is not accessible or does not exist", MyServer_UpdatePath))
End If
@ -248,64 +345,6 @@ Public Class ClassUpdate
End Try
End Function
Private Shared Sub Replace_Files()
Try
'Jede Datei im tempfolder wird replaced
Dim di As New DirectoryInfo(FOLDER_TEMP)
' Get a reference to each file in that directory.
Dim fiArr As FileInfo() = di.GetFiles()
' Display the names of the files.
' Dim fri As FileInfo
Dim error_while_replacing = False
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
Dim BackUpOfFileToReplace As String = MY_INSTALL_PATH & "\" & Upd_item.Item("INFO1") & Upd_item.Item("ITEM_INFO") & ".bac"
BackUpOfFileToReplace = BackUpOfFileToReplace.Replace("//", "/")
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
Dim targetfile
If IsDBNull(Upd_item.Item("INFO1")) Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
Else
If Upd_item.Item("INFO1") <> String.Empty Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
Else
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
End If
End If
targetfile = targetfile.ToString.Replace("//", "/")
Try
' Replace the file.
If File.Exists(targetfile) Then
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
If File.Exists(BackUpOfFileToReplace) Then
If MoveFile(sourcefile, targetfile) = True Then
File_Delete(BackUpOfFileToReplace)
Else
'Verschieben hat nicht geklappt also die Backupdatei wieder umbenennen!
File_Rename(BackUpOfFileToReplace, targetfile)
End If
End If
End If
Else
MoveFile(sourcefile, targetfile)
End If
Catch ex As Exception
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, sourcefile, targetfile))
error_while_replacing = True
UPDATE_ERROR = True
End Try
Next
Catch ex As Exception
ClassLogger.Add(String.Format("Unexpected Error in Replace_Files: {0}", ex.Message))
UPDATE_ERROR = True
End Try
End Sub
Private Shared Function File_Rename(targetfile As String, Renamefilestring As String)
Try
Renamefilestring = Renamefilestring.Replace("\\", "\")
@ -343,4 +382,14 @@ Public Class ClassUpdate
Return False
End Try
End Function
Private Shared Function CopyFile(sourcefile As String, destfile As String)
Try
File.Copy(sourcefile, destfile, True)
Return True
Catch ex As Exception
ClassLogger.Add(String.Format("Unexpected Error in CopyFile: sourcefile '{0}', destfile '{1}' - ERROR: {2}", sourcefile, destfile, ex.Message))
UPDATE_ERROR = True
Return False
End Try
End Function
End Class

View File

@ -14,7 +14,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("ADDI - Akte der Dinge")>
<Assembly: AssemblyCopyright("Copyright © 2015")>
<Assembly: AssemblyCopyright("Copyright © 2017")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>

View File

@ -570,6 +570,16 @@ Public Class frmMain
If result = MsgBoxResult.Yes Then
Process.Start(ClassLogger.DateiSpeicherort)
End If
Else
If ClassUpdate.UPDATE_NECESSARY Then
Dim msg = "Das Addon-Update war erfolgreich!"
If USER_LANGUAGE <> "de-DE" Then
msg = "The Addon-Update was successful!"
End If
MsgBox(msg, MsgBoxStyle.Information)
End If
End If
End If
End If

View File

@ -94,7 +94,7 @@ Public Class frmVersionCheck
GetTempFolderGuid()
If FOLDER_TEMP <> String.Empty Then
myRow = 94
bw.ReportProgress(CalcProgress(5), "Copying files to tempfolder")
bw.ReportProgress(CalcProgress(5), "...Copying files to tempfolder")
' Make a reference to a directory.
Dim di As New DirectoryInfo(MyServer_UpdatePath)
' Get a reference to each file in that directory.
@ -103,6 +103,7 @@ Public Class frmVersionCheck
'Dim fri As FileInfo
Dim error_while_copying = False
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
ClassLogger.Add(String.Format("...working on item '{0}': ", Upd_item.Item("ITEM_INFO")), False)
If error_while_copying = True Then
Exit For
End If
@ -113,6 +114,7 @@ Public Class frmVersionCheck
If File.Exists(updatefile2copy) Then
Try
System.IO.File.Copy(updatefile2copy, tempfilename)
ClassLogger.Add(String.Format("...item '{0}' was successfully copied", updatefile2copy), False)
Catch ex As Exception
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
error_while_copying = True
@ -128,8 +130,21 @@ Public Class frmVersionCheck
End If
Try
Dim upd = String.Format("UPDATE TBDD_VERSION_USER_UPDATE_PATH SET TEMPPATH = '{0}' WHERE USER_ID = {1} AND UPPER(MODULE_NAME) = UPPER('{2}')", FOLDER_TEMP, USER_GUID, "Record-Organizer")
clsDatabase.Execute_Scalar(upd)
For Each Upd_item As DataRow In DT_UPDATE_ITEMS.Rows
If IsDBNull(Upd_item.Item("INFO")) Then
Dim tempfilename = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
Try
System.IO.File.Delete(tempfilename)
Catch ex As Exception
ClassLogger.Add(String.Format("Unexpected Error in deleting tempfile '{0}': " & ex.Message, tempfilename))
End Try
End If
Next
'Delete the tempfolder and all data
System.IO.Directory.Delete(FOLDER_TEMP, True)
' System.IO.Directory.Delete(FOLDER_TEMP, True)
Catch ex As Exception
End Try
@ -155,7 +170,6 @@ Public Class frmVersionCheck
End Sub
Sub Replace_Files()
Try
'Jede Datei im tempfolder wird replaced
Dim di As New DirectoryInfo(FOLDER_TEMP)
' Get a reference to each file in that directory.
@ -169,13 +183,15 @@ Public Class frmVersionCheck
Dim sourcefile = Path.Combine(FOLDER_TEMP, Upd_item.Item("ITEM_INFO"))
sourcefile = sourcefile.ToString.Replace("\\", "\")
Dim targetfile
ClassLogger.Add(String.Format("...working (replacing) on item '{0}': ", Upd_item.Item("ITEM_INFO")), False)
If IsDBNull(Upd_item.Item("INFO1")) Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
Else
If Upd_item.Item("INFO1") <> String.Empty Then
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
If Upd_item.Item("INFO1") = String.Empty Then
Continue For
Else
targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("ITEM_INFO"))
' targetfile = Path.Combine(MY_INSTALL_PATH, Upd_item.Item("INFO1"), Upd_item.Item("ITEM_INFO"))
End If
End If