MS-KW39 Änderungen UpdateClass und VersionChecker
This commit is contained in:
@@ -65,7 +65,7 @@ Public Class frmVersionCheck
|
||||
FORCE_UPDATE = True
|
||||
End If
|
||||
End If
|
||||
ClassLogger.Add("Using VersionChecker-Version: " & Application.ProductVersion.ToString, False)
|
||||
ClassLogger.Add(" Using VersionChecker-Version: " & Application.ProductVersion.ToString, False)
|
||||
If FORCE_UPDATE = False Then
|
||||
myRow = 68
|
||||
If ALL_USERS = False Then
|
||||
@@ -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,19 +183,21 @@ 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
|
||||
|
||||
targetfile = targetfile.ToString.Replace("\\", "\")
|
||||
Try
|
||||
' Replace the file.
|
||||
'Replace the file.
|
||||
If File.Exists(targetfile) Then
|
||||
If File_Rename(targetfile, BackUpOfFileToReplace) = True Then
|
||||
If File.Exists(BackUpOfFileToReplace) Then
|
||||
|
||||
Reference in New Issue
Block a user