@@ -16,65 +16,144 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
1616 return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/file.png" , UriTypeKind ) ) ;
1717 }
1818
19- switch ( value )
20- {
21- case ".class" :
22- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/class.png" , UriTypeKind ) ) ;
23- case ".css" :
24- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/css.png" , UriTypeKind ) ) ;
25- case ".doc" :
26- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/doc.png" , UriTypeKind ) ) ;
27- case ".dockerfile" :
28- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/dockerfile.png" , UriTypeKind ) ) ;
29- case ".exe" :
30- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/exe.png" , UriTypeKind ) ) ;
31- case ".gitignore" :
32- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/gitignore.png" , UriTypeKind ) ) ;
33- case ".html" :
34- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/html.png" , UriTypeKind ) ) ;
35- case ".iso" :
36- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/iso.png" , UriTypeKind ) ) ;
37- case ".jar" :
38- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/jar.png" , UriTypeKind ) ) ;
39- case ".java" :
40- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/java.png" , UriTypeKind ) ) ;
41- case ".jpg" :
42- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/jpg.png" , UriTypeKind ) ) ;
43- case ".js" :
44- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/js.png" , UriTypeKind ) ) ;
45- case ".json" :
46- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/json.png" , UriTypeKind ) ) ;
47- case ".md" :
48- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/md.png" , UriTypeKind ) ) ;
49- case ".mp3" :
50- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/mp3.png" , UriTypeKind ) ) ;
51- case ".mp4" :
52- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/mp4.png" , UriTypeKind ) ) ;
53- case ".pdf" :
54- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/pdf.png" , UriTypeKind ) ) ;
55- case ".png" :
56- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/png.png" , UriTypeKind ) ) ;
57- case ".ppt" :
58- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/ppt.png" , UriTypeKind ) ) ;
59- case ".py" :
60- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/py.png" , UriTypeKind ) ) ;
61- case ".sql" :
62- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/sql.png" , UriTypeKind ) ) ;
63- case ".svg" :
64- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/svg.png" , UriTypeKind ) ) ;
65- case ".txt" :
66- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/txt.png" , UriTypeKind ) ) ;
67- case ".xls" :
68- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/xls.png" , UriTypeKind ) ) ;
69- case ".xml" :
70- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/xml.png" , UriTypeKind ) ) ;
71- case ".yml" :
72- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/yml.png" , UriTypeKind ) ) ;
73- case ".zip" :
74- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/zip.png" , UriTypeKind ) ) ;
75- default :
76- return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/file.png" , UriTypeKind ) ) ;
19+ var fileExtension = value . ToString ( ) . Trim ( ) . ToLower ( ) ;
20+
21+ if ( fileExtension . EndsWith ( ".class" , StringComparison . OrdinalIgnoreCase ) )
22+ {
23+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/class.png" , UriTypeKind ) ) ;
24+ }
25+
26+ if ( fileExtension . EndsWith ( ".css" , StringComparison . OrdinalIgnoreCase ) )
27+ {
28+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/css.png" , UriTypeKind ) ) ;
29+ }
30+
31+ if ( fileExtension . EndsWith ( ".doc" , StringComparison . OrdinalIgnoreCase ) )
32+ {
33+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/doc.png" , UriTypeKind ) ) ;
34+ }
35+
36+ if ( fileExtension . EndsWith ( ".dockerfile" , StringComparison . OrdinalIgnoreCase ) )
37+ {
38+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/dockerfile.png" , UriTypeKind ) ) ;
39+ }
40+
41+ if ( fileExtension . EndsWith ( ".exe" , StringComparison . OrdinalIgnoreCase ) )
42+ {
43+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/exe.png" , UriTypeKind ) ) ;
44+ }
45+
46+ if ( fileExtension . EndsWith ( ".gitignore" , StringComparison . OrdinalIgnoreCase ) )
47+ {
48+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/gitignore.png" , UriTypeKind ) ) ;
49+ }
50+
51+ if ( fileExtension . EndsWith ( ".html" , StringComparison . OrdinalIgnoreCase ) )
52+ {
53+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/html.png" , UriTypeKind ) ) ;
54+ }
55+
56+ if ( fileExtension . EndsWith ( ".iso" , StringComparison . OrdinalIgnoreCase ) )
57+ {
58+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/iso.png" , UriTypeKind ) ) ;
59+ }
60+
61+ if ( fileExtension . EndsWith ( ".jar" , StringComparison . OrdinalIgnoreCase ) )
62+ {
63+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/jar.png" , UriTypeKind ) ) ;
64+ }
65+
66+ if ( fileExtension . EndsWith ( ".java" , StringComparison . OrdinalIgnoreCase ) )
67+ {
68+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/java.png" , UriTypeKind ) ) ;
69+ }
70+
71+ if ( fileExtension . EndsWith ( ".jpg" , StringComparison . OrdinalIgnoreCase ) )
72+ {
73+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/jpg.png" , UriTypeKind ) ) ;
74+ }
75+
76+ if ( fileExtension . EndsWith ( ".js" , StringComparison . OrdinalIgnoreCase ) )
77+ {
78+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/js.png" , UriTypeKind ) ) ;
79+ }
80+
81+ if ( fileExtension . EndsWith ( ".json" , StringComparison . OrdinalIgnoreCase ) )
82+ {
83+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/json.png" , UriTypeKind ) ) ;
84+ }
85+
86+ if ( fileExtension . EndsWith ( ".md" , StringComparison . OrdinalIgnoreCase ) )
87+ {
88+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/md.png" , UriTypeKind ) ) ;
7789 }
90+
91+ if ( fileExtension . EndsWith ( ".mp3" , StringComparison . OrdinalIgnoreCase ) )
92+ {
93+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/mp3.png" , UriTypeKind ) ) ;
94+ }
95+
96+ if ( fileExtension . EndsWith ( ".mp4" , StringComparison . OrdinalIgnoreCase ) )
97+ {
98+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/mp4.png" , UriTypeKind ) ) ;
99+ }
100+
101+ if ( fileExtension . EndsWith ( ".pdf" , StringComparison . OrdinalIgnoreCase ) )
102+ {
103+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/pdf.png" , UriTypeKind ) ) ;
104+ }
105+
106+ if ( fileExtension . EndsWith ( ".png" , StringComparison . OrdinalIgnoreCase ) )
107+ {
108+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/png.png" , UriTypeKind ) ) ;
109+ }
110+
111+ if ( fileExtension . EndsWith ( ".ppt" , StringComparison . OrdinalIgnoreCase ) )
112+ {
113+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/ppt.png" , UriTypeKind ) ) ;
114+ }
115+
116+ if ( fileExtension . EndsWith ( ".py" , StringComparison . OrdinalIgnoreCase ) )
117+ {
118+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/py.png" , UriTypeKind ) ) ;
119+ }
120+
121+ if ( fileExtension . EndsWith ( ".sql" , StringComparison . OrdinalIgnoreCase ) )
122+ {
123+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/sql.png" , UriTypeKind ) ) ;
124+ }
125+
126+ if ( fileExtension . EndsWith ( ".svg" , StringComparison . OrdinalIgnoreCase ) )
127+ {
128+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/svg.png" , UriTypeKind ) ) ;
129+ }
130+
131+ if ( fileExtension . EndsWith ( ".txt" , StringComparison . OrdinalIgnoreCase ) )
132+ {
133+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/txt.png" , UriTypeKind ) ) ;
134+ }
135+
136+ if ( fileExtension . EndsWith ( ".xls" , StringComparison . OrdinalIgnoreCase ) )
137+ {
138+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/xls.png" , UriTypeKind ) ) ;
139+ }
140+
141+ if ( fileExtension . EndsWith ( ".xml" , StringComparison . OrdinalIgnoreCase ) )
142+ {
143+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/xml.png" , UriTypeKind ) ) ;
144+ }
145+
146+ if ( fileExtension . EndsWith ( ".yml" , StringComparison . OrdinalIgnoreCase ) )
147+ {
148+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/yml.png" , UriTypeKind ) ) ;
149+ }
150+
151+ if ( fileExtension . EndsWith ( ".zip" , StringComparison . OrdinalIgnoreCase ) )
152+ {
153+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/zip.png" , UriTypeKind ) ) ;
154+ }
155+
156+ return new BitmapImage ( new Uri ( "/CodeGenerator;component/Images/file.png" , UriTypeKind ) ) ;
78157 }
79158
80159 public object ConvertBack ( object value , Type targetType , object parameter , CultureInfo culture )
0 commit comments