File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed
BetterGenshinImpact/ViewModel/Pages Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -57,20 +57,28 @@ private void InitScriptListViewData()
5757 // 循环写入 root.Children
5858 foreach ( var item in root . Children )
5959 {
60- // 补充图标
61- if ( ! string . IsNullOrEmpty ( item . FilePath ) && File . Exists ( Path . Combine ( item . FilePath , "icon.ico" ) ) )
62- {
63- item . IconFilePath = Path . Combine ( item . FilePath , "icon.ico" ) ;
64- }
65- else
66- {
67- item . IconFilePath = item . FilePath ;
68- }
69-
60+ SetIconForNodeAndChildren ( item ) ;
7061 TreeList . Add ( item ) ;
7162 }
7263 }
7364
65+ private void SetIconForNodeAndChildren ( FileTreeNode < PathingTask > node )
66+ {
67+ if ( ! string . IsNullOrEmpty ( node . FilePath ) && File . Exists ( Path . Combine ( node . FilePath , "icon.ico" ) ) )
68+ {
69+ node . IconFilePath = Path . Combine ( node . FilePath , "icon.ico" ) ;
70+ }
71+ else
72+ {
73+ node . IconFilePath = node . FilePath ;
74+ }
75+
76+ foreach ( var child in node . Children )
77+ {
78+ SetIconForNodeAndChildren ( child ) ;
79+ }
80+ }
81+
7482 public override void OnNavigatedTo ( )
7583 {
7684 InitScriptListViewData ( ) ;
You can’t perform that action at this time.
0 commit comments