ATEZ Integration MIC, TC, MODAL

This commit is contained in:
2026-10-06 09:23:25 +02:00
parent 1c1af724c2
commit d702783d1b
34 changed files with 8588 additions and 571 deletions

View File

@@ -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())