File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,11 @@ public ResultViewModel(Result result, Settings settings)
28
28
}
29
29
Result = result ;
30
30
31
- PreviewExtension = Path . GetExtension ( result . PreviewImage ?? result . SubTitle ) ;
32
- if ( PreviewExtension != null )
31
+ var extension = Path . GetExtension ( result . PreviewImage ) ;
32
+ if ( ! string . IsNullOrEmpty ( extension ) )
33
33
{
34
- PreviewExtension = PreviewExtension . ToLowerInvariant ( ) ;
34
+ // only when explicitly specified PreviewImage
35
+ PreviewIsImageOrVideo = IsMedia ( extension . ToLowerInvariant ( ) ) ;
35
36
}
36
37
37
38
if ( Result . Glyph is { FontFamily : not null } glyph )
@@ -173,18 +174,21 @@ public ImageSource PreviewImage
173
174
private set => previewImage = value ;
174
175
}
175
176
176
- public string PreviewExtension { get ; set ; }
177
-
178
- public bool PreviewIsImageOrVideo => PreviewExtension is ".jpg"
179
- or ".png"
180
- or ".avi"
181
- or ".mkv"
182
- or ".bmp"
183
- or ".gif"
184
- or ".wmv"
185
- or ".mp3"
186
- or ".flac"
187
- or ".mp4" ;
177
+ public bool PreviewIsImageOrVideo { get ; set ; } = false ;
178
+
179
+ public bool IsMedia ( string extension )
180
+ {
181
+ return extension is ".jpg"
182
+ or ".png"
183
+ or ".avi"
184
+ or ".mkv"
185
+ or ".bmp"
186
+ or ".gif"
187
+ or ".wmv"
188
+ or ".mp3"
189
+ or ".flac"
190
+ or ".mp4" ;
191
+ }
188
192
189
193
public GlyphInfo Glyph { get ; set ; }
190
194
You can’t perform that action at this time.
0 commit comments