heribertolugo / FileList

List all files in a given directory, and provide the option to copy or move selected files.
1 stars 0 forks source link

Exception For Thumbnail If File Is Not Image #87

Open heribertolugo opened 2 years ago

heribertolugo commented 2 years ago

at the moment a Bitmap is attempted to get created from the current file path. This will throw an exception if the file is not an image type. The exception is caught and a known icon is used instead.

We should check first if the file is an image type, rather than try to force it and then swallow the exception to try and get an icon.

Project: FilePreview File: FileBrowserControl.cs Method: AddImage(string path, ImageList imageList, Size imageSize) Code: Bitmap bitmap2 = new Bitmap(path);