ms
This commit is contained in:
@@ -23,107 +23,109 @@ Public Class frmVersionCheck
|
||||
Return _step * (100 / InitSteps)
|
||||
End Function
|
||||
Private Sub bw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
|
||||
Dim JUMP_UPDATE As Boolean = False
|
||||
'Try
|
||||
Dim Init = New ClassInit()
|
||||
bw.ReportProgress(CalcProgress(1), "Initializing Logger")
|
||||
Init.InitLogger()
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing MySettings")
|
||||
MySettings_Load()
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(2), "Initializing Database")
|
||||
If Init.InitDatabase() = True Then
|
||||
Try
|
||||
Dim JUMP_UPDATE As Boolean = False
|
||||
'Try
|
||||
Dim Init = New ClassInit()
|
||||
bw.ReportProgress(CalcProgress(1), "Initializing Logger")
|
||||
Init.InitLogger()
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing Basic-Configuration")
|
||||
Init.InitBasics()
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing MySettings")
|
||||
MySettings_Load()
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(4), "Initializing User-Configuration")
|
||||
If ClassInit.InitUser = False Then
|
||||
Exit Sub
|
||||
Else
|
||||
VERSION_USER = CInt(VERSION_USER.ToString.Replace(".", ""))
|
||||
VERSION_SERVER = CInt(VERSION_SERVER.ToString.Replace(".", ""))
|
||||
If VERSION_USER = VERSION_SERVER Then
|
||||
bw.ReportProgress(CalcProgress(2), "Initializing Database")
|
||||
If Init.InitDatabase() = True Then
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing Basic-Configuration")
|
||||
Init.InitBasics()
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(4), "Initializing User-Configuration")
|
||||
If ClassInit.InitUser = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
UPDATE_NECESSARY = True
|
||||
If FORCE_UPDATE = False Then
|
||||
If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
|
||||
ClassInit.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
|
||||
Dim msg = "Auf dem Server liegt ein Update für ADDI 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 ADDI!" & vbNewLine & "Would You like to install the update now? This might take some minutes!"
|
||||
End If
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.No Then
|
||||
UPDATE_CANCELLED = True
|
||||
Else
|
||||
VERSION_USER = CInt(VERSION_USER.ToString.Replace(".", ""))
|
||||
VERSION_SERVER = CInt(VERSION_SERVER.ToString.Replace(".", ""))
|
||||
If VERSION_USER = VERSION_SERVER Then
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
UPDATE_NECESSARY = True
|
||||
If FORCE_UPDATE = False Then
|
||||
If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
|
||||
ClassInit.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
|
||||
Dim msg = "Auf dem Server liegt ein Update für ADDI 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 ADDI!" & vbNewLine & "Would You like to install the update now? This might take some minutes!"
|
||||
End If
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.No Then
|
||||
UPDATE_CANCELLED = True
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If MyServer_UpdatePath <> String.Empty Then
|
||||
If Directory.Exists(MyServer_UpdatePath) Then
|
||||
GetTempFolderGuid()
|
||||
If FOLDER_TEMP <> String.Empty Then
|
||||
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.
|
||||
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
|
||||
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
|
||||
Try
|
||||
System.IO.File.Copy(updatefile2copy, tempfilename)
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
|
||||
error_while_copying = True
|
||||
End Try
|
||||
Else
|
||||
ClassLogger.Add(String.Format("UpdateFile {0} is not existing or accessible", updatefile2copy))
|
||||
End If
|
||||
Next
|
||||
If MyServer_UpdatePath <> String.Empty Then
|
||||
If Directory.Exists(MyServer_UpdatePath) Then
|
||||
GetTempFolderGuid()
|
||||
If FOLDER_TEMP <> String.Empty Then
|
||||
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.
|
||||
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
|
||||
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
|
||||
Try
|
||||
System.IO.File.Copy(updatefile2copy, tempfilename)
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, updatefile2copy, tempfilename))
|
||||
error_while_copying = 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()
|
||||
If error_while_copying = False Then
|
||||
Replace_Files()
|
||||
End If
|
||||
|
||||
Try
|
||||
'Delete the tempfolder and all data
|
||||
System.IO.Directory.Delete(FOLDER_TEMP, True)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
Else
|
||||
ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
|
||||
End If
|
||||
|
||||
Try
|
||||
'Delete the tempfolder and all data
|
||||
System.IO.Directory.Delete(FOLDER_TEMP, True)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
Else
|
||||
ClassLogger.Add(String.Format("The temporaryFolder could not be created!"))
|
||||
ClassLogger.Add(String.Format("The Updatepath '{0}'is not accessible or does not exist", MyServer_UpdatePath))
|
||||
End If
|
||||
Else
|
||||
ClassLogger.Add(String.Format("The Updatepath '{0}'is not accessible or does not exist", MyServer_UpdatePath))
|
||||
ClassLogger.Add(String.Format("NO ACTION: the Updatepath is empty"))
|
||||
End If
|
||||
Else
|
||||
ClassLogger.Add(String.Format("NO ACTION: the Updatepath is empty"))
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
ClassLogger.Add(String.Format(">> Database was not intialized!"), False)
|
||||
End If
|
||||
'Catch ex As Exception
|
||||
' MsgBox("Unexpected Error in Init Classes: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
'End Try
|
||||
Else
|
||||
ClassLogger.Add(String.Format(">> Database was not intialized!"), False)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(String.Format(">> Unexpected Error in bwDoWork: " & ex.Message))
|
||||
ClassLogger.Add(ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
Sub Replace_Files()
|
||||
Try
|
||||
@@ -314,13 +316,6 @@ Public Class frmVersionCheck
|
||||
End Sub
|
||||
|
||||
Private Sub bw_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
|
||||
' Bei Fehler MsgBox anzeigen und Programm beenden
|
||||
If e.Error IsNot Nothing Then
|
||||
MsgBox(e.Error.Message, MsgBoxStyle.Critical, "Unexpected Error in frmSplash")
|
||||
Application.Exit()
|
||||
End If
|
||||
|
||||
' Wenn kein Fehler, Splashscreen schließen
|
||||
Me.Close()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user