@@ -102,7 +102,10 @@ public bool MatchesExtension( string extension, bool extensionMayHaveMultipleSuf
102
102
for ( int i = 0 ; i < extensions . Length ; i ++ )
103
103
{
104
104
if ( extension . EndsWith ( extensions [ i ] , StringComparison . Ordinal ) )
105
+ {
106
+ extensionsSet . Add ( extension ) ;
105
107
return true ;
108
+ }
106
109
}
107
110
}
108
111
@@ -358,7 +361,7 @@ private static FileBrowser Instance
358
361
[ SerializeField ]
359
362
private FiletypeIcon [ ] filetypeIcons ;
360
363
361
- private Dictionary < string , Sprite > filetypeToIcon ;
364
+ private readonly Dictionary < string , Sprite > filetypeToIcon = new Dictionary < string , Sprite > ( 128 ) ;
362
365
363
366
[ SerializeField ]
364
367
internal Sprite multiSelectionToggleOffIcon ;
@@ -913,7 +916,7 @@ void IListViewAdapter.SetItemContent( ListItem item )
913
916
#region Initialization Functions
914
917
private void InitializeFiletypeIcons ( )
915
918
{
916
- filetypeToIcon = new Dictionary < string , Sprite > ( ) ;
919
+ filetypeToIcon . Clear ( ) ;
917
920
allIconExtensionsHaveSingleSuffix = true ;
918
921
919
922
for ( int i = 0 ; i < filetypeIcons . Length ; i ++ )
@@ -1797,7 +1800,10 @@ public void RefreshFiles( bool pathChanged )
1797
1800
for ( int j = 0 ; j < excludedExtensions . Length ; j ++ )
1798
1801
{
1799
1802
if ( extension . EndsWith ( excludedExtensions [ j ] , StringComparison . Ordinal ) )
1803
+ {
1804
+ excludedExtensionsSet . Add ( extension ) ;
1800
1805
continue ;
1806
+ }
1801
1807
}
1802
1808
}
1803
1809
@@ -2209,10 +2215,14 @@ internal Sprite GetIconForFileEntry( FileSystemEntry fileInfo )
2209
2215
for ( int i = 0 ; i < filetypeIcons . Length ; i ++ )
2210
2216
{
2211
2217
if ( fileInfo . Extension . EndsWith ( filetypeIcons [ i ] . extension , StringComparison . Ordinal ) )
2218
+ {
2219
+ filetypeToIcon [ fileInfo . Extension ] = filetypeIcons [ i ] . icon ;
2212
2220
return filetypeIcons [ i ] . icon ;
2221
+ }
2213
2222
}
2214
2223
}
2215
2224
2225
+ filetypeToIcon [ fileInfo . Extension ] = defaultIcon ;
2216
2226
return defaultIcon ;
2217
2227
}
2218
2228
0 commit comments