ATEZ Integration MIC, TC, MODAL
This commit is contained in:
@@ -1 +1 @@
|
||||
7.4
|
||||
7.5
|
||||
@@ -114,14 +114,25 @@ Public Class UPDATERfrm
|
||||
|
||||
' If Not cut_file(File).Contains("AVISOUPDATER") And Not cut_file(File).Contains("NOT_DEL_") Then
|
||||
|
||||
'----------------------------------------
|
||||
'If CopyIncremental Then
|
||||
' cProgrammeUpdate.copyProgramLIST(F, AppDomain.CurrentDomain.BaseDirectory, {"AVISOUPDATER", "NOT_DEL_", "Standort.txt"})
|
||||
'Else
|
||||
' delFiles()
|
||||
' FileCopier()
|
||||
'End If
|
||||
'----------------------------------------
|
||||
|
||||
If CopyIncremental Then
|
||||
cProgrammeUpdate.copyProgramLIST(F, AppDomain.CurrentDomain.BaseDirectory, {"AVISOUPDATER", "NOT_DEL_", "Standort.txt"})
|
||||
|
||||
cProgrammeUpdate.copyProgramLIST(F, AppDomain.CurrentDomain.BaseDirectory, {"AVISOUPDATER", "NOT_DEL_", "Standort.txt"}, AddressOf UpdateProgress)
|
||||
|
||||
Else
|
||||
|
||||
delFiles()
|
||||
FileCopier()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If Not System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory & "AVISO.exe") Then
|
||||
@@ -146,6 +157,37 @@ Public Class UPDATERfrm
|
||||
Environment.Exit(0)
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateProgress(percent As Integer, status As String)
|
||||
|
||||
If Me.InvokeRequired Then
|
||||
|
||||
Me.Invoke(
|
||||
New Action(Of Integer, String)(AddressOf UpdateProgress),
|
||||
percent,
|
||||
status
|
||||
)
|
||||
|
||||
Return
|
||||
|
||||
End If
|
||||
|
||||
|
||||
percent = Math.Max(0, Math.Min(100, percent))
|
||||
|
||||
ProgressBar.Minimum = 0
|
||||
ProgressBar.Maximum = 100
|
||||
ProgressBar.Value = percent
|
||||
|
||||
m_Label.Text = percent.ToString() & "%"
|
||||
|
||||
If status <> "" Then
|
||||
RichTextBox.AppendText(status & Environment.NewLine)
|
||||
RichTextBox.SelectionStart = RichTextBox.TextLength
|
||||
RichTextBox.ScrollToCaret()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Function getFByIP() As String
|
||||
Dim default_F = ""
|
||||
getFByIP = ""
|
||||
@@ -490,6 +532,33 @@ Public Class UPDATERfrm
|
||||
Return bAns
|
||||
End Function
|
||||
|
||||
Private Sub SetProgress(value As Integer, Optional status As String = "")
|
||||
If Me.InvokeRequired Then
|
||||
Me.Invoke(New Action(Of Integer, String)(AddressOf SetProgress), value, status)
|
||||
Return
|
||||
End If
|
||||
|
||||
value = Math.Max(0, Math.Min(100, value))
|
||||
|
||||
ProgressBar.Minimum = 0
|
||||
ProgressBar.Maximum = 100
|
||||
ProgressBar.Value = value
|
||||
|
||||
m_Label.Text = value.ToString() & "%"
|
||||
|
||||
If status <> "" Then
|
||||
writeLine(RichTextBox, "[" & value.ToString() & "%] " & status)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub SetStatus(text As String)
|
||||
If Me.InvokeRequired Then
|
||||
Me.Invoke(New Action(Of String)(AddressOf SetStatus), text)
|
||||
Return
|
||||
End If
|
||||
|
||||
writeLine(RichTextBox, text)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -51,76 +51,251 @@ Public Class cProgrammeUpdate
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function copyProgramLIST(ByRef sourcePfad As String, ByVal destPfad As String, ignoreFilesBeginWith As String()) As Boolean
|
||||
Public Shared Function copyProgramLIST(ByRef sourcePfad As String, ByVal destPfad As String, ignoreFilesBeginWith As String(), Optional progressCallback As Action(Of Integer, String) = Nothing) As Boolean
|
||||
|
||||
Try
|
||||
|
||||
If destPfad.Trim = "" Then Return False
|
||||
If sourcePfad.Trim = "" Then Return False
|
||||
|
||||
If Not My.Computer.FileSystem.DirectoryExists(sourcePfad) Then
|
||||
MsgBox("ERROR_COPY_01: Quell-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
|
||||
MsgBox("ERROR_COPY_01: Quell-Ordner existiert nicht.",
|
||||
MsgBoxStyle.Critical, "ERROR")
|
||||
Return False
|
||||
End If
|
||||
|
||||
If Not My.Computer.FileSystem.DirectoryExists(destPfad) Then
|
||||
MsgBox("ERROR_COPY_02: Ziel-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
|
||||
MsgBox("ERROR_COPY_02: Ziel-Ordner existiert nicht.",
|
||||
MsgBoxStyle.Critical, "ERROR")
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
'--------------------------------------------------
|
||||
' DATEILISTEN ERMITTELN
|
||||
'--------------------------------------------------
|
||||
|
||||
progressCallback?.Invoke(0, "Dateien werden geprüft...")
|
||||
|
||||
Dim LIST_SOURCE As New List(Of cProgrammeUpdate)
|
||||
Dim dirNameReplace_SOURCE = ""
|
||||
|
||||
Dim DI_SOURCE As New IO.DirectoryInfo(sourcePfad)
|
||||
RekursivGetFiles(DI_SOURCE, dirNameReplace_SOURCE, LIST_SOURCE, {})
|
||||
|
||||
RekursivGetFiles(
|
||||
DI_SOURCE,
|
||||
dirNameReplace_SOURCE,
|
||||
LIST_SOURCE,
|
||||
{}
|
||||
)
|
||||
|
||||
|
||||
Dim LIST_DEST As New List(Of cProgrammeUpdate)
|
||||
Dim dirNameReplace_DEST = ""
|
||||
|
||||
Dim DI_DEST As New IO.DirectoryInfo(destPfad)
|
||||
RekursivGetFiles(DI_DEST, dirNameReplace_DEST, LIST_DEST, ignoreFilesBeginWith)
|
||||
|
||||
RekursivGetFiles(
|
||||
DI_DEST,
|
||||
dirNameReplace_DEST,
|
||||
LIST_DEST,
|
||||
ignoreFilesBeginWith
|
||||
)
|
||||
|
||||
|
||||
If LIST_SOURCE.Count = 0 Then
|
||||
MsgBox("ERROR_COPY_01: Quell-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
|
||||
MsgBox("ERROR_COPY_01: Quell-Daten existiert nicht.",
|
||||
MsgBoxStyle.Critical, "ERROR")
|
||||
Return False
|
||||
End If
|
||||
|
||||
If LIST_DEST.Count = 0 Then
|
||||
MsgBox("ERROR_COPY_02: Ziel-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
|
||||
MsgBox("ERROR_COPY_02: Ziel-Daten existiert nicht.",
|
||||
MsgBoxStyle.Critical, "ERROR")
|
||||
Return False
|
||||
End If
|
||||
|
||||
'ORDNER erstellen:
|
||||
|
||||
'--------------------------------------------------
|
||||
' ORDNER ERSTELLEN
|
||||
'--------------------------------------------------
|
||||
|
||||
For Each f In LIST_SOURCE
|
||||
|
||||
If If(f.pud_filePathFolder, "") <> "" Then
|
||||
If Not IO.Directory.Exists(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\")) Then
|
||||
IO.Directory.CreateDirectory(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\"))
|
||||
|
||||
Dim folder =
|
||||
dirNameReplace_DEST & "\" &
|
||||
f.pud_filePathFolder.Replace("\\", "\")
|
||||
|
||||
If Not IO.Directory.Exists(folder) Then
|
||||
IO.Directory.CreateDirectory(folder)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
'Löschen der unbenötigten Files:
|
||||
|
||||
'--------------------------------------------------
|
||||
' NICHT MEHR BENÖTIGTE DATEIEN LÖSCHEN
|
||||
'--------------------------------------------------
|
||||
|
||||
For Each f In LIST_DEST
|
||||
|
||||
If isOldFile(f, LIST_SOURCE) Then
|
||||
IO.File.Delete(dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\"))
|
||||
|
||||
Dim d_path =
|
||||
dirNameReplace_DEST & "\" &
|
||||
If(f.pud_filePathFolder, "") & "\" &
|
||||
f.pud_fileName.Replace("\\", "\")
|
||||
|
||||
IO.File.Delete(d_path)
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
'Kopieren/Überschreiben der neuen Files:
|
||||
For Each f In LIST_SOURCE
|
||||
If isNewFile(f, LIST_DEST) Then
|
||||
'Dim FI = New IO.FileInfo()
|
||||
|
||||
Dim s_path = dirNameReplace_SOURCE & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
|
||||
Dim d_path = dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
|
||||
If fileStartsWith(f.pud_fileName, ignoreFilesBeginWith) And IO.File.Exists(d_path) Then
|
||||
'Wenn Ziel-Date in der ignore-List und die Datei existiert auch, soll diese nicht kopiert werden.
|
||||
'Wenn Sie nicht exisistiert wir die Datei schon kopiert (zB Standort.txt)
|
||||
'--------------------------------------------------
|
||||
' ERMITTELN, WELCHE DATEIEN TATSÄCHLICH
|
||||
' KOPIERT WERDEN MÜSSEN
|
||||
'--------------------------------------------------
|
||||
|
||||
Dim filesToCopy As New List(Of cProgrammeUpdate)
|
||||
|
||||
For Each f In LIST_SOURCE
|
||||
|
||||
'Bestehende Logik bleibt unverändert!
|
||||
If isNewFile(f, LIST_DEST) Then
|
||||
|
||||
Dim d_path =
|
||||
dirNameReplace_DEST & "\" &
|
||||
If(f.pud_filePathFolder, "") & "\" &
|
||||
f.pud_fileName.Replace("\\", "\")
|
||||
|
||||
'Bestehende Ignore-Logik bleibt ebenfalls erhalten
|
||||
If fileStartsWith(f.pud_fileName, ignoreFilesBeginWith) AndAlso
|
||||
IO.File.Exists(d_path) Then
|
||||
|
||||
'Nicht kopieren
|
||||
|
||||
Else
|
||||
|
||||
IO.File.Copy(s_path, d_path, True)
|
||||
filesToCopy.Add(f)
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
'--------------------------------------------------
|
||||
' NICHTS ZU KOPIEREN
|
||||
'--------------------------------------------------
|
||||
|
||||
If filesToCopy.Count = 0 Then
|
||||
|
||||
progressCallback?.Invoke(
|
||||
100,
|
||||
"Alle Dateien sind aktuell."
|
||||
)
|
||||
|
||||
Return True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
'--------------------------------------------------
|
||||
' DATEIEN KOPIEREN
|
||||
'--------------------------------------------------
|
||||
|
||||
Dim current As Integer = 0
|
||||
Dim total As Integer = filesToCopy.Count
|
||||
|
||||
For Each f In filesToCopy
|
||||
|
||||
current += 1
|
||||
|
||||
Dim s_path =
|
||||
dirNameReplace_SOURCE & "\" &
|
||||
If(f.pud_filePathFolder, "") & "\" &
|
||||
f.pud_fileName.Replace("\\", "\")
|
||||
|
||||
Dim d_path =
|
||||
dirNameReplace_DEST & "\" &
|
||||
If(f.pud_filePathFolder, "") & "\" &
|
||||
f.pud_fileName.Replace("\\", "\")
|
||||
|
||||
|
||||
'Relativen Dateinamen für Anzeige erstellen
|
||||
Dim displayFile As String = ""
|
||||
|
||||
If If(f.pud_filePathFolder, "") <> "" Then
|
||||
displayFile =
|
||||
f.pud_filePathFolder.TrimStart("\"c) &
|
||||
"\" &
|
||||
f.pud_fileName
|
||||
Else
|
||||
displayFile = f.pud_fileName
|
||||
End If
|
||||
|
||||
|
||||
'Fortschritt berechnen
|
||||
Dim percent As Integer =
|
||||
CInt(((current - 1) / CDbl(total)) * 100)
|
||||
|
||||
|
||||
'Vor dem Kopieren melden
|
||||
progressCallback?.Invoke(
|
||||
percent,
|
||||
"Kopiere: " & displayFile
|
||||
)
|
||||
|
||||
|
||||
'==================================================
|
||||
' EIGENTLICHER KOPIERVORGANG
|
||||
'==================================================
|
||||
|
||||
IO.File.Copy(
|
||||
s_path,
|
||||
d_path,
|
||||
True
|
||||
)
|
||||
|
||||
|
||||
'Fortschritt nach dem Kopieren
|
||||
percent =
|
||||
CInt((current / CDbl(total)) * 100)
|
||||
|
||||
progressCallback?.Invoke(
|
||||
percent,
|
||||
"Kopiert: " & displayFile
|
||||
)
|
||||
|
||||
Next
|
||||
|
||||
|
||||
progressCallback?.Invoke(
|
||||
100,
|
||||
"Update abgeschlossen. " &
|
||||
filesToCopy.Count.ToString() &
|
||||
" Datei(en) aktualisiert."
|
||||
)
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
|
||||
Return False
|
||||
|
||||
End Try
|
||||
' If isNewFile(destPfad) Then Return FileCopier(sourcePfad, destPfad)
|
||||
|
||||
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function fileStartsWith(fileName As String, ignoreFilesBeginWith As String())
|
||||
|
||||
Reference in New Issue
Block a user