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