private ImageMeta LoadBitmap(string fileName) { // Can we use a thumbnail and load asynchronously? // using the Windows API code pack // PM> Install -Package WindowsAPICodePack-Shell using (Microsoft.WindowsAPICodePack.Shell.ShellFile file = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(fileName)) { var img = file.Thumbnail.ExtraLargeBitmap; if (img == null) { return(null); } Console.WriteLine("Quick done!"); return(new ImageMeta { Image = file.Thumbnail.ExtraLargeBitmap, ActualWidth = (int?)file.Properties.System?.Image?.HorizontalSize?.Value ?? img.Width, ActualHeight = (int?)file.Properties.System?.Image?.VerticalSize?.Value ?? img.Height }); } }
public Shell2FileNode(FileSystemNode parent, Microsoft.WindowsAPICodePack.Shell.ShellFile info) : base(parent) { this.ParentNode = parent; this.info = info; }