add IsDirectory and support Delete actions

This commit is contained in:
2023-05-05 14:26:55 +02:00
parent 461efe7d14
commit 5925836736
2 changed files with 9 additions and 2 deletions

View File

@@ -8,5 +8,6 @@ Public Class UpdateAction
Public Property DestPath As String
Public Property SrcPath As String
Public Property DownloadUrl As String
Public Property IsDirectory As Boolean
End Class

View File

@@ -180,9 +180,15 @@ Public Class UpdateInstaller
sRemote.Close()
fs.Close()
Case UpdateActionType.Delete
If action.IsDirectory Then
If Directory.Exists(destFilePath) Then
Directory.Delete(destFilePath, True)
End If
Else
If File.Exists(destFilePath) Then
File.Delete(destFilePath)
End If
End If
Case UpdateActionType.Copy
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
If File.Exists(srcFilePath) Then