x64 Any CPU support

This commit is contained in:
Paddy Xu
2017-06-03 02:50:39 +03:00
parent 438781b7f7
commit 3101059b4d
32 changed files with 621 additions and 232 deletions

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{794E4DCF-F715-4836-9D30-ABD296586D23}</ProjectGuid>
<RootNamespace>QuickLookNativeShell32x64</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)Build\$(Configuration)\</OutDir>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)Build\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\QuickLook.Native.Shell32\dllmain.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\QuickLook.Native.Shell32.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\Shell32.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\QuickLook.Native.Shell32\QuickLook.Native.Shell32.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\Shell32.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\stdafx.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\targetver.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\QuickLook.Native.Shell32\QuickLook.Native.Shell32.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\dllmain.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\Shell32.cpp" />
<ClCompile Include="..\QuickLook.Native.Shell32\stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\QuickLook.Native.Shell32\QuickLook.Native.Shell32.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\Shell32.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\stdafx.h" />
<ClInclude Include="..\QuickLook.Native.Shell32\targetver.h" />
</ItemGroup>
</Project>

View File

@@ -31,6 +31,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />

View File

@@ -34,6 +34,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />

View File

@@ -32,6 +32,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.IPreviewHandlers\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.IPreviewHandlers\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -33,7 +33,7 @@ namespace QuickLook.Plugin.ImageViewer
public void Prepare(string path, ContextObject context)
{
// ImageMagick want to have dcraw.exe
// set dcraw.exe for Magick.NET
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
_imageSize = ImageFileHelper.GetImageSize(path) ?? Size.Empty;

View File

@@ -33,12 +33,30 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExifLib, Version=1.7.0.0, Culture=neutral, PublicKeyToken=30284005913968db, processorArchitecture=MSIL">
<HintPath>..\..\packages\ExifLib.1.7.0.0\lib\net45\ExifLib.dll</HintPath>
</Reference>
<Reference Include="Magick.NET-Q8-x86, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=x86">
<HintPath>..\..\packages\Magick.NET-Q8-x86.7.0.5.900\lib\net40-client\Magick.NET-Q8-x86.dll</HintPath>
<Reference Include="Magick.NET-Q8-AnyCPU, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
<HintPath>..\..\packages\Magick.NET-Q8-AnyCPU.7.0.5.900\lib\net40-client\Magick.NET-Q8-AnyCPU.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -84,11 +102,4 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Magick.NET-Q8-x86.7.0.5.900\build\net40-client\Magick.NET-Q8-x86.targets" Condition="Exists('..\..\packages\Magick.NET-Q8-x86.7.0.5.900\build\net40-client\Magick.NET-Q8-x86.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Magick.NET-Q8-x86.7.0.5.900\build\net40-client\Magick.NET-Q8-x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Magick.NET-Q8-x86.7.0.5.900\build\net40-client\Magick.NET-Q8-x86.targets'))" />
</Target>
</Project>

View File

@@ -2,6 +2,6 @@
<packages>
<package id="ExifLib" version="1.7.0.0" targetFramework="net462" />
<package id="Magick.NET-Q8-x86" version="7.0.5.900" targetFramework="net462" />
<package id="Magick.NET-Q8-AnyCPU" version="7.0.5.900" targetFramework="net462" />
<package id="XamlAnimatedGif" version="1.1.9" targetFramework="net462" />
</packages>

View File

@@ -31,6 +31,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />

View File

