allow remove

This commit is contained in:
2023-02-26 15:50:03 +01:00
parent ad18e33a6b
commit cc558ab274
3 changed files with 5 additions and 2 deletions

View File

@@ -9,10 +9,12 @@ Public Class AppConfig
Public Property LastConfigFilePath As String Public Property LastConfigFilePath As String
Public Property KeepLocalFiles As New List(Of String) Public Property KeepLocalFiles As New List(Of String)
Public Property RemoveLocalFiles As Boolean Public Property RemoveLocalFiles As Boolean
Public Property OnlySearchSubfolders As Boolean
Public Sub Reset() Public Sub Reset()
KeepLocalFiles.Clear() KeepLocalFiles.Clear()
KeepLocalFiles.Add("OptiFine_1.7.10_HD_U_E7.jar") KeepLocalFiles.Add("OptiFine_1.7.10_HD_U_E7.jar")
OnlySearchSubfolders = True
End Sub End Sub
Public Shared ReadOnly Property Instance As AppConfig Public Shared ReadOnly Property Instance As AppConfig

View File

@@ -8,7 +8,7 @@
<ApplicationIcon>icons8_download_from_ftp.ico</ApplicationIcon> <ApplicationIcon>icons8_download_from_ftp.ico</ApplicationIcon>
<AssemblyName>Minecraft Modpack Updater</AssemblyName> <AssemblyName>Minecraft Modpack Updater</AssemblyName>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>1.2.1.0</Version> <Version>1.2.2.0</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

View File

@@ -89,6 +89,7 @@ Public Class UpdateInstaller
Dim allLocalFiles = Directory.GetFiles(localPath, "*", SearchOption.AllDirectories) Dim allLocalFiles = Directory.GetFiles(localPath, "*", SearchOption.AllDirectories)
For Each lf As String In allLocalFiles For Each lf As String In allLocalFiles
Dim isKnown As Boolean = False Dim isKnown As Boolean = False
Dim allowRemove As Boolean = AppConfig.Instance.OnlySearchSubfolders OrElse Path.GetDirectoryName(lf) <> localPath
For Each checkedFile As String In checkedFiles For Each checkedFile As String In checkedFiles
If Not isKnown AndAlso If(checkedFile, "") = If(lf, "") Then If Not isKnown AndAlso If(checkedFile, "") = If(lf, "") Then
@@ -96,7 +97,7 @@ Public Class UpdateInstaller
End If End If
Next Next
If Not isKnown Then If Not isKnown AndAlso allowRemove Then
result.SyncFiles.Add(New UpdateSyncFile(If(ignoreRevmoedFiles, UpdateSyncAction.None, UpdateSyncAction.RemovedFile), lf, String.Empty)) result.SyncFiles.Add(New UpdateSyncFile(If(ignoreRevmoedFiles, UpdateSyncAction.None, UpdateSyncAction.RemovedFile), lf, String.Empty))
End If End If
Next Next