mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
more fixes for getting styleCop up, this will need one more push to get another 15 that will require renaming of vars (#5875)
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows;
|
||||
|
||||
namespace Wox.Infrastructure.Image
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace Wox.Infrastructure.Image
|
||||
PARENTRELATIVEEDITING = 0x80031001,
|
||||
DESKTOPABSOLUTEEDITING = 0x8004c000,
|
||||
FILESYSPATH = 0x80058000,
|
||||
URL = 0x80068000
|
||||
URL = 0x80068000,
|
||||
}
|
||||
|
||||
internal enum HResult
|
||||
@@ -84,7 +84,7 @@ namespace Wox.Infrastructure.Image
|
||||
Win32ErrorCanceled = 1223,
|
||||
Canceled = unchecked((int)0x800704C7),
|
||||
ResourceInUse = unchecked((int)0x800700AA),
|
||||
AccessDenied = unchecked((int)0x80030005)
|
||||
AccessDenied = unchecked((int)0x80030005),
|
||||
}
|
||||
|
||||
[ComImportAttribute()]
|
||||
@@ -105,9 +105,15 @@ namespace Wox.Infrastructure.Image
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
public int Width { set { width = value; } }
|
||||
public int Width
|
||||
{
|
||||
set { width = value; }
|
||||
}
|
||||
|
||||
public int Height { set { height = value; } }
|
||||
public int Height
|
||||
{
|
||||
set { height = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
|
||||
@@ -132,12 +138,14 @@ namespace Wox.Infrastructure.Image
|
||||
int retCode = SHCreateItemFromParsingName(fileName, IntPtr.Zero, ref shellItem2Guid, out nativeShellItem);
|
||||
|
||||
if (retCode != 0)
|
||||
{
|
||||
throw Marshal.GetExceptionForHR(retCode);
|
||||
}
|
||||
|
||||
NativeSize nativeSize = new NativeSize
|
||||
{
|
||||
Width = width,
|
||||
Height = height
|
||||
Height = height,
|
||||
};
|
||||
|
||||
IntPtr hBitmap;
|
||||
@@ -151,7 +159,10 @@ namespace Wox.Infrastructure.Image
|
||||
|
||||
Marshal.ReleaseComObject(nativeShellItem);
|
||||
|
||||
if (hr == HResult.Ok) return hBitmap;
|
||||
if (hr == HResult.Ok)
|
||||
{
|
||||
return hBitmap;
|
||||
}
|
||||
|
||||
throw new COMException($"Error while extracting thumbnail for {fileName}", Marshal.GetExceptionForHR((int)hr));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user