🐛 空文件夹总是判定为被选中
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
<TextBlock Text="游戏文件" VerticalAlignment="Center" Grid.Column="0" Grid.Row="2" />
|
||||
<local:MyCheckBox Height="22" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2" Text="存档"
|
||||
Tag="saves" ToolTip="saves 文件夹" />
|
||||
<local:MyCheckBox Height="22" VerticalAlignment="Center" Grid.Row="2" Grid.Column="3" Text="材质包"
|
||||
<local:MyCheckBox Height="22" VerticalAlignment="Center" Grid.Row="2" Grid.Column="3" Text="资源包"
|
||||
Tag="resources" ToolTip="resourcepacks 文件夹" />
|
||||
<local:MyCheckBox Height="22" VerticalAlignment="Center" Grid.Row="2" Grid.Column="4" Text="光影包"
|
||||
Tag="shaderpacks" ToolTip="shaderpacks 文件夹" />
|
||||
|
||||
@@ -94,7 +94,6 @@
|
||||
Else
|
||||
listItem.Title = f
|
||||
End If
|
||||
listItem.Info = (NewPath & f).Replace(GetPathFromFullPath(PageVersionLeft.Version.Path), "")
|
||||
listItem.Type = MyListItem.CheckType.CheckBox
|
||||
listItem.Height = 35
|
||||
listItem.Tag = f
|
||||
@@ -143,12 +142,14 @@
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Private Function IsSelected(TargetPath As String) As Boolean
|
||||
Private Function IsSelected(TargetPath As String, Optional AllowEmpty As Boolean = False) As Boolean
|
||||
If File.Exists(TargetPath) Then
|
||||
Return Selected.Contains(TargetPath)
|
||||
End If
|
||||
If Directory.Exists(TargetPath) Then
|
||||
Return Directory.EnumerateDirectories(TargetPath).All(Function(s) IsSelected(s)) AndAlso
|
||||
Dim di As New DirectoryInfo(TargetPath)
|
||||
If (Not AllowEmpty) AndAlso di.GetDirectories.Length + di.GetFiles.Length = 0 Then Return False
|
||||
Return Directory.EnumerateDirectories(TargetPath).All(Function(s) IsSelected(s, True)) AndAlso
|
||||
Directory.EnumerateFiles(TargetPath).All(Function(s) Selected.Contains(s))
|
||||
End If
|
||||
Return False
|
||||
@@ -178,21 +179,20 @@
|
||||
If String.IsNullOrEmpty(c.Tag) Then Continue For
|
||||
For Each l In PanFileList.Children
|
||||
If TypeOf l Is MyListItem Then
|
||||
If l.Tag.Replace("\", "") = c.Tag Then l.Checked = c.Checked
|
||||
If l.Tag.Replace("\", "") = c.Tag Then
|
||||
l.Checked = c.Checked
|
||||
SelectedChange(c.Checked, PageVersionLeft.Version.Path & c.Tag)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
'高级选项与复选框同步
|
||||
Private Sub PanFileList_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs) Handles PanFileList.MouseLeftButtonUp
|
||||
For Each l In PanFileList.Children
|
||||
If TypeOf l IsNot MyListItem Then Continue For
|
||||
If String.IsNullOrEmpty(l.Tag) Then Continue For
|
||||
For Each c In PanCommonFiles.Children
|
||||
If TypeOf c Is MyCheckBox Then
|
||||
If c.Tag = l.Tag.Replace("\", "") Then c.Checked = l.Checked
|
||||
End If
|
||||
Next
|
||||
For Each c In PanCommonFiles.Children
|
||||
If TypeOf c Is MyCheckBox Then
|
||||
c.Checked = IsSelected(PageVersionLeft.Version.Path & c.Tag)
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user