mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-08 23:00:51 +00:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
892b9bf4d2 | ||
![]() |
13d6edd2c9 | ||
![]() |
fd080f80e4 | ||
![]() |
b9d83bfd91 | ||
![]() |
a672e441d0 | ||
![]() |
f6843eef93 | ||
![]() |
3f8fd95e7f | ||
![]() |
375b3b9a59 | ||
![]() |
b210b03383 | ||
![]() |
a65ddce4cf | ||
![]() |
f18aa022f7 | ||
![]() |
3f82070deb | ||
![]() |
9e64e068d0 | ||
![]() |
d76fa8ff00 | ||
![]() |
ac2bdcc9fc | ||
![]() |
5b2ecc2ef8 | ||
![]() |
b44a3a6e51 | ||
![]() |
c97f6b0c8a | ||
![]() |
eef76468c4 | ||
![]() |
23d90b3de4 | ||
![]() |
ba2d5d2ab2 | ||
![]() |
3e99427d0b | ||
![]() |
40f1a377a7 | ||
![]() |
26291fbe66 | ||
![]() |
b07457b53c | ||
![]() |
8388d7d347 | ||
![]() |
0995ebb7c2 | ||
![]() |
66759992f1 | ||
![]() |
719d2772bf | ||
![]() |
43ba30f4d0 | ||
![]() |
073b1df8a3 | ||
![]() |
aaa9a405a8 | ||
![]() |
58886d3302 | ||
![]() |
fb1d67e5a0 | ||
![]() |
efaea8163d | ||
![]() |
689a3a7878 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -288,3 +288,4 @@ __pycache__/
|
||||
*.xsd.cs
|
||||
|
||||
/QuickLook.Plugin.PDFViewer/MoonPdfLib
|
||||
/GitVersion.cs
|
||||
|
@@ -1,2 +0,0 @@
|
||||
bc a -r Debug_%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip Build\Debug\*.exe Build\Debug\*.dll
|
||||
bc a -r Release_%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip Build\Release\*.exe Build\Release\*.dll
|
@@ -30,7 +30,7 @@ namespace QuickLook.Plugin.ArchiveViewer
|
||||
return true;
|
||||
}
|
||||
|
||||
public void BoundViewSize(string path, ContextObject context)
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size {Width = 800, Height = 600};
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace QuickLook.Plugin.ArchiveViewer
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Cleanup()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace QuickLook.Plugin.ArchiveViewer
|
||||
|
||||
~Plugin()
|
||||
{
|
||||
Dispose();
|
||||
Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
@@ -30,6 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -12,24 +12,23 @@
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
@@ -50,6 +49,9 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ArchiveInfoPanel.xaml.cs">
|
||||
<DependentUpon>ArchiveInfoPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/cef.pak
Normal file
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/cef.pak
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/icudtl.dat
Normal file
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/icudtl.dat
Normal file
Binary file not shown.
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/libEGL.dll
Normal file
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/libEGL.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/libcef.dll
Normal file
BIN
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/libcef.dll
Normal file
Binary file not shown.
Binary file not shown.
14203
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/natives_blob.bin
Normal file
14203
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/CefSharp/natives_blob.bin
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
35
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/MenuHandler.cs
Normal file
35
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/MenuHandler.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
using CefSharp;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
internal class MenuHandler : IContextMenuHandler
|
||||
{
|
||||
public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IContextMenuParams parameters,
|
||||
IMenuModel model)
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IContextMenuParams parameters,
|
||||
CefMenuCommand commandId, CefEventFlags eventFlags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame)
|
||||
{
|
||||
}
|
||||
|
||||
public bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IContextMenuParams parameters,
|
||||
IMenuModel model, IRunContextMenuCallback callback)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
58
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs
Normal file
58
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Plugin.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
public class Plugin : IViewer
|
||||
{
|
||||
private WebkitPanel _panel;
|
||||
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
switch (Path.GetExtension(path).ToLower())
|
||||
{
|
||||
case ".html":
|
||||
case ".htm":
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size(800, 800);
|
||||
|
||||
context.Focusable = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_panel = new WebkitPanel();
|
||||
context.ViewerContent = _panel;
|
||||
context.Title = Path.IsPathRooted(path) ? Path.GetFileName(path) : path;
|
||||
|
||||
_panel.Navigate(path);
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
_panel?.Dispose();
|
||||
}
|
||||
|
||||
~Plugin()
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("QuickLook.Plugin.HtmlViewer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("QuickLook.Plugin.HtmlViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
62
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Properties/Resources.Designer.cs
generated
Normal file
62
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if ((resourceMan == null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("QuickLook.Plugin.HtmlViewer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Properties/Settings.Designer.cs
generated
Normal file
30
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}</ProjectGuid>
|
||||
<OutputType>library</OutputType>
|
||||
<RootNamespace>QuickLook.Plugin.HtmlViewer</RootNamespace>
|
||||
<AssemblyName>QuickLook.Plugin.HtmlViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CefSharp, Version=57.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\CefSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CefSharp.Core, Version=57.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\CefSharp.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CefSharp.Wpf, Version=57.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>References\CefSharp.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="WebkitPanel.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="MenuHandler.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="RequestHandler.cs" />
|
||||
<Compile Include="UrlHelper.cs" />
|
||||
<Compile Include="WebkitPanel.xaml.cs">
|
||||
<DependentUpon>WebkitPanel.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<ContentWithTargetPath Include="CefSharp\cef.pak">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>cef.pak</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\cef_100_percent.pak">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>cef_100_percent.pak</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\cef_200_percent.pak">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>cef_200_percent.pak</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\cef_extensions.pak">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>cef_extensions.pak</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\icudtl.dat">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>icudtl.dat</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\locales\en-US.pak">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>locales\en-US.pak</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\natives_blob.bin">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>natives_blob.bin</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\snapshot_blob.bin">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>snapshot_blob.bin</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||
<Name>QuickLook</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ContentWithTargetPath Include="CefSharp\CefSharp.BrowserSubprocess.Core.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>CefSharp.BrowserSubprocess.Core.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\CefSharp.BrowserSubprocess.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>CefSharp.BrowserSubprocess.exe</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\chrome_elf.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>chrome_elf.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\d3dcompiler_47.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>d3dcompiler_47.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\libcef.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>libcef.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\libEGL.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>libEGL.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\libGLESv2.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>libGLESv2.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
<ContentWithTargetPath Include="CefSharp\widevinecdmadapter.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<TargetPath>widevinecdmadapter.dll</TargetPath>
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
7720
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/References/CefSharp.xml
Normal file
7720
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/References/CefSharp.xml
Normal file
File diff suppressed because it is too large
Load Diff
113
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/RequestHandler.cs
Normal file
113
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/RequestHandler.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using CefSharp;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
public class RequestHandler : IRequestHandler
|
||||
{
|
||||
bool IRequestHandler.OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IRequest request, bool isRedirect)
|
||||
{
|
||||
return request.TransitionType != TransitionType.Explicit;
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture)
|
||||
{
|
||||
return OnOpenUrlFromTab(browserControl, browser, frame, targetUrl, targetDisposition, userGesture);
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode,
|
||||
string requestUrl, ISslInfo sslInfo, IRequestCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
void IRequestHandler.OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath)
|
||||
{
|
||||
}
|
||||
|
||||
CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IRequest request, IRequestCallback callback)
|
||||
{
|
||||
return CefReturnValue.Continue;
|
||||
}
|
||||
|
||||
bool IRequestHandler.GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy,
|
||||
string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback)
|
||||
{
|
||||
//NOTE: If you do not wish to implement this method returning false is the default behaviour
|
||||
// We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
|
||||
|
||||
return OnSelectClientCertificate(browserControl, browser, isProxy, host, port, certificates, callback);
|
||||
}
|
||||
|
||||
void IRequestHandler.OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser,
|
||||
CefTerminationStatus status)
|
||||
{
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl,
|
||||
long newSize, IRequestCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
void IRequestHandler.OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IRequest request, IResponse response, ref string newUrl)
|
||||
{
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void IRequestHandler.OnRenderViewReady(IWebBrowser browserControl, IBrowser browser)
|
||||
{
|
||||
}
|
||||
|
||||
bool IRequestHandler.OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IRequest request, IResponse response)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IResponseFilter IRequestHandler.GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser,
|
||||
IFrame frame, IRequest request, IResponse response)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
void IRequestHandler.OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame,
|
||||
string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy,
|
||||
string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback)
|
||||
{
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
27
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/UrlHelper.cs
Normal file
27
QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/UrlHelper.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
internal static class UrlHelper
|
||||
{
|
||||
internal static string FilePathToFileUrl(string filePath)
|
||||
{
|
||||
var uri = new StringBuilder();
|
||||
foreach (var v in filePath)
|
||||
if (v >= 'a' && v <= 'z' || v >= 'A' && v <= 'Z' || v >= '0' && v <= '9' ||
|
||||
v == '+' || v == '/' || v == ':' || v == '.' || v == '-' || v == '_' || v == '~' ||
|
||||
v > '\xFF')
|
||||
uri.Append(v);
|
||||
else if (v == Path.DirectorySeparatorChar || v == Path.AltDirectorySeparatorChar)
|
||||
uri.Append('/');
|
||||
else
|
||||
uri.Append($"%{(int) v:X2}");
|
||||
if (uri.Length >= 2 && uri[0] == '/' && uri[1] == '/') // UNC path
|
||||
uri.Insert(0, "file:");
|
||||
else
|
||||
uri.Insert(0, "file:///");
|
||||
return uri.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,15 +1,13 @@
|
||||
<UserControl x:Class="QuickLook.ViewContentContainer"
|
||||
<UserControl x:Class="QuickLook.Plugin.HtmlViewer.WebkitPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:QuickLook"
|
||||
xmlns:local="clr-namespace:QuickLook.Plugin.HtmlViewer"
|
||||
xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<ContentControl x:Name="container">
|
||||
<Label Content="ContentControl Placeholder" VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center" Background="LightGray" />
|
||||
</ContentControl>
|
||||
<cef:ChromiumWebBrowser x:Name="browser" />
|
||||
</Grid>
|
||||
</UserControl>
|
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using CefSharp;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UserControl1.xaml
|
||||
/// </summary>
|
||||
public partial class WebkitPanel : UserControl, IDisposable
|
||||
{
|
||||
private readonly string _cefPath =
|
||||
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
||||
|
||||
public WebkitPanel()
|
||||
{
|
||||
var libraryLoader = new CefLibraryHandle(Path.Combine(_cefPath, "libcef.dll"));
|
||||
|
||||
if (!Cef.IsInitialized)
|
||||
Cef.Initialize(new CefSettings
|
||||
{
|
||||
BrowserSubprocessPath = Path.Combine(_cefPath, "CefSharp.BrowserSubprocess.exe"),
|
||||
LocalesDirPath = Path.Combine(_cefPath, "locales"),
|
||||
ResourcesDirPath = _cefPath,
|
||||
LogSeverity = LogSeverity.Disable,
|
||||
CefCommandLineArgs = {new KeyValuePair<string, string>("disable-gpu", "1")}
|
||||
});
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Application.Current.Exit += (sender, e) => Cef.Shutdown();
|
||||
|
||||
browser.RequestHandler = new RequestHandler();
|
||||
browser.MenuHandler = new MenuHandler();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
browser?.Dispose();
|
||||
}
|
||||
|
||||
public void Navigate(string path)
|
||||
{
|
||||
if (Path.IsPathRooted(path))
|
||||
path = UrlHelper.FilePathToFileUrl(path);
|
||||
|
||||
browser.IsBrowserInitializedChanged += (sender, e) => browser.Load(path);
|
||||
}
|
||||
|
||||
public void LoadHtml(string html, string path)
|
||||
{
|
||||
if (Path.IsPathRooted(path))
|
||||
path = UrlHelper.FilePathToFileUrl(path);
|
||||
|
||||
browser.IsBrowserInitializedChanged += (sender, e) => browser.LoadHtml(html, path);
|
||||
}
|
||||
}
|
||||
}
|
@@ -30,6 +30,13 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
|
||||
viewPanel.PreviewMouseLeftButtonDown += ViewPanel_PreviewMouseLeftButtonDown;
|
||||
viewPanel.PreviewMouseMove += ViewPanel_PreviewMouseMove;
|
||||
|
||||
viewPanel.TouchDown += ViewPanel_TouchDown;
|
||||
}
|
||||
|
||||
private void ViewPanel_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
// TODO: touch support
|
||||
}
|
||||
|
||||
private void LoadImage(string path)
|
||||
|
@@ -33,7 +33,7 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
}
|
||||
}
|
||||
|
||||
public void BoundViewSize(string path, ContextObject context)
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
_imageSize = ImageFileHelper.GetImageSize(path);
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
_ip = new ImagePanel(path);
|
||||
|
||||
context.ViewerContent = _ip;
|
||||
context.Title = $"{Path.GetFileName(path)} ({_imageSize.Width} × {_imageSize.Height})";
|
||||
context.Title = $"{Path.GetFileName(path)} ({_imageSize.Width}×{_imageSize.Height})";
|
||||
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -12,24 +12,23 @@
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
@@ -49,6 +48,9 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ImageFileHelper.cs" />
|
||||
<Compile Include="ImagePanel.xaml.cs">
|
||||
<DependentUpon>ImagePanel.xaml</DependentUpon>
|
||||
|
67
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs
Normal file
67
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Plugin.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using QuickLook.Plugin.HtmlViewer;
|
||||
|
||||
namespace QuickLook.Plugin.MarkdownViewer
|
||||
{
|
||||
public class Plugin : IViewer
|
||||
{
|
||||
private WebkitPanel _panel;
|
||||
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
switch (Path.GetExtension(path).ToLower())
|
||||
{
|
||||
case ".md":
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size(800, 800);
|
||||
|
||||
context.Focusable = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_panel = new WebkitPanel();
|
||||
context.ViewerContent = _panel;
|
||||
context.Title = Path.GetFileName(path);
|
||||
|
||||
_panel.LoadHtml(GenerateMarkdownHtml(path), path);
|
||||
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
_panel?.Dispose();
|
||||
}
|
||||
|
||||
~Plugin()
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
private string GenerateMarkdownHtml(string path)
|
||||
{
|
||||
var md = File.ReadAllText(path);
|
||||
var html = Resources.md2html.Replace("{{content}}", md);
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("QuickLook.Plugin.ImageViewer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("QuickLook.Plugin.ImageViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fe5a5111-9607-4721-a7be-422754002ed8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>QuickLook.Plugin.MarkdownViewer</RootNamespace>
|
||||
<AssemblyName>QuickLook.Plugin.MarkdownViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||
<Name>QuickLook</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\QuickLook.Plugin.HtmlViewer\QuickLook.Plugin.HtmlViewer.csproj">
|
||||
<Project>{ce22a1f3-7f2c-4ec8-bfde-b58d0eb625fc}</Project>
|
||||
<Name>QuickLook.Plugin.HtmlViewer</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\md2html.html" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
79
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources.Designer.cs
generated
Normal file
79
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,79 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace QuickLook.Plugin.MarkdownViewer {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("QuickLook.Plugin.MarkdownViewer.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <!DOCTYPE html>
|
||||
///<html>
|
||||
/// <head>
|
||||
/// <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
/// </head>
|
||||
/// <body>
|
||||
/// <textarea id="text-input" style="display:none;">{{content}}</textarea>
|
||||
/// <style><!-- https://github.com/sindresorhus/github-markdown-css -->.markdown-body hr::after,.markdown-body::after{clear:both}@font-face{font-family:octicons-link;src:url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAA [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string md2html {
|
||||
get {
|
||||
return ResourceManager.GetString("md2html", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources.resx
Normal file
124
QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/Resources.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="md2html" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\md2html.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
File diff suppressed because one or more lines are too long
@@ -31,7 +31,7 @@ namespace QuickLook.Plugin.OfficeViewer
|
||||
return false;
|
||||
}
|
||||
|
||||
public void BoundViewSize(string path, ContextObject context)
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.SetPreferredSizeFit(new Size {Width = 800, Height = 600}, 0.8);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace QuickLook.Plugin.OfficeViewer
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Cleanup()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace QuickLook.Plugin.OfficeViewer
|
||||
|
||||
~PluginInterface()
|
||||
{
|
||||
Dispose();
|
||||
Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
@@ -48,6 +48,4 @@ using System.Windows;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -13,24 +13,23 @@
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.OfficeViewer\</OutputPath>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.OfficeViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.OfficeViewer\</OutputPath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.OfficeViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
@@ -67,6 +66,9 @@
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="OfficeInteropWrapper.cs" />
|
||||
<Compile Include="PluginInterface.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
@@ -102,14 +102,6 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
}
|
||||
}
|
||||
|
||||
internal struct NativePage
|
||||
{
|
||||
public Matrix Ctm;
|
||||
public Rectangle MediaBox;
|
||||
public int Rotate;
|
||||
}
|
||||
|
||||
|
||||
internal class NativeMethods
|
||||
{
|
||||
private const uint FZ_STORE_DEFAULT = 256 << 20;
|
||||
|
@@ -24,7 +24,7 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
}
|
||||
}
|
||||
|
||||
public void BoundViewSize(string path, ContextObject context)
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
_pdfControl = new PdfViewerControl();
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Cleanup()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace QuickLook.Plugin.PDFViewer
|
||||
|
||||
~Plugin()
|
||||
{
|
||||
Dispose();
|
||||
Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
@@ -30,6 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -12,26 +12,25 @@
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
@@ -49,6 +48,9 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="PdfViewerControl.xaml.cs">
|
||||
<DependentUpon>PdfViewerControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@@ -40,9 +40,10 @@ namespace QuickLook.Plugin.TextViewer
|
||||
}
|
||||
}
|
||||
|
||||
public void BoundViewSize(string path, ContextObject context)
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
context.PreferredSize = new Size {Width = 800, Height = 600};
|
||||
context.Focusable = true;
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
@@ -55,7 +56,7 @@ namespace QuickLook.Plugin.TextViewer
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
@@ -12,24 +12,23 @@
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</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">
|
||||
@@ -46,6 +45,9 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TextViewerPanel.xaml.cs">
|
||||
|
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer
|
||||
{
|
||||
public sealed class DecimalToTimeSpanConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return "00:00:00";
|
||||
|
||||
var time = TimeSpan.FromSeconds((double) (decimal) value);
|
||||
|
||||
return time.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
|
||||
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DoubleToTimeSpanConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
return "00:00:00";
|
||||
|
||||
var time = TimeSpan.FromSeconds((double) value);
|
||||
|
||||
return time.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
|
||||
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="SliderRepeatButton" TargetType="RepeatButton">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Setter Property="IsTabStop" Value="false" />
|
||||
<Setter Property="Focusable" Value="false" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RepeatButton">
|
||||
<Border BorderThickness="1" BorderBrush="Gray" Background="Gray" Height="3" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SliderRepeatButton1" TargetType="RepeatButton">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RepeatButton">
|
||||
<Border SnapsToDevicePixels="True" Background="Gray" BorderThickness="1" BorderBrush="Gray"
|
||||
Height="3" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SliderThumb" TargetType="Thumb">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Ellipse Height="12" Width="12" Fill="Gray" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="Slider" TargetType="Slider">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Track Grid.Row="1" x:Name="PART_Track">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Style="{StaticResource SliderRepeatButton1}" Command="Slider.DecreaseLarge" />
|
||||
</Track.DecreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb Style="{StaticResource SliderThumb}" />
|
||||
</Track.Thumb>
|
||||
<Track.IncreaseRepeatButton>
|
||||
<RepeatButton Style="{StaticResource SliderRepeatButton}" Command="Slider.IncreaseLarge" />
|
||||
</Track.IncreaseRepeatButton>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="HorizontalSlider" TargetType="Slider">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Orientation" Value="Horizontal">
|
||||
<Setter Property="MinHeight" Value="10" />
|
||||
<Setter Property="MinWidth" Value="104" />
|
||||
<Setter Property="Template" Value="{StaticResource Slider}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Unosquare.FFmpegMediaElement;
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer
|
||||
{
|
||||
public class PluginInterface : IViewer
|
||||
{
|
||||
private ViewerPanel _vp;
|
||||
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
public bool CanHandle(string path)
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
var formats = new[]
|
||||
{
|
||||
".3g2", ".3gp", ".3gp2", ".3gpp", ".amv", ".asf", ".asf", ".avi", ".flv", ".m2ts", ".m4v", ".mkv",
|
||||
".mov", ".mp4", ".mp4v", ".mpeg", ".mpg", ".ogv", ".qt", ".vob", ".webm", ".wmv"
|
||||
};
|
||||
|
||||
if (formats.Contains(Path.GetExtension(path).ToLower()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
using (var element = new MediaElement {Source = new Uri(path)})
|
||||
{
|
||||
context.SetPreferredSizeFit(new Size(element.NaturalVideoWidth, element.NaturalVideoHeight), 0.6);
|
||||
context.PreferredSize = new Size(context.PreferredSize.Width,
|
||||
context.PreferredSize.Height + 26); // add control bar
|
||||
}
|
||||
}
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_vp = new ViewerPanel(context);
|
||||
|
||||
context.ViewerContent = _vp;
|
||||
|
||||
_vp.LoadAndPlay(path);
|
||||
|
||||
context.Title =
|
||||
$"{Path.GetFileName(path)} ({_vp.mediaElement.NaturalVideoWidth}×{_vp.mediaElement.NaturalVideoHeight})";
|
||||
context.IsBusy = false;
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
_vp?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("QuickLook.Plugin.VideoViewer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("QuickLook.Plugin.VideoViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
62
QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Properties/Resources.Designer.cs
generated
Normal file
62
QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if ((resourceMan == null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("QuickLook.Plugin.VideoViewer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Properties/Settings.Designer.cs
generated
Normal file
26
QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1B746D92-49A5-4A37-9D75-DCC490393290}</ProjectGuid>
|
||||
<OutputType>library</OutputType>
|
||||
<RootNamespace>QuickLook.Plugin.VideoViewer</RootNamespace>
|
||||
<AssemblyName>QuickLook.Plugin.VideoViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.VideoViewer\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</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>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="Unosquare.FFmpegMediaElement">
|
||||
<HintPath>References\Unosquare.FFmpegMediaElement.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="HorizontalSliderStyle.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ViewerPanel.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="..\..\GitVersion.cs">
|
||||
<Link>Properties\GitVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="DoubleToHMSConverter.cs" />
|
||||
<Compile Include="PluginInterface.cs" />
|
||||
<Compile Include="ViewerPanel.xaml.cs">
|
||||
<DependentUpon>ViewerPanel.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||
<Name>QuickLook</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
<UserControl x:Class="QuickLook.Plugin.VideoViewer.ViewerPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||
xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer"
|
||||
xmlns:ffmpeg="clr-namespace:Unosquare.FFmpegMediaElement;assembly=Unosquare.FFmpegMediaElement"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<ResourceDictionary>
|
||||
<local:DoubleToTimeSpanConverter x:Key="DoubleToTimeSpanConverter" />
|
||||
<local:DecimalToTimeSpanConverter x:Key="DecimalToTimeSpanConverter" />
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="HorizontalSliderStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Grid.Resources>
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Bottom" Height="26" Margin="-1,0,0,0">
|
||||
<fa:ImageAwesome DockPanel.Dock="Left" x:Name="buttonPlayPause" Icon="PauseCircleOutline"
|
||||
Height="16" Width="16" Margin="5,5" Foreground="Gray"
|
||||
Cursor="Hand" />
|
||||
<StackPanel DockPanel.Dock="Right" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Orientation="Horizontal" Margin="10,0,7,0">
|
||||
<TextBlock FontSize="14"
|
||||
Text="{Binding Position, ElementName=mediaElement,Converter={StaticResource DecimalToTimeSpanConverter}}" />
|
||||
<TextBlock FontSize="14" Text=" / " />
|
||||
<TextBlock FontSize="14"
|
||||
Text="{Binding NaturalDuration, StringFormat=hh:mm:ss, ElementName=mediaElement,Converter={StaticResource DoubleToTimeSpanConverter}}" />
|
||||
</StackPanel>
|
||||
<Slider x:Name="sliderProgress" Style="{StaticResource HorizontalSlider}"
|
||||
Margin="0,0,0,0" VerticalAlignment="Center"
|
||||
Value="{Binding Position, ElementName=mediaElement}"
|
||||
Maximum="{Binding NaturalDuration, ElementName=mediaElement, Mode=OneWay}" />
|
||||
</DockPanel>
|
||||
<ffmpeg:MediaElement x:Name="mediaElement" />
|
||||
</DockPanel>
|
||||
<Label x:Name="errorOverlay" Visibility="Collapsed" Background="#CCAAAAAA" VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center">
|
||||
Video load failed.
|
||||
</Label>
|
||||
</Grid>
|
||||
</UserControl>
|
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using FontAwesome.WPF;
|
||||
using Unosquare.FFmpegMediaElement;
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UserControl1.xaml
|
||||
/// </summary>
|
||||
public partial class ViewerPanel : UserControl, IDisposable
|
||||
{
|
||||
private readonly ContextObject _context;
|
||||
|
||||
public ViewerPanel(ContextObject context)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_context = context;
|
||||
|
||||
buttonPlayPause.MouseLeftButtonUp += TogglePlayPause;
|
||||
|
||||
mediaElement.PropertyChanged += ChangePlayPauseButton;
|
||||
mediaElement.MouseLeftButtonUp += TogglePlayPause;
|
||||
mediaElement.MediaErrored += ShowErrorNotification;
|
||||
mediaElement.MediaFailed += ShowErrorNotification;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
mediaElement?.Dispose();
|
||||
}
|
||||
|
||||
private void TogglePlayPause(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (mediaElement.IsPlaying)
|
||||
mediaElement.Pause();
|
||||
else
|
||||
mediaElement.Play();
|
||||
}
|
||||
|
||||
private void ChangePlayPauseButton(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != "IsPlaying" && e.PropertyName != "HasMediaEnded")
|
||||
return;
|
||||
|
||||
buttonPlayPause.Icon = mediaElement.IsPlaying
|
||||
? FontAwesomeIcon.PauseCircleOutline
|
||||
: FontAwesomeIcon.PlayCircleOutline;
|
||||
}
|
||||
|
||||
private void ShowErrorNotification(object sender, MediaErrorRoutedEventArgs e)
|
||||
{
|
||||
mediaElement.Stop();
|
||||
|
||||
_context.ShowNotification("", "An error occurred while loading the video.");
|
||||
}
|
||||
|
||||
public void LoadAndPlay(string path)
|
||||
{
|
||||
mediaElement.Source = new Uri(path);
|
||||
mediaElement.Play();
|
||||
}
|
||||
|
||||
~ViewerPanel()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net452" />
|
||||
</packages>
|
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26403.7
|
||||
VisualStudioVersion = 15.0.26430.6
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook", "QuickLook\QuickLook.csproj", "{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@@ -22,40 +22,85 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.TextViewer
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.OfficeViewer", "QuickLook.Plugin\QuickLook.Plugin.OfficeViewer\QuickLook.Plugin.OfficeViewer.csproj", "{E37675EA-D957-4495-8655-2609BF86756C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.VideoViewer", "QuickLook.Plugin\QuickLook.Plugin.VideoViewer\QuickLook.Plugin.VideoViewer.csproj", "{1B746D92-49A5-4A37-9D75-DCC490393290}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BAE81497-98FA-4A7A-A0FB-2B86C9694B9C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
GitVersion.cs = GitVersion.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.HtmlViewer", "QuickLook.Plugin\QuickLook.Plugin.HtmlViewer\QuickLook.Plugin.HtmlViewer.csproj", "{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.MarkdownViewer", "QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\QuickLook.Plugin.MarkdownViewer.csproj", "{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{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|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|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|x86.ActiveCfg = Release|Win32
|
||||
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x86.Build.0 = Release|Win32
|
||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{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|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|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|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|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|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|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|x86.ActiveCfg = Release|x86
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.Build.0 = Release|x86
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{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|x86.ActiveCfg = Release|x86
|
||||
{E37675EA-D957-4495-8655-2609BF86756C}.Release|x86.Build.0 = Release|x86
|
||||
{1B746D92-49A5-4A37-9D75-DCC490393290}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{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|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|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|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|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|x86.ActiveCfg = Release|x86
|
||||
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -66,5 +111,8 @@ Global
|
||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
{E37675EA-D957-4495-8655-2609BF86756C} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
{1B746D92-49A5-4A37-9D75-DCC490393290} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
{CE22A1F3-7F2C-4EC8-BFDE-B58D0EB625FC} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -1,6 +1,18 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=QuickLook_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AB1270AF_002D7EB4_002D4B4F_002D9E09_002D6404F1A28EA0_002Fd_003AResources_002Ff_003Amd2html_002Ehtml/@EntryIndexedValue"></s:String>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AB1270AF_002D7EB4_002D4B4F_002D9E09_002D6404F1A28EA0_002Fd_003AResources_002Ff_003Amd2html_002Ehtml/@EntryIndexRemoved">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=1B746D92_002D49A5_002D4A37_002D9D75_002DDCC490393290_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">1B746D92-49A5-4A37-9D75-DCC490393290/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=8B4A9CE5_002D67B5_002D4A94_002D81CB_002D3771F688FDEB_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">8B4A9CE5-67B5-4A94-81CB-3771F688FDEB/d:Properties/f:GitVersion.cs/l:..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=A82AC69C_002DEDF5_002D4F0D_002D8CBD_002D8E5E3C06E64D_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=AB1270AF_002D7EB4_002D4B4F_002D9E09_002D6404F1A28EA0_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=AB1270AF_002D7EB4_002D4B4F_002D9E09_002D6404F1A28EA0_002Fd_003AResources_002Ff_003Amd2html_002Ehtml/@EntryIndexedValue">AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0/d:Resources/f:md2html.html</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=AE041682_002DE3A1_002D44F6_002D8BB4_002D916A98D89FBE_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">AE041682-E3A1-44F6-8BB4-916A98D89FBE/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=BAE81497_002D98FA_002D4A7A_002DA0FB_002D2B86C9694B9C_002Ff_003AGitVersion_002Ecs_002Fs_003A_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">BAE81497-98FA-4A7A-A0FB-2B86C9694B9C/f:GitVersion.cs/s:..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=DE2E3BC5_002D6AB2_002D4420_002DA160_002D48C7A7506C1C_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">DE2E3BC5-6AB2-4420-A160-48C7A7506C1C/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=E37675EA_002DD957_002D4495_002D8655_002D2609BF86756C_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">E37675EA-D957-4495-8655-2609BF86756C/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=FE5A5111_002D9607_002D4721_002DA7BE_002D422754002ED8_002Fd_003AProperties_002Ff_003AGitVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FGitVersion_002Ecs/@EntryIndexedValue">FE5A5111-9607-4721-A7BE-422754002ED8/d:Properties/f:GitVersion.cs/l:..?..?..?GitVersion.cs</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Reformat Code</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_AUTO_PROPERTY/@EntryValue">0</s:Int64>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
|
||||
|
@@ -4,4 +4,7 @@
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<legacyCorruptedStateExceptionsPolicy enabled="true" />
|
||||
</runtime>
|
||||
</configuration>
|
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:QuickLook"
|
||||
Startup="Application_Startup"
|
||||
Exit="App_OnExit"
|
||||
ShutdownMode="OnExplicitShutdown">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
|
||||
@@ -10,22 +12,81 @@ namespace QuickLook
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public static string AppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
public static readonly string AppFullPath = Assembly.GetExecutingAssembly().Location;
|
||||
public static readonly string AppPath = Path.GetDirectoryName(AppFullPath);
|
||||
public static bool RunningAsViewer;
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
(sender, args) => MessageBox.Show(((Exception) args.ExceptionObject).Message + Environment.NewLine +
|
||||
((Exception) args.ExceptionObject).StackTrace);
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
|
||||
{
|
||||
MessageBox.Show(((Exception) args.ExceptionObject).Message + Environment.NewLine +
|
||||
((Exception) args.ExceptionObject).StackTrace);
|
||||
|
||||
Current.Shutdown();
|
||||
};
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
if (e.Args.Any())
|
||||
if (Directory.Exists(e.Args.First()) || File.Exists(e.Args.First()))
|
||||
RunAsViewer(e);
|
||||
else
|
||||
RunAsListener(e);
|
||||
else
|
||||
RunAsListener(e);
|
||||
}
|
||||
|
||||
private void RunAsViewer(StartupEventArgs e)
|
||||
{
|
||||
RunningAsViewer = true;
|
||||
|
||||
var runningPid = PidHelper.GetRunningInstance();
|
||||
if (runningPid != -1)
|
||||
{
|
||||
Process.GetProcessById(runningPid).Kill();
|
||||
|
||||
Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
PidHelper.WritePid();
|
||||
|
||||
ViewWindowManager.GetInstance().InvokeViewer(e.Args.First());
|
||||
}
|
||||
|
||||
private void RunAsListener(StartupEventArgs e)
|
||||
{
|
||||
RunningAsViewer = false;
|
||||
|
||||
if (PidHelper.GetRunningInstance() != -1)
|
||||
{
|
||||
MessageBox.Show("QuickLook is already running in the background.");
|
||||
|
||||
Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
PidHelper.WritePid();
|
||||
|
||||
TrayIconManager.GetInstance();
|
||||
if (!e.Args.Contains("/autorun"))
|
||||
TrayIconManager.GetInstance().ShowNotification("", "QuickLook is running in the background.");
|
||||
|
||||
PluginManager.GetInstance();
|
||||
|
||||
BackgroundListener.GetInstance();
|
||||
}
|
||||
|
||||
private void App_OnExit(object sender, ExitEventArgs e)
|
||||
{
|
||||
TrayIconManager.GetInstance().Dispose();
|
||||
BackgroundListener.GetInstance().Dispose();
|
||||
|
||||
PidHelper.DeletePid();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,9 @@
|
||||
using System.Windows.Forms;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace QuickLook
|
||||
{
|
||||
internal class BackgroundListener
|
||||
internal class BackgroundListener : IDisposable
|
||||
{
|
||||
private static BackgroundListener _instance;
|
||||
|
||||
@@ -13,9 +14,17 @@ namespace QuickLook
|
||||
InstallHook(HotkeyEventHandler);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_hook?.Dispose();
|
||||
}
|
||||
|
||||
private void HotkeyEventHandler(object sender, KeyEventArgs e)
|
||||
{
|
||||
ViewWindowManager.GetInstance().InvokeRoutine();
|
||||
if (e.Modifiers != Keys.None)
|
||||
return;
|
||||
|
||||
ViewWindowManager.GetInstance().InvokeRoutine(e.KeyCode != Keys.Space);
|
||||
}
|
||||
|
||||
private void InstallHook(KeyEventHandler handler)
|
||||
@@ -23,6 +32,10 @@ namespace QuickLook
|
||||
_hook = GlobalKeyboardHook.GetInstance();
|
||||
|
||||
_hook.HookedKeys.Add(Keys.Space);
|
||||
_hook.HookedKeys.Add(Keys.Up);
|
||||
_hook.HookedKeys.Add(Keys.Down);
|
||||
_hook.HookedKeys.Add(Keys.Left);
|
||||
_hook.HookedKeys.Add(Keys.Right);
|
||||
|
||||
_hook.KeyUp += handler;
|
||||
}
|
||||
|
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using QuickLook.NativeMethods;
|
||||
using KeyEventArgs = System.Windows.Forms.KeyEventArgs;
|
||||
using KeyEventHandler = System.Windows.Forms.KeyEventHandler;
|
||||
|
||||
namespace QuickLook
|
||||
{
|
||||
@@ -62,6 +65,8 @@ namespace QuickLook
|
||||
var key = (Keys) lParam.vkCode;
|
||||
if (HookedKeys.Contains(key))
|
||||
{
|
||||
key = AddModifiers(key);
|
||||
|
||||
var kea = new KeyEventArgs(key);
|
||||
if (wParam == User32.WM_KEYDOWN || wParam == User32.WM_SYSKEYDOWN)
|
||||
KeyDown?.Invoke(this, kea);
|
||||
@@ -73,5 +78,19 @@ namespace QuickLook
|
||||
}
|
||||
return User32.CallNextHookEx(_hhook, code, wParam, ref lParam);
|
||||
}
|
||||
|
||||
private Keys AddModifiers(Keys key)
|
||||
{
|
||||
//Ctrl
|
||||
if ((Keyboard.Modifiers & ModifierKeys.Control) != 0) key = key | Keys.Control;
|
||||
|
||||
//Shift
|
||||
if ((Keyboard.Modifiers & ModifierKeys.Shift) != 0) key = key | Keys.Shift;
|
||||
|
||||
//Alt
|
||||
if ((Keyboard.Modifiers & ModifierKeys.Alt) != 0) key = key | Keys.Alt;
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace QuickLook.Helpers
|
||||
{
|
||||
internal static class AeroGlassHelper
|
||||
{
|
||||
internal static void EnableBlur(Window window)
|
||||
{
|
||||
var windowHelper = new WindowInteropHelper(window);
|
||||
|
||||
var accent = new AccentPolicy();
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
|
||||
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
|
||||
var data = new WindowCompositionAttributeData();
|
||||
data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
|
||||
data.SizeOfData = accentStructSize;
|
||||
data.Data = accentPtr;
|
||||
|
||||
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||
|
||||
Marshal.FreeHGlobal(accentPtr);
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct WindowCompositionAttributeData
|
||||
{
|
||||
public WindowCompositionAttribute Attribute;
|
||||
public IntPtr Data;
|
||||
public int SizeOfData;
|
||||
}
|
||||
|
||||
private enum WindowCompositionAttribute
|
||||
{
|
||||
// ...
|
||||
WCA_ACCENT_POLICY = 19
|
||||
// ...
|
||||
}
|
||||
|
||||
private enum AccentState
|
||||
{
|
||||
ACCENT_DISABLED = 0,
|
||||
ACCENT_ENABLE_GRADIENT = 1,
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||
ACCENT_INVALID_STATE = 4
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct AccentPolicy
|
||||
{
|
||||
public AccentState AccentState;
|
||||
public readonly int AccentFlags;
|
||||
public readonly int GradientColor;
|
||||
public readonly int AnimationId;
|
||||
}
|
||||
}
|
||||
}
|
45
QuickLook/Helpers/AutoStartupHelper.cs
Normal file
45
QuickLook/Helpers/AutoStartupHelper.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using QuickLook.NativeMethods;
|
||||
|
||||
namespace QuickLook.Helpers
|
||||
{
|
||||
internal static class AutoStartupHelper
|
||||
{
|
||||
private static readonly string _startupFullPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Startup),
|
||||
Path.ChangeExtension(Path.GetFileName(App.AppFullPath), ".lnk"));
|
||||
|
||||
internal static void CreateAutorunShortcut()
|
||||
{
|
||||
try
|
||||
{
|
||||
var link = (IShellLink) new ShellLink();
|
||||
|
||||
link.SetPath(App.AppFullPath);
|
||||
link.SetWorkingDirectory(App.AppPath);
|
||||
link.SetIconLocation(App.AppFullPath, 0);
|
||||
|
||||
link.SetArguments($"/autorun"); // silent
|
||||
|
||||
var file = (IPersistFile) link;
|
||||
file.Save(_startupFullPath, false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
TrayIconManager.GetInstance().ShowNotification("", "Failed to add QuickLook to Startup folder.");
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveAutorunShortcut()
|
||||
{
|
||||
File.Delete(_startupFullPath);
|
||||
}
|
||||
|
||||
internal static bool IsAutorun()
|
||||
{
|
||||
return File.Exists(_startupFullPath);
|
||||
}
|
||||
}
|
||||
}
|
59
QuickLook/Helpers/BlurLibrary/BlurWindow.cs
Normal file
59
QuickLook/Helpers/BlurLibrary/BlurWindow.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary
|
||||
{
|
||||
public static class BlurWindow
|
||||
{
|
||||
private static readonly IWindowBlurController BlurController;
|
||||
|
||||
static BlurWindow()
|
||||
{
|
||||
BlurController = Helpers.GetWindowControllerForOs(OsHelper.GetOsType());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current blur state
|
||||
/// </summary>
|
||||
public static bool Enabled => BlurController.Enabled;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if blur can be enabled.
|
||||
/// </summary>
|
||||
public static bool CanBeEnabled => BlurController.CanBeEnabled;
|
||||
|
||||
private static void EnableWindowBlur(IntPtr hwnd)
|
||||
{
|
||||
if (!CanBeEnabled)
|
||||
return;
|
||||
|
||||
BlurController.EnableBlur(hwnd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable blur for window
|
||||
/// </summary>
|
||||
/// <param name="window">Window object</param>
|
||||
public static void EnableWindowBlur(Window window)
|
||||
{
|
||||
EnableWindowBlur(Helpers.GetWindowHandle(window));
|
||||
}
|
||||
|
||||
private static void DisableWindowBlur(IntPtr hwnd)
|
||||
{
|
||||
if (!CanBeEnabled)
|
||||
return;
|
||||
|
||||
BlurController.DisableBlur(hwnd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable blur for window
|
||||
/// </summary>
|
||||
/// <param name="window">Window object</param>
|
||||
public static void DisableWindowBlur(Window window)
|
||||
{
|
||||
DisableWindowBlur(Helpers.GetWindowHandle(window));
|
||||
}
|
||||
}
|
||||
}
|
36
QuickLook/Helpers/BlurLibrary/Helpers.cs
Normal file
36
QuickLook/Helpers/BlurLibrary/Helpers.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using QuickLook.Helpers.BlurLibrary.PlatformsImpl;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary
|
||||
{
|
||||
internal static class Helpers
|
||||
{
|
||||
internal static IWindowBlurController GetWindowControllerForOs(OsType osType)
|
||||
{
|
||||
switch (osType)
|
||||
{
|
||||
case OsType.WindowsVista:
|
||||
return new WindowsVistaWindowBlurController();
|
||||
case OsType.Windows7:
|
||||
return new Windows7WindowBlurController();
|
||||
case OsType.Windows8:
|
||||
return new Windows8WindowBlurController();
|
||||
case OsType.Windows81:
|
||||
return new Windows81WindowBlurController();
|
||||
case OsType.Windows10:
|
||||
return new Windows10WindowBlurController();
|
||||
case OsType.Other:
|
||||
return new OsNotSupportedWindowBlurController();
|
||||
default:
|
||||
return new OsNotSupportedWindowBlurController();
|
||||
}
|
||||
}
|
||||
|
||||
internal static IntPtr GetWindowHandle(Window window)
|
||||
{
|
||||
return new WindowInteropHelper(window).Handle;
|
||||
}
|
||||
}
|
||||
}
|
31
QuickLook/Helpers/BlurLibrary/IWindowBlurController.cs
Normal file
31
QuickLook/Helpers/BlurLibrary/IWindowBlurController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary
|
||||
{
|
||||
internal interface IWindowBlurController
|
||||
{
|
||||
/// <summary>
|
||||
/// Current blur state
|
||||
/// </summary>
|
||||
bool Enabled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks if blur can be enabled.
|
||||
/// </summary>
|
||||
bool CanBeEnabled { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable blur for window
|
||||
/// </summary>
|
||||
/// <param name="hwnd">Pointer to Window</param>
|
||||
/// <exception cref="NotImplementedException">Throws when blur is not supported.</exception>
|
||||
void EnableBlur(IntPtr hwnd);
|
||||
|
||||
/// <summary>
|
||||
/// Disable blur for window
|
||||
/// </summary>
|
||||
/// <param name="hwnd">Pointer to Window</param>
|
||||
/// <exception cref="NotImplementedException">Throws when blur is not supported.</exception>
|
||||
void DisableBlur(IntPtr hwnd);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using System.Security;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings
|
||||
{
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
internal static class NativeMethods
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.Windows10
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct AccentPolicy
|
||||
{
|
||||
public AccentState AccentState;
|
||||
public int AccentFlags;
|
||||
public int GradientColor;
|
||||
public int AnimationId;
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.Windows10
|
||||
{
|
||||
internal enum AccentState
|
||||
{
|
||||
ACCENT_DISABLED = 0,
|
||||
ACCENT_ENABLE_GRADIENT = 1,
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||
ACCENT_INVALID_STATE = 4
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.Windows10
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.Windows10
|
||||
{
|
||||
internal enum WindowCompositionAttribute
|
||||
{
|
||||
// ...
|
||||
WCA_ACCENT_POLICY = 19
|
||||
// ...
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.Windows10
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct WindowCompositionAttributeData
|
||||
{
|
||||
public WindowCompositionAttribute Attribute;
|
||||
public IntPtr Data;
|
||||
public int SizeOfData;
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ReSharper disable FieldCanBeMadeReadOnly.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable once CheckNamespace
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.NativeThings.WindowsVistaAnd7
|
||||
{
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[Flags]
|
||||
public enum DWM_BB
|
||||
{
|
||||
DWM_BB_ENABLE = 1,
|
||||
DWM_BB_BLURREGION = 2,
|
||||
DWM_BB_TRANSITIONONMAXIMIZED = 4
|
||||
}
|
||||
|
||||
public const int WM_DWMCOMPOSITIONCHANGED = 0x031E;
|
||||
|
||||
[DllImport("dwmapi.dll", PreserveSig = false)]
|
||||
public static extern bool DwmIsCompositionEnabled();
|
||||
|
||||
[DllImport("dwmapi.dll", PreserveSig = false)]
|
||||
public static extern void DwmEnableBlurBehindWindow(IntPtr hwnd, ref DWM_BLURBEHIND blurBehind);
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct DWM_BLURBEHIND
|
||||
{
|
||||
public DWM_BB dwFlags;
|
||||
public bool fEnable;
|
||||
public IntPtr hRgnBlur;
|
||||
public bool fTransitionOnMaximized;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MARGINS
|
||||
{
|
||||
public int cxLeftWidth;
|
||||
public int cxRightWidth;
|
||||
public int cyTopHeight;
|
||||
public int cyBottomHeight;
|
||||
}
|
||||
}
|
||||
}
|
32
QuickLook/Helpers/BlurLibrary/OsHelper.cs
Normal file
32
QuickLook/Helpers/BlurLibrary/OsHelper.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary
|
||||
{
|
||||
internal static class OsHelper
|
||||
{
|
||||
public static OsType GetOsType()
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major != 6 && Environment.OSVersion.Version.Major != 10)
|
||||
return OsType.Other;
|
||||
|
||||
if (Environment.OSVersion.Version.Major != 6)
|
||||
return Environment.OSVersion.Version.Major == 10
|
||||
? OsType.Windows10
|
||||
: OsType.Other;
|
||||
|
||||
switch (Environment.OSVersion.Version.Minor)
|
||||
{
|
||||
case 0:
|
||||
return OsType.WindowsVista;
|
||||
case 1:
|
||||
return OsType.Windows7;
|
||||
case 2:
|
||||
return OsType.Windows8;
|
||||
case 3:
|
||||
return OsType.Windows81;
|
||||
default:
|
||||
return OsType.Other;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
QuickLook/Helpers/BlurLibrary/OsType.cs
Normal file
12
QuickLook/Helpers/BlurLibrary/OsType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace QuickLook.Helpers.BlurLibrary
|
||||
{
|
||||
internal enum OsType
|
||||
{
|
||||
WindowsVista,
|
||||
Windows7,
|
||||
Windows8,
|
||||
Windows81,
|
||||
Windows10,
|
||||
Other
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
public class OsNotSupportedWindowBlurController : IWindowBlurController
|
||||
{
|
||||
public void EnableBlur(IntPtr hwnd)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void DisableBlur(IntPtr hwnd)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public bool Enabled { get; } = false;
|
||||
public bool CanBeEnabled { get; } = false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using QuickLook.Helpers.BlurLibrary.NativeThings.Windows10;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
internal class Windows10WindowBlurController : IWindowBlurController
|
||||
{
|
||||
public void EnableBlur(IntPtr hwnd)
|
||||
{
|
||||
var accent = new AccentPolicy {AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND};
|
||||
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
|
||||
var data = new WindowCompositionAttributeData
|
||||
{
|
||||
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||
SizeOfData = accentStructSize,
|
||||
Data = accentPtr
|
||||
};
|
||||
|
||||
NativeThings.Windows10.NativeMethods.SetWindowCompositionAttribute(hwnd, ref data);
|
||||
|
||||
Marshal.FreeHGlobal(accentPtr);
|
||||
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public void DisableBlur(IntPtr hwnd)
|
||||
{
|
||||
var accent = new AccentPolicy {AccentState = AccentState.ACCENT_DISABLED};
|
||||
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
|
||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||
|
||||
var data = new WindowCompositionAttributeData
|
||||
{
|
||||
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||
SizeOfData = accentStructSize,
|
||||
Data = accentPtr
|
||||
};
|
||||
|
||||
NativeThings.Windows10.NativeMethods.SetWindowCompositionAttribute(hwnd, ref data);
|
||||
|
||||
Marshal.FreeHGlobal(accentPtr);
|
||||
|
||||
Enabled = false;
|
||||
}
|
||||
|
||||
public bool Enabled { get; private set; }
|
||||
public bool CanBeEnabled { get; } = true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
internal class Windows7WindowBlurController : WindowsVistaWindowBlurController
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
internal class Windows81WindowBlurController : Windows8WindowBlurController
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
internal class Windows8WindowBlurController : OsNotSupportedWindowBlurController
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace QuickLook.Helpers.BlurLibrary.PlatformsImpl
|
||||
{
|
||||
internal class WindowsVistaWindowBlurController : IWindowBlurController
|
||||
{
|
||||
public void EnableBlur(IntPtr hwnd)
|
||||
{
|
||||
if (!NativeThings.WindowsVistaAnd7.NativeMethods.DwmIsCompositionEnabled())
|
||||
return;
|
||||
|
||||
HwndSource.FromHwnd(hwnd)?.AddHook(WndProc);
|
||||
|
||||
InitializeGlass(hwnd);
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public void DisableBlur(IntPtr hwnd)
|
||||
{
|
||||
if (!NativeThings.WindowsVistaAnd7.NativeMethods.DwmIsCompositionEnabled())
|
||||
return;
|
||||
|
||||
HwndSource.FromHwnd(hwnd)?.RemoveHook(WndProc);
|
||||
|
||||
DeinitializeGlass(hwnd);
|
||||
Enabled = false;
|
||||
}
|
||||
|
||||
public bool Enabled { get; private set; }
|
||||
|
||||
public bool CanBeEnabled { get; } = true;
|
||||
|
||||
private static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
if (msg != NativeThings.WindowsVistaAnd7.NativeMethods.WM_DWMCOMPOSITIONCHANGED)
|
||||
return IntPtr.Zero;
|
||||
|
||||
InitializeGlass(hwnd);
|
||||
handled = false;
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
private static void InitializeGlass(IntPtr hwnd)
|
||||
{
|
||||
// fill the background with glass
|
||||
var margins = new NativeThings.WindowsVistaAnd7.NativeMethods.MARGINS();
|
||||
margins.cxLeftWidth = margins.cxRightWidth = margins.cyBottomHeight = margins.cyTopHeight = -1;
|
||||
NativeThings.WindowsVistaAnd7.NativeMethods.DwmExtendFrameIntoClientArea(hwnd, ref margins);
|
||||
|
||||
// initialize blur for the window
|
||||
var bbh = new NativeThings.WindowsVistaAnd7.NativeMethods.DWM_BLURBEHIND
|
||||
{
|
||||
fEnable = true,
|
||||
dwFlags = NativeThings.WindowsVistaAnd7.NativeMethods.DWM_BB.DWM_BB_ENABLE
|
||||
};
|
||||
|
||||
NativeThings.WindowsVistaAnd7.NativeMethods.DwmEnableBlurBehindWindow(hwnd, ref bbh);
|
||||
}
|
||||
|
||||
private static void DeinitializeGlass(IntPtr hwnd)
|
||||
{
|
||||
// fill the background with glass
|
||||
var margins = new NativeThings.WindowsVistaAnd7.NativeMethods.MARGINS();
|
||||
margins.cxLeftWidth = margins.cxRightWidth = margins.cyBottomHeight = margins.cyTopHeight = -1;
|
||||
NativeThings.WindowsVistaAnd7.NativeMethods.DwmExtendFrameIntoClientArea(hwnd, ref margins);
|
||||
|
||||
// initialize blur for the window
|
||||
var bbh = new NativeThings.WindowsVistaAnd7.NativeMethods.DWM_BLURBEHIND
|
||||
{
|
||||
fEnable = false,
|
||||
dwFlags = NativeThings.WindowsVistaAnd7.NativeMethods.DWM_BB.DWM_BB_ENABLE
|
||||
};
|
||||
|
||||
NativeThings.WindowsVistaAnd7.NativeMethods.DwmEnableBlurBehindWindow(hwnd, ref bbh);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user