Windream: use file versioning from Filesystem Module in VersionWMFilename
This commit is contained in:
parent
a423842423
commit
8ac01eefa4
@ -94,6 +94,7 @@ Public Class Windream
|
||||
#Region "Private Properties"
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _fileSystem As Filesystem.File
|
||||
Private ReadOnly _sessionDomain As String
|
||||
Private ReadOnly _sessionPassword As String
|
||||
Private ReadOnly _sessionUsername As String
|
||||
@ -144,6 +145,7 @@ Public Class Windream
|
||||
' Create logger and save LogFactory for dependent classes
|
||||
_logger = LogConfig.GetLogger()
|
||||
_logConfig = LogConfig
|
||||
_fileSystem = New Filesystem.File(LogConfig)
|
||||
|
||||
' Create a session
|
||||
Dim oSession As IWMSession2 = NewSession(SessionServerName, SessionUserName, SessionPassword, SessionDomain)
|
||||
@ -1406,23 +1408,25 @@ Public Class Windream
|
||||
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
|
||||
Return _fileSystem.GetVersionedFilename(pPath)
|
||||
|
||||
'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)
|
||||
|
||||
@ -136,6 +136,10 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Filesystem\Filesystem.vbproj">
|
||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
||||
<Name>Filesystem</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Language\Language.vbproj">
|
||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||
<Name>Language</Name>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user