Safely check office preview handler
Some checks are pending
MSBuild / build (push) Waiting to run
MSBuild / publish (push) Blocked by required conditions

This commit is contained in:
ema
2025-06-11 18:12:31 +08:00
parent 5fd2d8a88a
commit 9a3591e6f6
3 changed files with 55 additions and 5 deletions

View File

@@ -49,8 +49,15 @@ public class Plugin : IViewer
if (Directory.Exists(path))
return false;
if (Extensions.Any(path.ToLower().EndsWith))
return PreviewHandlerHost.GetPreviewHandlerGUID(path) != Guid.Empty;
if (!Extensions.Any(path.ToLower().EndsWith))
return false;
var previewHandler = PreviewHandlerHost.GetPreviewHandlerGUID(path);
if (previewHandler == Guid.Empty)
return false;
if (!string.IsNullOrWhiteSpace(CLSIDRegister.GetName($"{{{previewHandler}}}")))
return true;
return false;
}