Compare commits
3 Commits
c54f750705
...
2.9.8-Rele
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afbe60cac5 | ||
|
|
4e72f0a10a | ||
|
|
8f38212ae4 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1092,7 +1092,10 @@ Public Class ClassNIWindream
|
||||
|
||||
targetpath = targetpath.Replace("\\", "\")
|
||||
Const WMEntityDocument = 1
|
||||
|
||||
If targetpath.Length >= 256 Then
|
||||
_Logger.Info($"⚠️ WARNING: Error in NEW_MOVE_FILE - targetpath is too long [{targetpath}]")
|
||||
Return False
|
||||
End If
|
||||
_Logger.Debug($"getting WMObject for: {sourcepath}")
|
||||
Try
|
||||
oWMFile = oWMSession.GetWMObjectByPath(WMEntityDocument, sourcepath)
|
||||
@@ -1115,8 +1118,9 @@ Public Class ClassNIWindream
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Warn($"Error in NEW_MOVE_FILE pFileName: [{pFileName}] - targetpath: [{targetpath}]")
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn($"Error in NEW_MOVE_FILE pFileName [{pFileName}] - [{targetpath}]")
|
||||
|
||||
If Not IsNothing(oWMFile) Then
|
||||
oWMFile.unlock()
|
||||
End If
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.10.4.0")>
|
||||
<Assembly: AssemblyVersion("2.11.11.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.9.0")>
|
||||
|
||||
@@ -313,8 +313,11 @@ Public Class frmNIHauptseite
|
||||
' e.Cancel = True
|
||||
'End If
|
||||
Dim _Fehler As Boolean = False
|
||||
Dim _SkippedFilesCount As Integer = 0 ' ← Neu hinzufügen
|
||||
For Each profil As ClassNIProfil In ClassNIProfile.Profile
|
||||
_Fehler = False
|
||||
_SkippedFilesCount = 0
|
||||
|
||||
' aktuelles Profil der Klasse mitteilen
|
||||
Me.aktivesProfil = profil
|
||||
_clsWorkfile = New clsNI_WorkFile(_MyLogger)
|
||||
@@ -501,42 +504,62 @@ Public Class frmNIHauptseite
|
||||
'Dim _dok As WMObject
|
||||
'_dok = Nothing
|
||||
Try
|
||||
' Wichtig: aktivesDokument zurücksetzen
|
||||
aktivesDokument = Nothing
|
||||
aktivesDokument = _windreamNI.oWMSession.GetWMObjectByPath(ConstWMEntityDocument, oFilenameWM)
|
||||
Catch ex As Exception
|
||||
_Logger.Warn($"ATTENTION: error while creating a windream-object via objectpath - ERROR [{ex.InnerException.Message}]")
|
||||
_Logger.Warn($"Filename [{oFilenameWM}]")
|
||||
_Logger.Error(ex)
|
||||
bwProfil.ReportProgress(-4)
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
If Not IsNothing(aktivesDokument) Then
|
||||
If IsNothing(aktivesDokument) Then
|
||||
_Logger.Warn($"ATTENTION: Could not create WMObject for path [{oFilenameWM}] - Object is Nothing. Skipping file...")
|
||||
bwProfil.ReportProgress(-1) ' Fortschritt dennoch erhöhen
|
||||
Continue For ' Nächste Datei
|
||||
End If
|
||||
|
||||
_Logger.Debug($"..Got a windream-document-object for {aktivesDokument.aName}...")
|
||||
i += 1
|
||||
|
||||
'####### Go für das Dokument ##########
|
||||
' Thread für diese Datei starten
|
||||
Me.startDateiDurchlauf()
|
||||
'######################################
|
||||
' solange der Datei-Thread noch nicht abgeschlossen wurde
|
||||
|
||||
While Me.bwDatei.IsBusy
|
||||
|
||||
End While
|
||||
|
||||
' nächste Datei an ProgressBar2
|
||||
bwProfil.ReportProgress(-1)
|
||||
oWorkCount += 1
|
||||
|
||||
' Vorgang abbrechen
|
||||
If bwProfil.CancellationPending Then
|
||||
_Logger.Info($"bwProfil.CancellationPending...Exit bwProfil_DoWork")
|
||||
Exit Sub
|
||||
ElseIf manually_cancel = True Then
|
||||
_Logger.Info($"manually_cancel...Exit bwProfil_DoWork")
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
_Logger.Error("Could not create a WMDocument via path!")
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
' Fehler bei einzelner Datei - loggen und weitermachen
|
||||
_Logger.Warn($"ATTENTION: Error processing document from path [{oFilenameWM}]")
|
||||
_Logger.Warn($"Error: {ex.Message}")
|
||||
|
||||
If ex.InnerException IsNot Nothing Then
|
||||
_Logger.Warn($"InnerException: {ex.InnerException.Message}")
|
||||
End If
|
||||
|
||||
_Logger.Error(ex)
|
||||
|
||||
Dim oLineNumber = GetLineNumber(ex)
|
||||
If oLineNumber > 0 Then
|
||||
_Logger.Warn($"#### Line Number: {oLineNumber} ####")
|
||||
End If
|
||||
_SkippedFilesCount += 1 ' ← Zähler erhöhen
|
||||
' Fortschritt trotzdem erhöhen
|
||||
bwProfil.ReportProgress(-1)
|
||||
|
||||
' Weiter mit nächster Datei
|
||||
_Logger.Info($"Skipping file and continuing with next document...")
|
||||
Continue For
|
||||
End Try
|
||||
Next
|
||||
Else
|
||||
_Logger.Error("ATTENTION: _windreamNI not intitialized properly...")
|
||||
@@ -587,6 +610,9 @@ Public Class frmNIHauptseite
|
||||
End If
|
||||
|
||||
End If
|
||||
If _SkippedFilesCount > 0 Then
|
||||
_Logger.Warn($"#### Profile completed with {_SkippedFilesCount} skipped file(s) due to errors ####")
|
||||
End If
|
||||
_Logger.Info("####################################################End Profile DoWork####")
|
||||
' nächstes Profil an ProgressBar1
|
||||
bwProfil.ReportProgress(-2)
|
||||
@@ -640,7 +666,26 @@ Public Class frmNIHauptseite
|
||||
ElseIf e.ProgressPercentage = -2 Then
|
||||
Me.ProgressBar1.Value += 1
|
||||
ElseIf e.ProgressPercentage = -1 Then
|
||||
Me.lblDatei.Text = Me.aktivesDokument.aName
|
||||
Try
|
||||
If Not IsNothing(Me.aktivesDokument) Then
|
||||
Dim docName As String = Me.aktivesDokument.aName
|
||||
If Not String.IsNullOrEmpty(docName) Then
|
||||
Me.lblDatei.Text = docName
|
||||
Else
|
||||
Me.lblDatei.Text = "(Dateiname leer)"
|
||||
End If
|
||||
Else
|
||||
' Wenn aktivesDokument Nothing ist, dann war es ein Skip
|
||||
Me.lblDatei.Text = "(Übersprungen)"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
' Nur bei echtem Fehler
|
||||
Me.lblDatei.Text = "(Fehler beim Laden)"
|
||||
_Logger.Debug($"Error in ProgressChanged: {ex.Message}")
|
||||
End Try
|
||||
|
||||
Me.ProgressBar2.Value += 1
|
||||
|
||||
Me.ProgressBar2.Value += 1
|
||||
Else
|
||||
Me.ProgressBar2.Minimum = 0
|
||||
@@ -1783,7 +1828,8 @@ Public Class frmNIHauptseite
|
||||
End Sub
|
||||
Private Function FolderForIndex(oDynamicFolder As String, myWMDocument As WMObject) As String
|
||||
Try
|
||||
_Logger.Debug("Dynamic folder before cleaning: " & oDynamicFolder)
|
||||
_Logger.Debug($"FolderForIndex -> Dynamic folder before cleaning: {oDynamicFolder}")
|
||||
|
||||
' 1. Platzhalter durch tatsächliche Werte ersetzen
|
||||
Dim resolvedFolder As String = ResolveFolderPlaceholders(oDynamicFolder, myWMDocument)
|
||||
If String.IsNullOrEmpty(resolvedFolder) Then
|
||||
@@ -1795,8 +1841,14 @@ Public Class frmNIHauptseite
|
||||
Dim pathWithoutDrive As String = resolvedFolder
|
||||
|
||||
If resolvedFolder.Length >= 2 AndAlso resolvedFolder.Chars(1) = ":"c Then
|
||||
driveLetter = resolvedFolder.Substring(0, 2) ' z.B. "W:"
|
||||
pathWithoutDrive = resolvedFolder.Substring(2) ' Rest des Pfads
|
||||
' Wenn Backslash vorhanden (W:\), 3 Zeichen nehmen, sonst 2 (W:) und Backslash anfügen
|
||||
If resolvedFolder.Length >= 3 AndAlso resolvedFolder.Chars(2) = "\"c Then
|
||||
driveLetter = resolvedFolder.Substring(0, 3) ' z.B. "W:\"
|
||||
pathWithoutDrive = resolvedFolder.Substring(3)
|
||||
Else
|
||||
driveLetter = resolvedFolder.Substring(0, 2) & "\" ' z.B. "W:" -> "W:\"
|
||||
pathWithoutDrive = resolvedFolder.Substring(2)
|
||||
End If
|
||||
End If
|
||||
|
||||
' 3. Ungültige Zeichen aus jedem Ordnernamen entfernen
|
||||
@@ -1804,9 +1856,15 @@ Public Class frmNIHauptseite
|
||||
|
||||
' 4. Vollständigen Pfad zusammensetzen
|
||||
Dim cleanedFolder As String = driveLetter & pathWithoutDrive
|
||||
_Logger.Debug("Dynamic folder after cleaning: " & cleanedFolder)
|
||||
_Logger.Debug($"FolderForIndex -> Dynamic folder after cleaning: {cleanedFolder}")
|
||||
|
||||
' 5. Ordner erstellen falls nicht vorhanden
|
||||
' 5. Pfadlängen-Prüfung (Windows MAX_PATH = 260, aber besser bei 256 warnen)
|
||||
If cleanedFolder.Length >= 256 Then
|
||||
_Logger.Info($"⚠️ WARNING: Folder path is too long ({cleanedFolder.Length} characters): {cleanedFolder}")
|
||||
Return "Path2Long"
|
||||
End If
|
||||
|
||||
' 6. Ordner erstellen falls nicht vorhanden
|
||||
If Not Directory.Exists(cleanedFolder) Then
|
||||
Directory.CreateDirectory(cleanedFolder)
|
||||
_Logger.Debug($"Folder '{cleanedFolder}' has been created...")
|
||||
@@ -1933,7 +1991,26 @@ Public Class frmNIHauptseite
|
||||
|
||||
Dim rgPattern As String = My.Settings.REGEX_INVALID_PATH
|
||||
Dim objRegEx As New Regex(rgPattern)
|
||||
Dim pathSegments As String() = path.Split("\"c)
|
||||
|
||||
' UNC-Präfix oder Laufwerksbuchstaben merken
|
||||
Dim prefix As String = String.Empty
|
||||
Dim workingPath As String = path
|
||||
|
||||
' Prüfen ob UNC-Pfad (beginnt mit \\)
|
||||
If path.StartsWith("\\") Then
|
||||
prefix = "\\"
|
||||
workingPath = path.Substring(2)
|
||||
' Prüfen ob Laufwerksbuchstabe (z.B. W:\)
|
||||
ElseIf path.Length >= 3 AndAlso path.Chars(1) = ":"c AndAlso path.Chars(2) = "\"c Then
|
||||
prefix = path.Substring(0, 3) ' z.B. "W:\"
|
||||
workingPath = path.Substring(3)
|
||||
ElseIf path.Length >= 2 AndAlso path.Chars(1) = ":"c Then
|
||||
prefix = path.Substring(0, 2) & "\" ' z.B. "W:" wird zu "W:\"
|
||||
workingPath = path.Substring(2)
|
||||
End If
|
||||
|
||||
' Pfad in Segmente aufteilen und bereinigen
|
||||
Dim pathSegments As String() = workingPath.Split("\"c)
|
||||
Dim cleanedSegments As New List(Of String)
|
||||
|
||||
For Each segment As String In pathSegments
|
||||
@@ -1950,7 +2027,8 @@ Public Class frmNIHauptseite
|
||||
cleanedSegments.Add(cleanedSegment)
|
||||
Next
|
||||
|
||||
Return String.Join("\", cleanedSegments)
|
||||
' Pfad mit Präfix zusammensetzen
|
||||
Return prefix & String.Join("\", cleanedSegments)
|
||||
End Function
|
||||
|
||||
|
||||
@@ -1978,6 +2056,9 @@ Public Class frmNIHauptseite
|
||||
End If
|
||||
If oTargetpath = "" Then
|
||||
Return True
|
||||
ElseIf oTargetpath = "Path2Long" Then
|
||||
_Logger.Info($"⚠️ WARNING: Targetpath is too long for document [{myWMDocument.aName}] - Move and Rename skipped!")
|
||||
Return True
|
||||
End If
|
||||
|
||||
'schonmal den gesamten Pfad laden - OHNE Extension zuerst
|
||||
|
||||
Reference in New Issue
Block a user