MS
This commit is contained in:
@@ -8,6 +8,7 @@ Public Class frmVersionCheck
|
||||
Private mainForm As Form
|
||||
Private UPDATE_NECESSARY As Boolean = False
|
||||
Private UPDATE_CANCELLED As Boolean = False
|
||||
Private Shared myRow As String
|
||||
Private Sub InitProgram()
|
||||
bw.WorkerReportsProgress = True
|
||||
AddHandler bw.DoWork, AddressOf bw_DoWork
|
||||
@@ -29,40 +30,51 @@ Public Class frmVersionCheck
|
||||
Dim Init = New ClassInit()
|
||||
bw.ReportProgress(CalcProgress(1), "Initializing Logger")
|
||||
Init.InitLogger()
|
||||
myRow = 33
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing MySettings")
|
||||
MySettings_Load()
|
||||
myRow = 37
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(2), "Initializing Database")
|
||||
If Init.InitDatabase() = True Then
|
||||
myRow = 41
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(3), "Initializing Basic-Configuration")
|
||||
Init.InitBasics()
|
||||
myRow = 45
|
||||
System.Threading.Thread.Sleep(200)
|
||||
bw.ReportProgress(CalcProgress(4), "Initializing User-Configuration")
|
||||
If ClassInit.InitUser = False Then
|
||||
Exit Sub
|
||||
Else
|
||||
myRow = 51
|
||||
VERSION_USER = CInt(VERSION_USER.ToString.Replace(".", ""))
|
||||
VERSION_SERVER = CInt(VERSION_SERVER.ToString.Replace(".", ""))
|
||||
myRow = 54
|
||||
If (VERSION_USER = VERSION_SERVER) Or VERSION_SERVER = 1000 Or VERSION_USER = 1000 Then
|
||||
Exit Sub
|
||||
End If
|
||||
UPDATE_NECESSARY = True
|
||||
If FORCE_UPDATE = False Then
|
||||
myRow = 60
|
||||
If VERSIONS_FOR_FORCE_UPDATE.Contains(VERSION_USER) Then
|
||||
myRow = 62
|
||||
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
|
||||
myRow = 68
|
||||
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
|
||||
myRow = 73
|
||||
ClassInit.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
|
||||
myRow = 77
|
||||
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!"
|
||||
@@ -74,11 +86,12 @@ Public Class frmVersionCheck
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
myRow = 89
|
||||
If MyServer_UpdatePath <> String.Empty Then
|
||||
If Directory.Exists(MyServer_UpdatePath) Then
|
||||
GetTempFolderGuid()
|
||||
If FOLDER_TEMP <> String.Empty Then
|
||||
myRow = 94
|
||||
bw.ReportProgress(CalcProgress(5), "Copying files to tempfolder")
|
||||
' Make a reference to a directory.
|
||||
Dim di As New DirectoryInfo(MyServer_UpdatePath)
|
||||
@@ -104,9 +117,10 @@ Public Class frmVersionCheck
|
||||
ClassLogger.Add(String.Format("UpdateFile {0} is not existing or accessible", updatefile2copy))
|
||||
End If
|
||||
Next
|
||||
|
||||
myRow = "120 - Copying finished"
|
||||
If error_while_copying = False Then
|
||||
Replace_Files()
|
||||
|
||||
End If
|
||||
|
||||
Try
|
||||
@@ -131,7 +145,7 @@ Public Class frmVersionCheck
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(String.Format(">> Unexpected Error in bwDoWork: " & ex.Message))
|
||||
ClassLogger.Add(ex.StackTrace)
|
||||
ClassLogger.Add("myRow: " & myRow, False)
|
||||
End Try
|
||||
End Sub
|
||||
Sub Replace_Files()
|
||||
@@ -178,6 +192,7 @@ Public Class frmVersionCheck
|
||||
ClassLogger.Add(String.Format("Error while copying file {0} to {1}: " & ex.Message, sourcefile, targetfile))
|
||||
error_while_replacing = True
|
||||
End Try
|
||||
myRow = "195 - Moving/Replacing finished"
|
||||
Next
|
||||
'For Each fri In fiArr
|
||||
' If error_while_replacing = True Then
|
||||
@@ -220,17 +235,22 @@ Public Class frmVersionCheck
|
||||
ClassLogger.Add(String.Format("Unexpected Error in Replace_Files: {0}", ex.Message))
|
||||
End Try
|
||||
End Sub
|
||||
Private Shared Function File_Rename(targetfile As String, BackUpOfFileToReplace As String)
|
||||
Private Shared Function File_Rename(targetfile As String, Renamefilestring As String)
|
||||
Try
|
||||
If File.Exists(BackUpOfFileToReplace) Then
|
||||
If File_Delete(BackUpOfFileToReplace) = False Then
|
||||
myRow = "240"
|
||||
Renamefilestring = Renamefilestring.Replace("\\", "\")
|
||||
If File.Exists(Renamefilestring) Then
|
||||
myRow = "242"
|
||||
If File_Delete(Renamefilestring) = False Then
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Rename(targetfile, BackUpOfFileToReplace)
|
||||
myRow = "248"
|
||||
Rename(targetfile, Renamefilestring)
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(String.Format("Unexpected Error in File_Rename: " & vbNewLine & "targetfile '{0}'" & vbNewLine & "BackUpOfFileToReplace '{1}'" & vbNewLine & "ERROR: {2}", targetfile, BackUpOfFileToReplace, ex.Message))
|
||||
ClassLogger.Add(String.Format("Unexpected Error in File_Rename: " & "targetfile '{0}'" & "Renamefilestring '{1}'" & "ERROR: {2}", targetfile, Renamefilestring, ex.Message))
|
||||
ClassLogger.Add("myRow: " & myRow.ToString, False)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@@ -256,12 +276,15 @@ Public Class frmVersionCheck
|
||||
Dim filename = ""
|
||||
Try
|
||||
Dim PMO_PATH = System.IO.Path.Combine(MY_INSTALL_PATH, "DD-Record-Organizer.exe")
|
||||
myRow = "274"
|
||||
Dim startInfo As New ProcessStartInfo()
|
||||
startInfo.Arguments = """" & MyConnectionString & """"
|
||||
filename = startInfo.FileName
|
||||
|
||||
If System.IO.File.Exists(PMO_PATH) Then
|
||||
myRow = "280"
|
||||
startInfo.FileName = PMO_PATH
|
||||
myRow = "282 - " & PMO_PATH
|
||||
Process.Start(startInfo)
|
||||
Else
|
||||
MsgBox("Can not find ADDI-Executable in regular path! Please inform your systemadmin.", MsgBoxStyle.Critical)
|
||||
@@ -271,6 +294,7 @@ Public Class frmVersionCheck
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Could not find RecordOrganizer: " & filename & " - " & ex.Message)
|
||||
ClassLogger.Add("myRow: " & myRow.ToString, False)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
@@ -288,32 +312,38 @@ Public Class frmVersionCheck
|
||||
End Function
|
||||
|
||||
Private Sub frmVersionCheck_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
If ERROR_WHILE_UPDATING = True Then
|
||||
Dim msg = String.Format("Während des Updatevorgangs für Version '{0}' haben sich unerwartet Fehler ereignet!" & vbNewLine & "Wollen Sie die Logdatei anzeigen?", VERSION_SERVER)
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = String.Format("During update of version '{0}' unexpected errors occured!" & vbNewLine & "Would You like to show the logfile?", VERSION_SERVER)
|
||||
End If
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("Unexpected errors occured during client-update update of version {0}!", VERSION_SERVER))
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.Yes Then
|
||||
Process.Start(ClassLogger.DateiSpeicherort)
|
||||
End If
|
||||
Else
|
||||
If UPDATE_NECESSARY = True Then
|
||||
If UPDATE_CANCELLED = True Then
|
||||
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("The ClientUpdate {0} is necessary but user cancelled update-process!", VERSION_SERVER))
|
||||
End If
|
||||
Else
|
||||
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("The ClientUpdate {0} was completed without errors!", VERSION_SERVER))
|
||||
End If
|
||||
Try
|
||||
If ERROR_WHILE_UPDATING = True Then
|
||||
myRow = "308 - ERROR_WHILE_UPDATING"
|
||||
Dim msg = String.Format("Während des Updatevorgangs für Version '{0}' haben sich unerwartet Fehler ereignet!" & vbNewLine & "Wollen Sie die Logdatei anzeigen?", VERSION_SERVER)
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = String.Format("During update of version '{0}' unexpected errors occured!" & vbNewLine & "Would You like to show the logfile?", VERSION_SERVER)
|
||||
End If
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("Unexpected errors occured during client-update update of version {0}!", VERSION_SERVER))
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.Yes Then
|
||||
Process.Start(ClassLogger.DateiSpeicherort)
|
||||
End If
|
||||
Else
|
||||
If UPDATE_NECESSARY = True Then
|
||||
If UPDATE_CANCELLED = True Then
|
||||
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("The ClientUpdate {0} is necessary but user cancelled update-process!", VERSION_SERVER))
|
||||
End If
|
||||
Else
|
||||
If clsDatabase.DB_DEFAULT_INITIALIZED = True Then
|
||||
ClassInit.InsertEssential_Log(USER_GUID, "USER-ID", String.Format("The ClientUpdate {0} was completed without errors!", VERSION_SERVER))
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in FormClosing" & ex.Message)
|
||||
End Try
|
||||
|
||||
|
||||
Start_RO()
|
||||
End Sub
|
||||
Private Sub frmVersionCheck_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
|
||||
Reference in New Issue
Block a user