@@ -15,7 +15,10 @@ namespace QuickLook.Plugin.PDFViewer
var pix = IntPtr.Zero;
var dev = IntPtr.Zero;
NativeMethods.BoundPage(document, page, ref pageBound);
if (App.Is64Bit)
NativeMethods.BoundPage_64(document, page, ref pageBound);
else
NativeMethods.BoundPage_32(document, page, ref pageBound);
var currentDpi = DpiHelper.GetCurrentDpi();
var zoomX = zoomFactor * (currentDpi.HorizontalDpi / DpiHelper.DEFAULT_DPI);
@@ -30,17 +33,33 @@ namespace QuickLook.Plugin.PDFViewer
ctm.D = (float) zoomY;
// creates a pixmap the same size as the width and height of the page
pix = NativeMethods.NewPixmap(context, NativeMethods.LookupDeviceColorSpace(context, "DeviceRGB"), width,
height);
if (App.Is64Bit)
pix = NativeMethods.NewPixmap_64(context,
NativeMethods.LookupDeviceColorSpace_64(context, "DeviceRGB"), width, height);
else
pix = NativeMethods.NewPixmap_32(context,
NativeMethods.LookupDeviceColorSpace_32(context, "DeviceRGB"), width, height);
// sets white color as the background color of the pixmap
NativeMethods.ClearPixmap(context, pix, 0xFF);
if (App.Is64Bit)
NativeMethods.ClearPixmap_64(context, pix, 0xFF);
else
NativeMethods.ClearPixmap_32(context, pix, 0xFF);
// creates a drawing device
dev = NativeMethods.NewDrawDevice(context, pix);
if (App.Is64Bit)
dev = NativeMethods.NewDrawDevice_64(context, pix);
else
dev = NativeMethods.NewDrawDevice_32(context, pix);
// draws the page on the device created from the pixmap
NativeMethods.RunPage(document, page, dev, ref ctm, IntPtr.Zero);
if (App.Is64Bit)
NativeMethods.RunPage_64(document, page, dev, ref ctm, IntPtr.Zero);
else
NativeMethods.RunPage_32(document, page, dev, ref ctm, IntPtr.Zero);
NativeMethods.FreeDevice(dev); // frees the resources consumed by the device
if (App.Is64Bit)
NativeMethods.FreeDevice_64(dev); // frees the resources consumed by the device
else
NativeMethods.FreeDevice_32(dev); // frees the resources consumed by the device
dev = IntPtr.Zero;
// creates a colorful bitmap of the same size of the pixmap
@@ -50,7 +69,13 @@ namespace QuickLook.Plugin.PDFViewer
unsafe
{
// converts the pixmap data to Bitmap data
var ptrSrc = (byte*) NativeMethods.GetSamples(context, pix); // gets the rendered data from the pixmap
byte* ptrSrc;
if (App.Is64Bit)
ptrSrc =
(byte*) NativeMethods.GetSamples_64(context, pix); // gets the rendered data from the pixmap
else
ptrSrc = (byte*) NativeMethods
.GetSamples_32(context, pix); // gets the rendered data from the pixmap
var ptrDest = (byte*) imageData.Scan0;
for (var y = 0; y < height; y++)
{
@@ -72,7 +97,10 @@ namespace QuickLook.Plugin.PDFViewer
}
}
bmp.UnlockBits(imageData);
NativeMethods.DropPixmap(context, pix);
if (App.Is64Bit)
NativeMethods.DropPixmap_64(context, pix);
else
NativeMethods.DropPixmap_32(context, pix);
bmp.SetResolution(currentDpi.HorizontalDpi, currentDpi.VerticalDpi);
@@ -104,70 +132,137 @@ namespace QuickLook.Plugin.PDFViewer
internal class NativeMethods
{
private const uint FZ_STORE_DEFAULT = 256 << 20;
private const string DLL = "libmupdf.dll";
// please modify the version number to match the FZ_VERSION definition in "fitz\version.h" file
private const string MuPDFVersion = "1.6";
[DllImport(DLL, EntryPoint = "fz_new_context_imp", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr NewContext(IntPtr alloc, IntPtr locks, uint max_store, string version);
private const uint FzStoreDefault = 256 << 20;
private const string MuPdfVersion = "1.6";
public static IntPtr NewContext()
{
return NewContext(IntPtr.Zero, IntPtr.Zero, FZ_STORE_DEFAULT, MuPDFVersion);
return App.Is64Bit
? NewContext_64(IntPtr.Zero, IntPtr.Zero, FzStoreDefault, MuPdfVersion)
: NewContext_32(IntPtr.Zero, IntPtr.Zero, FzStoreDefault, MuPdfVersion);
}
[DllImport(DLL, EntryPoint = "fz_free_context", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr FreeContext(IntPtr ctx);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_new_context_imp", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr NewContext_32(IntPtr alloc, IntPtr locks, uint maxStore, string version);
[DllImport(DLL, EntryPoint = "fz_open_file_w", CharSet = CharSet.Unicode,
[DllImport("LibMuPdf.dll", EntryPoint = "fz_free_context", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr FreeContext_32(IntPtr ctx);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_open_file_w", CharSet = CharSet.Unicode,
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr OpenFile(IntPtr ctx, string fileName);
public static extern IntPtr OpenFile_32(IntPtr ctx, string fileName);
[DllImport(DLL, EntryPoint = "pdf_open_document_with_stream", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr OpenDocumentStream(IntPtr ctx, IntPtr stm);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_open_document_with_stream",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr OpenDocumentStream_32(IntPtr ctx, IntPtr stm);
[DllImport(DLL, EntryPoint = "fz_close", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseStream(IntPtr stm);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_close", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseStream_32(IntPtr stm);
[DllImport(DLL, EntryPoint = "pdf_close_document", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseDocument(IntPtr doc);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_close_document", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseDocument_32(IntPtr doc);
[DllImport(DLL, EntryPoint = "pdf_count_pages", CallingConvention = CallingConvention.Cdecl)]
public static extern int CountPages(IntPtr doc);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_count_pages", CallingConvention = CallingConvention.Cdecl)]
public static extern int CountPages_32(IntPtr doc);
[DllImport(DLL, EntryPoint = "pdf_bound_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void BoundPage(IntPtr doc, IntPtr page, ref Rectangle bound);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_bound_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void BoundPage_32(IntPtr doc, IntPtr page, ref Rectangle bound);
[DllImport(DLL, EntryPoint = "fz_clear_pixmap_with_value", CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPixmap(IntPtr ctx, IntPtr pix, int byteValue);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_clear_pixmap_with_value",
CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPixmap_32(IntPtr ctx, IntPtr pix, int byteValue);
[DllImport(DLL, EntryPoint = "fz_lookup_device_colorspace", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LookupDeviceColorSpace(IntPtr ctx, string colorspace);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_lookup_device_colorspace",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LookupDeviceColorSpace_32(IntPtr ctx, string colorspace);
[DllImport(DLL, EntryPoint = "fz_free_device", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreeDevice(IntPtr dev);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_free_device", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreeDevice_32(IntPtr dev);
[DllImport(DLL, EntryPoint = "pdf_free_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreePage(IntPtr doc, IntPtr page);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_free_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreePage_32(IntPtr doc, IntPtr page);
[DllImport(DLL, EntryPoint = "pdf_load_page", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LoadPage(IntPtr doc, int pageNumber);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_load_page", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LoadPage_32(IntPtr doc, int pageNumber);
[DllImport(DLL, EntryPoint = "fz_new_draw_device", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewDrawDevice(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_new_draw_device", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewDrawDevice_32(IntPtr ctx, IntPtr pix);
[DllImport(DLL, EntryPoint = "fz_new_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewPixmap(IntPtr ctx, IntPtr colorspace, int width, int height);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_new_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewPixmap_32(IntPtr ctx, IntPtr colorspace, int width, int height);
[DllImport(DLL, EntryPoint = "pdf_run_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunPage(IntPtr doc, IntPtr page, IntPtr dev, ref Matrix transform, IntPtr cookie);
[DllImport("LibMuPdf.dll", EntryPoint = "pdf_run_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunPage_32(IntPtr doc, IntPtr page, IntPtr dev, ref Matrix transform,
IntPtr cookie);
[DllImport(DLL, EntryPoint = "fz_drop_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern void DropPixmap(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_drop_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern void DropPixmap_32(IntPtr ctx, IntPtr pix);
[DllImport(DLL, EntryPoint = "fz_pixmap_samples", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GetSamples(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.dll", EntryPoint = "fz_pixmap_samples", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GetSamples_32(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_new_context_imp",
CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr NewContext_64(IntPtr alloc, IntPtr locks, uint maxStore, string version);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_free_context", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr FreeContext_64(IntPtr ctx);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_open_file_w", CharSet = CharSet.Unicode,
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr OpenFile_64(IntPtr ctx, string fileName);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_open_document_with_stream",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr OpenDocumentStream_64(IntPtr ctx, IntPtr stm);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_close", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseStream_64(IntPtr stm);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_close_document",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CloseDocument_64(IntPtr doc);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_count_pages", CallingConvention = CallingConvention.Cdecl)]
public static extern int CountPages_64(IntPtr doc);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_bound_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void BoundPage_64(IntPtr doc, IntPtr page, ref Rectangle bound);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_clear_pixmap_with_value",
CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPixmap_64(IntPtr ctx, IntPtr pix, int byteValue);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_lookup_device_colorspace",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LookupDeviceColorSpace_64(IntPtr ctx, string colorspace);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_free_device", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreeDevice_64(IntPtr dev);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_free_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreePage_64(IntPtr doc, IntPtr page);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_load_page", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr LoadPage_64(IntPtr doc, int pageNumber);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_new_draw_device",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewDrawDevice_64(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_new_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NewPixmap_64(IntPtr ctx, IntPtr colorspace, int width, int height);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "pdf_run_page", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunPage_64(IntPtr doc, IntPtr page, IntPtr dev, ref Matrix transform,
IntPtr cookie);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_drop_pixmap", CallingConvention = CallingConvention.Cdecl)]
public static extern void DropPixmap_64(IntPtr ctx, IntPtr pix);
[DllImport("LibMuPdf.x64.dll", EntryPoint = "fz_pixmap_samples",
CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GetSamples_64(IntPtr ctx, IntPtr pix);
}
}
}

View File

@@ -12,11 +12,20 @@ namespace QuickLook.Plugin.PDFViewer
public PdfFile(string path)
{
_ctx = LibMuPdf.NativeMethods.NewContext();
_stm = LibMuPdf.NativeMethods.OpenFile(_ctx, path);
_doc = LibMuPdf.NativeMethods.OpenDocumentStream(_ctx, _stm);
TotalPages = LibMuPdf.NativeMethods.CountPages(_doc);
if (App.Is64Bit)
{
_ctx = LibMuPdf.NativeMethods.NewContext();
_stm = LibMuPdf.NativeMethods.OpenFile_64(_ctx, path);
_doc = LibMuPdf.NativeMethods.OpenDocumentStream_64(_ctx, _stm);
TotalPages = LibMuPdf.NativeMethods.CountPages_64(_doc);
}
else
{
_ctx = LibMuPdf.NativeMethods.NewContext();
_stm = LibMuPdf.NativeMethods.OpenFile_32(_ctx, path);
_doc = LibMuPdf.NativeMethods.OpenDocumentStream_32(_ctx, _stm);
TotalPages = LibMuPdf.NativeMethods.CountPages_32(_doc);
}
}
public int TotalPages { get; }
@@ -25,9 +34,18 @@ namespace QuickLook.Plugin.PDFViewer
{
GC.SuppressFinalize(this);
LibMuPdf.NativeMethods.CloseDocument(_doc);
LibMuPdf.NativeMethods.CloseStream(_stm);
LibMuPdf.NativeMethods.FreeContext(_ctx);
if (App.Is64Bit)
{
LibMuPdf.NativeMethods.CloseDocument_64(_doc);
LibMuPdf.NativeMethods.CloseStream_64(_stm);
LibMuPdf.NativeMethods.FreeContext_64(_ctx);
}
else
{
LibMuPdf.NativeMethods.CloseDocument_32(_doc);
LibMuPdf.NativeMethods.CloseStream_32(_stm);
LibMuPdf.NativeMethods.FreeContext_32(_ctx);
}
}
~PdfFile()
@@ -46,10 +64,15 @@ namespace QuickLook.Plugin.PDFViewer
throw new OverflowException(
$"Page id {pageId} should greater or equal than 0 and less than total page count {TotalPages}.");
var p = LibMuPdf.NativeMethods.LoadPage(_doc, pageId);
var p = App.Is64Bit
? LibMuPdf.NativeMethods.LoadPage_64(_doc, pageId)
: LibMuPdf.NativeMethods.LoadPage_32(_doc, pageId);
var realSize = new LibMuPdf.Rectangle();
LibMuPdf.NativeMethods.BoundPage(_doc, p, ref realSize);
if (App.Is64Bit)
LibMuPdf.NativeMethods.BoundPage_64(_doc, p, ref realSize);
else
LibMuPdf.NativeMethods.BoundPage_32(_doc, p, ref realSize);
var size = new Size
{
@@ -57,7 +80,10 @@ namespace QuickLook.Plugin.PDFViewer
Height = realSize.Bottom * zoomFactor
};
LibMuPdf.NativeMethods.FreePage(_doc, p);
if (App.Is64Bit)
LibMuPdf.NativeMethods.FreePage_64(_doc, p);
else
LibMuPdf.NativeMethods.FreePage_32(_doc, p);
return size;
}
@@ -68,11 +94,16 @@ namespace QuickLook.Plugin.PDFViewer
throw new OverflowException(
$"Page id {pageId} should greater or equal than 0 and less than total page count {TotalPages}.");
var p = LibMuPdf.NativeMethods.LoadPage(_doc, pageId);
var p = App.Is64Bit
? LibMuPdf.NativeMethods.LoadPage_64(_doc, pageId)
: LibMuPdf.NativeMethods.LoadPage_32(_doc, pageId);
var bmp = LibMuPdf.RenderPage(_ctx, _doc, p, zoomFactor);
LibMuPdf.NativeMethods.FreePage(_doc, p);
if (App.Is64Bit)
LibMuPdf.NativeMethods.FreePage_64(_doc, p);
else
LibMuPdf.NativeMethods.FreePage_32(_doc, p);
return bmp;
}

View File

@@ -33,6 +33,26 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -69,6 +89,9 @@
<Content Include="LibMuPdf.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="LibMuPdf.x64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Page Include="ListBoxItemStyleNoFocusedBorder.xaml">

View File

@@ -31,6 +31,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.TextViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.TextViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<HintPath>..\..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>

View File

@@ -13,6 +13,8 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
@@ -32,6 +34,24 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
@@ -41,7 +61,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Unosquare.FFmpegMediaElement">
<Reference Include="Unosquare.FFmpegMediaElement, Version=1.3.1.4, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Unosquare.FFmpegMediaElement.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />

View File

@@ -38,9 +38,10 @@
</DockPanel>
<Grid>
<ffmpeg:MediaElement x:Name="mediaElement" />
<Border x:Name="buttonMute" VerticalAlignment="Bottom" HorizontalAlignment="Right" Cursor="Hand" Margin="10,10" Width="100" Height="100">
<Border x:Name="buttonMute" VerticalAlignment="Bottom" HorizontalAlignment="Right" Cursor="Hand"
Margin="10,10" Width="100" Height="100">
<Border.Background>
<SolidColorBrush Color="Gray" Opacity="0.9"/>
<SolidColorBrush Color="Gray" Opacity="0.9" />
</Border.Background>
<fa:ImageAwesome Icon="VolumeOff"
Height="60" Width="60" Foreground="White" />

View File

@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using FontAwesome.WPF;
@@ -25,7 +26,7 @@ namespace QuickLook.Plugin.VideoViewer
buttonMute.MouseLeftButtonUp += (sender, e) =>
{
mediaElement.IsMuted = false;
buttonMute.Visibility = System.Windows.Visibility.Collapsed;
buttonMute.Visibility = Visibility.Collapsed;
};
mediaElement.PropertyChanged += ChangePlayPauseButton;

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook", "QuickLook\QuickLook.csproj", "{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}"
ProjectSection(ProjectDependencies) = postProject
@@ -47,79 +47,155 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "QuickLook.Installer", "Quic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.IPreviewHandlers", "QuickLook.Plugin\QuickLook.Plugin.IPreviewHandlers\QuickLook.Plugin.IPreviewHandlers.csproj", "{E37675EA-D957-4495-8655-2609BF86756C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuickLook.Native.Shell32.x64", "QuickLook.Native.Shell32.x64\QuickLook.Native.Shell32.x64.vcxproj", "{794E4DCF-F715-4836-9D30-ABD296586D23}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|Any CPU.ActiveCfg = Debug|x86
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x64.ActiveCfg = Debug|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x64.Build.0 = Debug|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x86.ActiveCfg = Debug|x86
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x86.Build.0 = Debug|x86
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|Any CPU.ActiveCfg = Release|x86
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|Any CPU.Build.0 = Release|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x64.ActiveCfg = Release|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x64.Build.0 = Release|Any CPU
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x86.ActiveCfg = Release|x86
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x86.Build.0 = Release|x86
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Debug|Any CPU.Build.0 = Debug|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Debug|x64.ActiveCfg = Debug|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Debug|x86.ActiveCfg = Debug|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Debug|x86.Build.0 = Debug|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|Any CPU.ActiveCfg = Release|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|Any CPU.Build.0 = Release|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x64.ActiveCfg = Release|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x86.ActiveCfg = Release|Win32
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x86.Build.0 = Release|Win32
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.ActiveCfg = Debug|x86
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x64.ActiveCfg = Debug|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x64.Build.0 = Debug|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.ActiveCfg = Debug|x86
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.Build.0 = Debug|x86
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|Any CPU.ActiveCfg = Release|x86
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|Any CPU.Build.0 = Release|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x64.ActiveCfg = Release|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x64.Build.0 = Release|Any CPU
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.ActiveCfg = Release|x86
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.Build.0 = Release|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.ActiveCfg = Debug|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x64.ActiveCfg = Debug|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x64.Build.0 = Debug|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.ActiveCfg = Debug|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.Build.0 = Debug|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.ActiveCfg = Release|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.Build.0 = Release|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x64.ActiveCfg = Release|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x64.Build.0 = Release|Any CPU
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.ActiveCfg = Release|x86
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.Build.0 = Release|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.ActiveCfg = Debug|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x64.ActiveCfg = Debug|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x64.Build.0 = Debug|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.ActiveCfg = Debug|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.Build.0 = Debug|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.ActiveCfg = Release|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.Build.0 = Release|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x64.ActiveCfg = Release|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x64.Build.0 = Release|Any CPU
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.ActiveCfg = Release|x86
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.Build.0 = Release|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.ActiveCfg = Debug|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x64.ActiveCfg = Debug|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x64.Build.0 = Debug|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.ActiveCfg = Debug|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.Build.0 = Debug|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.ActiveCfg = Release|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.Build.0 = Release|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x64.ActiveCfg = Release|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x64.Build.0 = Release|Any CPU
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.ActiveCfg = Release|x86
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.Build.0 = Release|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|Any CPU.ActiveCfg = Debug|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|x64.ActiveCfg = Debug|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|x64.Build.0 = Debug|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|x86.ActiveCfg = Debug|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|x86.Build.0 = Debug|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|Any CPU.ActiveCfg = Release|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|Any CPU.Build.0 = Release|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|x64.ActiveCfg = Release|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|x64.Build.0 = Release|Any CPU
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|x86.ActiveCfg = Release|x86
{1B746D92-49A5-4A37-9D75-DCC490393290}.Release|x86.Build.0 = Release|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|Any CPU.ActiveCfg = Debug|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|x64.ActiveCfg = Debug|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|x64.Build.0 = Debug|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|x86.ActiveCfg = Debug|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Debug|x86.Build.0 = Debug|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|Any CPU.ActiveCfg = Release|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|Any CPU.Build.0 = Release|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|x64.ActiveCfg = Release|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|x64.Build.0 = Release|Any CPU
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|x86.ActiveCfg = Release|x86
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}.Release|x86.Build.0 = Release|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|Any CPU.ActiveCfg = Debug|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|x64.ActiveCfg = Debug|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|x64.Build.0 = Debug|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|x86.ActiveCfg = Debug|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Debug|x86.Build.0 = Debug|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|Any CPU.ActiveCfg = Release|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|Any CPU.Build.0 = Release|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|x64.ActiveCfg = Release|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|x64.Build.0 = Release|Any CPU
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|x86.ActiveCfg = Release|x86
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|x86.Build.0 = Release|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Debug|Any CPU.ActiveCfg = Debug|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Debug|x64.ActiveCfg = Debug|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Debug|x86.ActiveCfg = Debug|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Debug|x86.Build.0 = Debug|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Release|Any CPU.ActiveCfg = Release|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Release|Any CPU.Build.0 = Release|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Release|x64.ActiveCfg = Release|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Release|x86.ActiveCfg = Release|x86
{F0214FC2-EFBE-426C-842D-B42BC37D9525}.Release|x86.Build.0 = Release|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|Any CPU.ActiveCfg = Debug|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x64.ActiveCfg = Debug|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x64.Build.0 = Debug|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x86.ActiveCfg = Debug|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x86.Build.0 = Debug|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Release|Any CPU.ActiveCfg = Release|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Release|Any CPU.Build.0 = Release|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x64.ActiveCfg = Release|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x64.Build.0 = Release|Any CPU
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x86.ActiveCfg = Release|x86
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x86.Build.0 = Release|x86
{794E4DCF-F715-4836-9D30-ABD296586D23}.Debug|Any CPU.ActiveCfg = Debug|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Debug|Any CPU.Build.0 = Debug|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Debug|x64.ActiveCfg = Debug|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Debug|x64.Build.0 = Debug|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Debug|x86.ActiveCfg = Debug|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Release|Any CPU.ActiveCfg = Release|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Release|Any CPU.Build.0 = Release|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Release|x64.ActiveCfg = Release|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Release|x64.Build.0 = Release|x64
{794E4DCF-F715-4836-9D30-ABD296586D23}.Release|x86.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -13,6 +13,7 @@ namespace QuickLook
/// </summary>
public partial class App : Application
{
public static readonly bool Is64Bit = Environment.Is64BitProcess;
public static readonly string AppFullPath = Assembly.GetExecutingAssembly().Location;
public static readonly string AppPath = Path.GetDirectoryName(AppFullPath);
public static bool RunningAsViewer;

View File

@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices.ComTypes;
using QuickLook.NativeMethods.Shell32;
using Shell32;
namespace QuickLook.Helpers
{
@@ -15,16 +14,19 @@ namespace QuickLook.Helpers
{
try
{
var link = (IShellLink) new ShellLink();
File.Create(_startupFullPath);
link.SetPath(App.AppFullPath);
link.SetWorkingDirectory(App.AppPath);
link.SetIconLocation(App.AppFullPath, 0);
var shl = new Shell();
var dir = shl.NameSpace(Path.GetDirectoryName(_startupFullPath));
var itm = dir.Items().Item(Path.GetFileName(_startupFullPath));
var lnk = (ShellLinkObject) itm.GetLink;
link.SetArguments($"/autorun"); // silent
lnk.Path = App.AppFullPath;
lnk.Arguments = "/autorun"; // silent
lnk.SetIconLocation(App.AppFullPath, 0);
lnk.WorkingDirectory = App.AppPath;
var file = (IPersistFile) link;
file.Save(_startupFullPath, false);
lnk.Save(_startupFullPath);
}
catch (Exception)
{

View File

@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using QuickLook.NativeMethods.Shell32;
namespace QuickLook.Helpers
{
@@ -24,20 +23,14 @@ namespace QuickLook.Helpers
if (!File.Exists(path))
return null;
if (Path.GetExtension(path) == ".lnk")
{
var shell = (IWshShell) new WshShell();
var link = shell.CreateShortcut(path);
path = FixWow64Path(link.TargetPath);
}
var ext = Path.GetExtension(path).ToLower();
var isExe = new[] {".cmd", ".bat", ".pif", ".scf", ".exe", ".com", ".scr"}.Contains(ext.ToLower());
// no assoc. app. found
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.Command)))
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.AppId))) // UWP
return null;
if (!isExe)
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.Command)))
if (string.IsNullOrEmpty(GetAssocApplicationNative(ext, AssocStr.AppId))) // UWP
return null;
appFriendlyName = isExe
? FileVersionInfo.GetVersionInfo(path).FileDescription
@@ -49,15 +42,6 @@ namespace QuickLook.Helpers
return isExe;
}
public static string FixWow64Path(string targetPath)
{
if (!File.Exists(targetPath) && !Directory.Exists(targetPath))
if (targetPath.Contains("Program Files (x86)"))
return targetPath.Replace("Program Files (x86)", "Program Files");
return targetPath;
}
[DllImport("shlwapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern uint AssocQueryString(AssocF flags, AssocStr str, string pszAssoc, string pszExtra,
[Out] StringBuilder sOut, [In] [Out] ref uint nOut);

View File

@@ -72,7 +72,7 @@
<ContentPresenter Content="{Binding}" RecognizesAccessKey="False" />
</DataTemplate>
</Button.ContentTemplate>
</Button>
</Button>
<!-- set grid.background colour makes it clickable -->
<Grid x:Name="titleArea" Background="Transparent">
<TextBlock Text="{Binding ContextObject.Title, ElementName=mainWindow}" FontSize="14"

View File

@@ -154,7 +154,7 @@ namespace QuickLook
buttonOpenWith.Content = isExe == null
? Directory.Exists(_path)
? $"Browse “{Path.GetFileName(_path)}”"
: "Select ..."
: "Open..."
: isExe == true
? $"Run “{appFriendlyName}”"
: $"Open with “{appFriendlyName}”";

View File

@@ -6,12 +6,26 @@ namespace QuickLook.NativeMethods
{
internal static class QuickLook
{
[DllImport("QuickLook.Native.Shell32.dll", CallingConvention = CallingConvention.Cdecl)]
internal static extern FocusedWindowType GetFocusedWindowType();
[DllImport("QuickLook.Native.Shell32.dll", EntryPoint = "GetFocusedWindowType",
CallingConvention = CallingConvention.Cdecl)]
internal static extern FocusedWindowType GetFocusedWindowTypeNative_32();
[DllImport("QuickLook.Native.Shell32.dll", EntryPoint = "GetCurrentSelection",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void GetCurrentSelectionNative([MarshalAs(UnmanagedType.LPWStr)] StringBuilder sb);
internal static extern void GetCurrentSelectionNative_32([MarshalAs(UnmanagedType.LPWStr)] StringBuilder sb);
[DllImport("QuickLook.Native.Shell32.x64.dll", EntryPoint = "GetFocusedWindowType",
CallingConvention = CallingConvention.Cdecl)]
internal static extern FocusedWindowType GetFocusedWindowTypeNative_64();
[DllImport("QuickLook.Native.Shell32.x64.dll", EntryPoint = "GetCurrentSelection",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void GetCurrentSelectionNative_64([MarshalAs(UnmanagedType.LPWStr)] StringBuilder sb);
internal static FocusedWindowType GetFocusedWindowType()
{
return App.Is64Bit ? GetFocusedWindowTypeNative_64() : GetFocusedWindowTypeNative_32();
}
internal static string GetCurrentSelection()
{
@@ -20,7 +34,10 @@ namespace QuickLook.NativeMethods
Task.Run(() =>
{
sb = new StringBuilder(255 + 1);
GetCurrentSelectionNative(sb);
if (App.Is64Bit)
GetCurrentSelectionNative_64(sb);
else
GetCurrentSelectionNative_32(sb);
}).Wait();
return sb?.ToString() ?? string.Empty;

View File

@@ -1,39 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace QuickLook.NativeMethods.Shell32
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("000214F9-0000-0000-C000-000000000046")]
internal interface IShellLink
{
void GetPath([Out] [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
int cchMaxPath,
out IntPtr pfd,
int fFlags);
void GetIDList(out IntPtr ppidl);
void SetIDList(IntPtr pidl);
void GetDescription([Out] [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
void GetWorkingDirectory([Out] [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
void GetArguments([Out] [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
void GetHotkey(out short pwHotkey);
void SetHotkey(short wHotkey);
void GetShowCmd(out int piShowCmd);
void SetShowCmd(int iShowCmd);
void GetIconLocation([Out] [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
int cchIconPath,
out int piIcon);
void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
void Resolve(IntPtr hwnd, int fFlags);
void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
}
}

View File

@@ -1,12 +0,0 @@
using System.Runtime.InteropServices;
namespace QuickLook.NativeMethods.Shell32
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("F935DC21-1CF0-11D0-ADB9-00C04FD58A0B")]
internal interface IWshShell
{
IWshShortcut CreateShortcut(string pathLink);
}
}

View File

@@ -1,22 +0,0 @@
using System.Runtime.InteropServices;
namespace QuickLook.NativeMethods.Shell32
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("F935DC23-1CF0-11D0-ADB9-00C04FD58A0B")]
internal interface IWshShortcut
{
string FullName { get; }
string Arguments { get; set; }
string Description { get; set; }
string Hotkey { get; set; }
string IconLocation { get; set; }
string RelativePath { set; }
string TargetPath { get; set; }
int WindowStyle { get; set; }
string WorkingDirectory { get; set; }
void Load([In] string pathLink);
void Save();
}
}

View File

@@ -1,10 +0,0 @@
using System.Runtime.InteropServices;
namespace QuickLook.NativeMethods.Shell32
{
[ComImport]
[Guid("00021401-0000-0000-C000-000000000046")]
internal class ShellLink
{
}
}

View File

@@ -1,10 +0,0 @@
using System.Runtime.InteropServices;
namespace QuickLook.NativeMethods.Shell32
{
[ComImport]
[Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")]
internal class WshShell
{
}
}

View File

@@ -56,6 +56,26 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Build\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\Build\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
@@ -111,11 +131,6 @@
<Compile Include="Helpers\FileHelper.cs" />
<Compile Include="Helpers\ProcessHelper.cs" />
<Compile Include="MainWindowNoTransparent.cs" />
<Compile Include="NativeMethods\Shell32\IShellLink.cs" />
<Compile Include="NativeMethods\Shell32\IWshShell.cs" />
<Compile Include="NativeMethods\Shell32\IWshShortcut.cs" />
<Compile Include="NativeMethods\Shell32\ShellLink.cs" />
<Compile Include="NativeMethods\Shell32\WshShell.cs" />
<Compile Include="Helpers\PidHelper.cs" />
<Compile Include="PluginManager.cs" />
<Compile Include="Plugin\InfoPanel\DpiHelpers.cs" />
@@ -224,6 +239,17 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<COMReference Include="Shell32">
<Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>"$(SolutionDir)update-version.cmd" "$(SolutionDir)" "$(SolutionDir)GitVersion.cs"</PreBuildEvent>