mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Upgrade to .net framework 4.5
This commit is contained in:
@@ -37,16 +37,17 @@ namespace Wox.ImageLoader
|
||||
|
||||
private static ImageSource GetIcon(string fileName)
|
||||
{
|
||||
if (System.IO.File.Exists(fileName) == false) return null;
|
||||
|
||||
Icon icon = GetFileIcon(fileName);
|
||||
if (icon == null) icon = Icon.ExtractAssociatedIcon(fileName);
|
||||
|
||||
if (icon != null)
|
||||
try
|
||||
{
|
||||
return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(icon.Handle,
|
||||
new Int32Rect(0, 0, icon.Width, icon.Height), BitmapSizeOptions.FromEmptyOptions());
|
||||
if (File.Exists(fileName) == false) return null;
|
||||
Icon icon = GetFileIcon(fileName) ?? Icon.ExtractAssociatedIcon(fileName);
|
||||
if (icon != null)
|
||||
{
|
||||
return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(icon.Handle,
|
||||
new Int32Rect(0, 0, icon.Width, icon.Height), BitmapSizeOptions.FromEmptyOptions());
|
||||
}
|
||||
}
|
||||
catch{}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user