diff --git a/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj b/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj new file mode 100644 index 0000000..ff9c606 --- /dev/null +++ b/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj @@ -0,0 +1,89 @@ + + + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {794E4DCF-F715-4836-9D30-ABD296586D23} + QuickLookNativeShell32x64 + 10.0.15063.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + $(SolutionDir)Build\$(Configuration)\ + .dll + + + $(SolutionDir)Build\$(Configuration)\ + + + + Level3 + Disabled + true + MultiThreadedDebug + + + + + Level3 + MaxSpeed + true + true + true + MultiThreaded + + + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj.filters b/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj.filters new file mode 100644 index 0000000..2af5468 --- /dev/null +++ b/QuickLook.Native.Shell32.x64/QuickLook.Native.Shell32.x64.vcxproj.filters @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Native.Shell32/QuickLook.Native.Shell32.h b/QuickLook.Native.Shell32/QuickLook.Native.Shell32.h index 8b13789..e69de29 100644 --- a/QuickLook.Native.Shell32/QuickLook.Native.Shell32.h +++ b/QuickLook.Native.Shell32/QuickLook.Native.Shell32.h @@ -1 +0,0 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj index e70627d..fc2da8c 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj @@ -31,6 +31,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + diff --git a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj index e458db4..c441b9b 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj @@ -34,6 +34,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + diff --git a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj index e73788b..9e2880c 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj @@ -32,6 +32,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.IPreviewHandlers\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.IPreviewHandlers\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs index 28418b2..faa9fe0 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs @@ -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; diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj index 6f3903d..340f035 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj @@ -33,12 +33,30 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + ..\..\packages\ExifLib.1.7.0.0\lib\net45\ExifLib.dll - - ..\..\packages\Magick.NET-Q8-x86.7.0.5.900\lib\net40-client\Magick.NET-Q8-x86.dll + + ..\..\packages\Magick.NET-Q8-AnyCPU.7.0.5.900\lib\net40-client\Magick.NET-Q8-AnyCPU.dll @@ -84,11 +102,4 @@ - - - - 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}. - - - \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config index 94a91d8..5a07804 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj index 8404382..ff508b6 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj @@ -31,6 +31,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs index 5ec9f01..4dfec3e 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs @@ -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); } } } \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.x64.dll b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.x64.dll new file mode 100644 index 0000000..85900b5 Binary files /dev/null and b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.x64.dll differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs index 57a749b..21d48f6 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs @@ -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; } diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj index 671e91e..dbe9fd9 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj @@ -33,6 +33,26 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\ + DEBUG;TRACE + true + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\ + TRACE + true + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + @@ -69,6 +89,9 @@ Always + + Always + diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj index 852b094..4b791c5 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj @@ -31,6 +31,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.TextViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.TextViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + ..\..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj index be18c36..9ea6e2a 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj @@ -13,6 +13,8 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 + + true @@ -32,6 +34,24 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + ..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + ..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll @@ -41,7 +61,8 @@ 4.0 - + + False References\Unosquare.FFmpegMediaElement.dll diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/References/Unosquare.FFmpegMediaElement.dll b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/References/Unosquare.FFmpegMediaElement.dll index e1c1e78..8e14d76 100644 Binary files a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/References/Unosquare.FFmpegMediaElement.dll and b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/References/Unosquare.FFmpegMediaElement.dll differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml index ad54dbc..f91ab94 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml @@ -38,9 +38,10 @@ - + - + diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs index 38a2cfe..fbe005a 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs @@ -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; diff --git a/QuickLook.sln b/QuickLook.sln index 7c702a8..4609a7d 100644 --- a/QuickLook.sln +++ b/QuickLook.sln @@ -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 diff --git a/QuickLook/App.xaml.cs b/QuickLook/App.xaml.cs index d8ace31..b0ecd3b 100644 --- a/QuickLook/App.xaml.cs +++ b/QuickLook/App.xaml.cs @@ -13,6 +13,7 @@ namespace QuickLook /// 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; diff --git a/QuickLook/Helpers/AutoStartupHelper.cs b/QuickLook/Helpers/AutoStartupHelper.cs index 62cee1f..baf43e9 100644 --- a/QuickLook/Helpers/AutoStartupHelper.cs +++ b/QuickLook/Helpers/AutoStartupHelper.cs @@ -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) { diff --git a/QuickLook/Helpers/FileHelper.cs b/QuickLook/Helpers/FileHelper.cs index 9c983bf..8afcb97 100644 --- a/QuickLook/Helpers/FileHelper.cs +++ b/QuickLook/Helpers/FileHelper.cs @@ -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); diff --git a/QuickLook/MainWindowTransparent.xaml b/QuickLook/MainWindowTransparent.xaml index ad23a5d..2cdb588 100644 --- a/QuickLook/MainWindowTransparent.xaml +++ b/QuickLook/MainWindowTransparent.xaml @@ -72,7 +72,7 @@ - + { sb = new StringBuilder(255 + 1); - GetCurrentSelectionNative(sb); + if (App.Is64Bit) + GetCurrentSelectionNative_64(sb); + else + GetCurrentSelectionNative_32(sb); }).Wait(); return sb?.ToString() ?? string.Empty; diff --git a/QuickLook/NativeMethods/Shell32/IShellLink.cs b/QuickLook/NativeMethods/Shell32/IShellLink.cs deleted file mode 100644 index bc136c6..0000000 --- a/QuickLook/NativeMethods/Shell32/IShellLink.cs +++ /dev/null @@ -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); - } -} \ No newline at end of file diff --git a/QuickLook/NativeMethods/Shell32/IWshShell.cs b/QuickLook/NativeMethods/Shell32/IWshShell.cs deleted file mode 100644 index 174e59d..0000000 --- a/QuickLook/NativeMethods/Shell32/IWshShell.cs +++ /dev/null @@ -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); - } -} \ No newline at end of file diff --git a/QuickLook/NativeMethods/Shell32/IWshShortcut.cs b/QuickLook/NativeMethods/Shell32/IWshShortcut.cs deleted file mode 100644 index bd25b16..0000000 --- a/QuickLook/NativeMethods/Shell32/IWshShortcut.cs +++ /dev/null @@ -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(); - } -} \ No newline at end of file diff --git a/QuickLook/NativeMethods/Shell32/ShellLink.cs b/QuickLook/NativeMethods/Shell32/ShellLink.cs deleted file mode 100644 index f637363..0000000 --- a/QuickLook/NativeMethods/Shell32/ShellLink.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.InteropServices; - -namespace QuickLook.NativeMethods.Shell32 -{ - [ComImport] - [Guid("00021401-0000-0000-C000-000000000046")] - internal class ShellLink - { - } -} \ No newline at end of file diff --git a/QuickLook/NativeMethods/Shell32/WshShell.cs b/QuickLook/NativeMethods/Shell32/WshShell.cs deleted file mode 100644 index 49ecfb2..0000000 --- a/QuickLook/NativeMethods/Shell32/WshShell.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.InteropServices; - -namespace QuickLook.NativeMethods.Shell32 -{ - [ComImport] - [Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")] - internal class WshShell - { - } -} \ No newline at end of file diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index a8841cd..51169ca 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -56,6 +56,26 @@ app.manifest + + true + ..\Build\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + ..\Build\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + ..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll @@ -111,11 +131,6 @@ - - - - - @@ -224,6 +239,17 @@ Always + + + {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} + 1 + 0 + 0 + tlbimp + False + True + + "$(SolutionDir)update-version.cmd" "$(SolutionDir)" "$(SolutionDir)GitVersion.cs"