mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-19 06:14:11 +08:00
4ba1d83cf5
* Improves handling of Gcode Thumbnails * Remove Peek support * Moves GcodeHelper to PreviewHandlerCommon * Reverts minor change * Skip unknown data on GcodeHelper.GetBestThumbnail * Replaces QOI.Core with QoiImage * Fixes spellchecker * Reverts changes to NOTICE.md * Minor QoiImage improvements * Use custom QoiPixel struct * Add MIT notice for the QOI reference code * Fix spellcheck for the MIT notice * Update NOTICE.md tweaked notice a bit |
||
---|---|---|
.. | ||
common | ||
GcodePreviewHandler | ||
GcodePreviewHandlerCpp | ||
GcodeThumbnailProvider | ||
GcodeThumbnailProviderCpp | ||
MarkdownPreviewHandler | ||
MarkdownPreviewHandlerCpp | ||
MonacoPreviewHandler | ||
MonacoPreviewHandlerCpp | ||
PdfPreviewHandler | ||
PdfPreviewHandlerCpp | ||
PdfThumbnailProvider | ||
PdfThumbnailProviderCpp | ||
powerpreview | ||
StlThumbnailProvider | ||
StlThumbnailProviderCpp | ||
SvgPreviewHandler | ||
SvgPreviewHandlerCpp | ||
SvgThumbnailProvider | ||
SvgThumbnailProviderCpp | ||
UnitTests-GcodePreviewHandler | ||
UnitTests-GcodeThumbnailProvider | ||
UnitTests-MarkdownPreviewHandler | ||
UnitTests-PdfPreviewHandler | ||
UnitTests-PdfThumbnailProvider | ||
UnitTests-PreviewHandlerCommon | ||
UnitTests-StlThumbnailProvider | ||
UnitTests-SvgPreviewHandler | ||
UnitTests-SvgThumbnailProvider | ||
README.md | ||
STATestClassAttribute.cs | ||
STATestMethodAttribute.cs |
File Explorer
End user facing:
Developing
- Add new C++ DLL project in the preview pane folder. This DLL is actual preview handler, i.e. implements IPreviewHandler/IThumbnailProvider interface.
- Add new .NET EXE project in the preview pane folder. This EXE is being spawned by C++ DLL to generate preview/thumbnail.
Installation
MSI (Recommended)
To add a new Previewer update the Product.wxs
file in PowerToysSetup
similar to existing Previewer to register the Preview Handler. More details about registration of Preview Handlers can be found here. - implemented in modulesRegistry.h.
Directly registering/unregistering DLL's
[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.
Registering Preview Handler
- Restart Visual studio as administrator.
- Sign
XYZPreviewHandler
and it's dependencies. To sign an assembly in VS, follow steps given here. - Build
XYZPreviewHandler
project. - Open developer command prompt from
Tools > Command Line > Developer Command Prompt
. - Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC).
gacutil -i <path to dependency>
- Run following commands to register preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
gacutil -i <path to XYZPreviewHandler.dll>
RegAsm.exe /codebase <path to XYZPreviewHandler.dll>
- Restart Windows Explorer process.
Unregistering Preview Handler
- Run following commands in elevated developer command prompt to unregister preview handler.
cd C:\Windows\Microsoft.NET\Framework64\4.0.x.x
RegAsm.exe /unregister <path to XYZPreviewHandler.dll>
gacutil -u XYZPreviewHandler
Debugging
Since in-process preview handlers run under a surrogate hosting process (prevhost.exe by default), to debug a preview handler, you need to attach the debugger to the host process.
- Click on a file with registered extension to start host process.
- Attach debugger in Visual studio from
Debug->Attach to Process
and selectprevhost.exe
with typeManaged(version), x64
.
Managing Preview Handlers
After successful integration, your preview handler should appear in the PowerToys settings UI under the File Explorer Preview
Tab. In here you should be able to enable and disable all the preview handles.