diff --git a/Modules.Windream/My Project/AssemblyInfo.vb b/Modules.Windream/My Project/AssemblyInfo.vb index 3f210d4d..912bc635 100644 --- a/Modules.Windream/My Project/AssemblyInfo.vb +++ b/Modules.Windream/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index deccea30..0893f0c4 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -101,6 +101,8 @@ Public Class Windream End Get End Property + + #End Region ''' ''' Creates a new Windream object and connects to a server with the provided options and credentials @@ -731,7 +733,7 @@ Public Class Windream If UsesDriveLetter Then ' Remove Driveletter eg. W:\ If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then - oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter + 2) + oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter.Length + 2) End If Else If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then @@ -1104,6 +1106,7 @@ Public Class Windream Return True Catch ex As Exception _logger.Error(ex) + UnlockObject(oWMObject) Return False End Try End Function @@ -1343,6 +1346,25 @@ Public Class Windream Return False End Try End Function + Public Function VersionWMFilename(pPath As String, pExt As String) + Dim rNewFilepath As String = pPath + pPath = GetNormalizedPath(pPath) + Dim oPath = pPath.Substring(0, pPath.LastIndexOf("\")) + Dim oFilename = pPath.Substring(pPath.LastIndexOf("\") + 1, pPath.Length - pPath.LastIndexOf("\") - 1) + Dim oCheck = oFilename + Dim oSplit As List(Of String) = oFilename.Split("~").ToList() + oFilename = oFilename.Replace(pExt, "") + Dim oCount As Integer = 2 + Do While TestFileExists(rNewFilepath) = True + oFilename = oFilename.Replace(pExt, "") + Dim oVersion = "~" + (oCount - 1).ToString + oFilename = oFilename.Replace(oVersion, "") + oFilename = oFilename & "~" & oCount & pExt + oCount += 1 + rNewFilepath = oPath + "\" + oFilename + Loop + Return rNewFilepath + End Function Public Function TestFolderExists(Path As String) As Boolean Return TestObjectExists(GetNormalizedPath(Path), WMEntityFolder) End Function