mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
.
This commit is contained in:
@@ -1,85 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows;
|
|
||||||
using SharpCompress.Archives.SevenZip;
|
|
||||||
using SharpCompress.Common;
|
|
||||||
using SharpCompress.Readers;
|
|
||||||
|
|
||||||
namespace QuickLook.Plugin.ArchiveViewer
|
|
||||||
{
|
|
||||||
public class Plugin : IViewer
|
|
||||||
{
|
|
||||||
public int Priority => 0;
|
|
||||||
|
|
||||||
public bool CanHandle(string path)
|
|
||||||
{
|
|
||||||
if (Directory.Exists(path))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
using (var s = File.OpenRead(path))
|
|
||||||
{
|
|
||||||
// The 7Zip format doesn't allow for reading as a forward-only stream so
|
|
||||||
// 7Zip is only supported through the Archive API.
|
|
||||||
if (SevenZipArchive.IsSevenZipFile(s))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
s.Seek(0, SeekOrigin.Begin);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ReaderFactory.Open(s);
|
|
||||||
}
|
|
||||||
catch (InvalidOperationException)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Prepare(string path, ViewContentContainer container)
|
|
||||||
{
|
|
||||||
container.PreferedSize = new Size {Width = 800, Height = 600};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void View(string path, ViewContentContainer container)
|
|
||||||
{
|
|
||||||
var files = new List<IEntry>();
|
|
||||||
|
|
||||||
if (SevenZipArchive.IsSevenZipFile(path))
|
|
||||||
GetItemsFromSevenZip(path, files);
|
|
||||||
else
|
|
||||||
GetItemsFromIReader(path, files);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetItemsFromSevenZip(string path, List<IEntry> files)
|
|
||||||
{
|
|
||||||
using (var s = File.OpenRead(path))
|
|
||||||
{
|
|
||||||
using (var reader = SevenZipArchive.Open(s))
|
|
||||||
{
|
|
||||||
foreach (var entry in reader.Entries)
|
|
||||||
files.Add(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetItemsFromIReader(string path, List<IEntry> files)
|
|
||||||
{
|
|
||||||
using (var s = File.OpenRead(path))
|
|
||||||
{
|
|
||||||
using (var reader = ReaderFactory.Open(s))
|
|
||||||
{
|
|
||||||
while (reader.MoveToNextEntry())
|
|
||||||
files.Add(reader.Entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<packages>
|
|
||||||
<package id="SharpCompress" version="0.15.2" targetFramework="net452" />
|
|
||||||
</packages>
|
|
@@ -1,35 +0,0 @@
|
|||||||
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.LastResort")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("QuickLook.Plugin.LastResort")]
|
|
||||||
[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("b9a5a4f6-813e-40ce-ad32-dc5c1356215d")]
|
|
||||||
|
|
||||||
// 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")]
|
|
@@ -1,73 +0,0 @@
|
|||||||
<?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>{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>QuickLook.Plugin.LastResort</RootNamespace>
|
|
||||||
<AssemblyName>QuickLook.Plugin.LastResort</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>..\Build\Debug\Plugins\QuickLook.Plugin.LastResort\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>..\Build\Release\Plugins\QuickLook.Plugin.LastResort\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="PresentationFramework" />
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xaml" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="WindowsBase" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Extensions.cs" />
|
|
||||||
<Compile Include="FileHelper.cs" />
|
|
||||||
<Compile Include="InfoPanel.xaml.cs">
|
|
||||||
<DependentUpon>InfoPanel.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Plugin.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="WindowsThumbnailProvider.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
|
|
||||||
<Project>{8B4A9CE5-67B5-4A94-81CB-3771F688FDEB}</Project>
|
|
||||||
<Name>QuickLook</Name>
|
|
||||||
<Private>False</Private>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Page Include="InfoPanel.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
@@ -0,0 +1,82 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
|
||||||
|
{
|
||||||
|
private readonly ArchiveFileEntry _parent;
|
||||||
|
private int _cachedDepth = -1;
|
||||||
|
private int _cachedLevel = -1;
|
||||||
|
|
||||||
|
public ArchiveFileEntry(string name, bool isFolder, ArchiveFileEntry parent = null)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
IsFolder = isFolder;
|
||||||
|
|
||||||
|
_parent = parent;
|
||||||
|
_parent?.Children.Add(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortedList<ArchiveFileEntry, bool> Children { get; set; } = new SortedList<ArchiveFileEntry, bool>();
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool Encrypted { get; set; }
|
||||||
|
public bool IsFolder { get; set; }
|
||||||
|
public ulong Size { get; set; }
|
||||||
|
public DateTime ModifiedDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum depth of all siblings
|
||||||
|
/// </summary>
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_cachedLevel != -1)
|
||||||
|
return _cachedLevel;
|
||||||
|
|
||||||
|
if (_parent == null)
|
||||||
|
_cachedLevel = GetDepth();
|
||||||
|
else
|
||||||
|
_cachedLevel = _parent.Level - 1;
|
||||||
|
|
||||||
|
return _cachedLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int CompareTo(ArchiveFileEntry other)
|
||||||
|
{
|
||||||
|
if (IsFolder == other.IsFolder)
|
||||||
|
return string.Compare(Name, other.Name, StringComparison.CurrentCulture);
|
||||||
|
|
||||||
|
if (IsFolder)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of nodes in the longest path to a leaf
|
||||||
|
/// </summary>
|
||||||
|
private int GetDepth()
|
||||||
|
{
|
||||||
|
if (_cachedDepth != -1)
|
||||||
|
return _cachedDepth;
|
||||||
|
|
||||||
|
var max = Children.Keys.Count == 0 ? 0 : Children.Keys.Max(r => r.GetDepth());
|
||||||
|
_cachedDepth = max + 1;
|
||||||
|
return _cachedDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (IsFolder)
|
||||||
|
return $"{Name}";
|
||||||
|
|
||||||
|
var en = Encrypted ? "*" : "";
|
||||||
|
return $"{Name}{en},{IsFolder},{Size},{ModifiedDate}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,142 @@
|
|||||||
|
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveFileListView"
|
||||||
|
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.Plugin.ArchiveViewer"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid Grid.IsSharedSizeScope="True"
|
||||||
|
x:Name="treeGrid">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<!-- Header row -->
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<!-- Row for data -->
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid.Resources>
|
||||||
|
|
||||||
|
<!-- Converts the level in the tree to the width of the spacer column -->
|
||||||
|
<local:LevelToIndentConverter x:Key="LevelToIndentConverter" />
|
||||||
|
<local:BooleanToAsteriskConverter x:Key="BooleanToAsteriskConverter" />
|
||||||
|
<local:SizePrettyPrintConverter x:Key="SizePrettyPrintConverter" />
|
||||||
|
<local:DatePrintConverter x:Key="DatePrintConverter" />
|
||||||
|
<local:FileExtToIconConverter x:Key="FileExtToIconConverter" />
|
||||||
|
<local:LevelToBooleanConverter x:Key="LevelToBooleanConverter" />
|
||||||
|
|
||||||
|
<!-- Template for directory information at all levels -->
|
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Children.Keys}"
|
||||||
|
DataType="{x:Type local:ArchiveFileEntry}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="2" />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="2" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="1" ShowGridLines="False">
|
||||||
|
<!-- All column widths are shared except for column 1 which is sized
|
||||||
|
to compensate for different indentation at each level -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition MinWidth="300" SharedSizeGroup="rowHeaderColumn" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition MinWidth="100" SharedSizeGroup="column1" />
|
||||||
|
<ColumnDefinition MinWidth="100" SharedSizeGroup="column2" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||||
|
<Image Width="16" Height="16">
|
||||||
|
<Image.Source>
|
||||||
|
<MultiBinding Converter="{StaticResource FileExtToIconConverter}">
|
||||||
|
<Binding Path="Name" />
|
||||||
|
<Binding Path="IsFolder" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<TextBlock Text="{Binding Name}" />
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding Encrypted, Converter={StaticResource BooleanToAsteriskConverter}}" />
|
||||||
|
</StackPanel>
|
||||||
|
<Rectangle Grid.Column="1">
|
||||||
|
<Rectangle.Width>
|
||||||
|
<MultiBinding Converter="{StaticResource LevelToIndentConverter}">
|
||||||
|
<Binding Path="Level" />
|
||||||
|
<Binding ElementName="treeViewItemToMeasure"
|
||||||
|
Path="ActualWidth" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Rectangle.Width>
|
||||||
|
</Rectangle>
|
||||||
|
<TextBlock Grid.Column="2">
|
||||||
|
<TextBlock.Text>
|
||||||
|
<MultiBinding Converter="{StaticResource SizePrettyPrintConverter}">
|
||||||
|
<Binding Path="Size" />
|
||||||
|
<Binding Path="IsFolder" />
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBlock.Text>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Grid.Column="3">
|
||||||
|
<TextBlock.Text>
|
||||||
|
<MultiBinding Converter="{StaticResource DatePrintConverter}">
|
||||||
|
<Binding Path="ModifiedDate" />
|
||||||
|
<Binding Path="IsFolder" />
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBlock.Text>
|
||||||
|
</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</HierarchicalDataTemplate>
|
||||||
|
</Grid.Resources>
|
||||||
|
|
||||||
|
<!-- Tree view with one item for the header row -->
|
||||||
|
|
||||||
|
<TreeView BorderThickness="0" Focusable="False" Background="Transparent"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<TreeViewItem Focusable="False">
|
||||||
|
<TreeViewItem.Header>
|
||||||
|
<Grid ShowGridLines="False">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition SharedSizeGroup="rowHeaderColumn" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition SharedSizeGroup="column1" />
|
||||||
|
<ColumnDefinition SharedSizeGroup="column2" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text=" " />
|
||||||
|
<TreeViewItem Grid.Column="1">
|
||||||
|
<TreeViewItem.Header>
|
||||||
|
<TreeViewItem x:Name="treeViewItemToMeasure"
|
||||||
|
Padding="0" />
|
||||||
|
</TreeViewItem.Header>
|
||||||
|
|
||||||
|
<!-- Set the width of Column 1 to the same width as the top level
|
||||||
|
in the data -->
|
||||||
|
<TreeViewItem.Width>
|
||||||
|
<MultiBinding Converter="{StaticResource LevelToIndentConverter}">
|
||||||
|
<Binding Path="Level" />
|
||||||
|
<Binding ElementName="treeViewItemToMeasure"
|
||||||
|
Path="ActualWidth" />
|
||||||
|
</MultiBinding>
|
||||||
|
</TreeViewItem.Width>
|
||||||
|
</TreeViewItem>
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Text="Original Size" />
|
||||||
|
<TextBlock Grid.Column="3"
|
||||||
|
Text="Modified Date" />
|
||||||
|
</Grid>
|
||||||
|
</TreeViewItem.Header>
|
||||||
|
</TreeViewItem>
|
||||||
|
</TreeView>
|
||||||
|
|
||||||
|
<!-- Tree view that will display hierarchical data rows -->
|
||||||
|
|
||||||
|
<TreeView Grid.Row="1"
|
||||||
|
x:Name="treeView"
|
||||||
|
BorderThickness="0" Background="Transparent"
|
||||||
|
ItemsSource="{Binding}">
|
||||||
|
<!--<TreeView.ItemContainerStyle>
|
||||||
|
<Style TargetType="{x:Type TreeViewItem}">
|
||||||
|
<Setter Property="IsExpanded" Value="{Binding Level, Converter={StaticResource LevelToBooleanConverter}}" />
|
||||||
|
</Style>
|
||||||
|
</TreeView.ItemContainerStyle>-->
|
||||||
|
</TreeView>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ArchiveFileListView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ArchiveFileListView : UserControl, IDisposable
|
||||||
|
{
|
||||||
|
public ArchiveFileListView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
IconManager.ClearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDataContext(object context)
|
||||||
|
{
|
||||||
|
treeGrid.DataContext = context;
|
||||||
|
|
||||||
|
treeView.Loaded += (sender, e) =>
|
||||||
|
{
|
||||||
|
// return when empty
|
||||||
|
if (treeView.Items.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// return when there are more than one root nodes
|
||||||
|
if (treeView.Items.Count > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var root = (TreeViewItem) treeView.ItemContainerGenerator.ContainerFromItem(treeView.Items[0]);
|
||||||
|
if (root == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
root.IsExpanded = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveInfoPanel"
|
||||||
|
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.Plugin.ArchiveViewer"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
x:Name="infoPanel"
|
||||||
|
d:DesignHeight="600" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<local:ArchiveFileListView Grid.Row="0" x:Name="fileListView" Focusable="False" />
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="40*" />
|
||||||
|
<ColumnDefinition Width="30*" />
|
||||||
|
<ColumnDefinition Width="30*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label x:Name="archiveCount" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">9 folders and 10 files, solid, password-protected</Label>
|
||||||
|
<Label x:Name="archiveSizeC" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">Compressed size 9999 bytes</Label>
|
||||||
|
<Label x:Name="archiveSizeU" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">Uncompressed size 99999 bytes</Label>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
@@ -0,0 +1,126 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using SevenZip;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ArchiveInfoPanel.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ArchiveInfoPanel : UserControl, IDisposable
|
||||||
|
{
|
||||||
|
private readonly Dictionary<string, ArchiveFileEntry> _fileEntries = new Dictionary<string, ArchiveFileEntry>();
|
||||||
|
private bool _solid;
|
||||||
|
private ulong _totalZippedSize;
|
||||||
|
private string _type;
|
||||||
|
|
||||||
|
public ArchiveInfoPanel(string path)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
LoadArchive(path);
|
||||||
|
|
||||||
|
fileListView.SetDataContext(_fileEntries[""].Children.Keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
fileListView.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadArchive(string path)
|
||||||
|
{
|
||||||
|
LoadItemsFromArchive(path);
|
||||||
|
|
||||||
|
var folder = 0;
|
||||||
|
var files = 0;
|
||||||
|
ulong sizeU = 0L;
|
||||||
|
_fileEntries.ForEach(e =>
|
||||||
|
{
|
||||||
|
if (e.Value.IsFolder)
|
||||||
|
folder++;
|
||||||
|
else
|
||||||
|
files++;
|
||||||
|
|
||||||
|
sizeU += e.Value.Size;
|
||||||
|
});
|
||||||
|
|
||||||
|
var s = _solid ? "solid" : "not solid";
|
||||||
|
|
||||||
|
archiveCount.Content =
|
||||||
|
$"{_type} archive, {s}, {folder - 1} folders and {files} files"; // do not count root node
|
||||||
|
archiveSizeC.Content = $"Compressed size {_totalZippedSize.ToPrettySize(2)}";
|
||||||
|
archiveSizeU.Content = $"Uncompressed size {sizeU.ToPrettySize(2)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadItemsFromArchive(string path)
|
||||||
|
{
|
||||||
|
using (var reader = new SevenZipExtractor(path))
|
||||||
|
{
|
||||||
|
_totalZippedSize = (ulong) reader.PackedSize;
|
||||||
|
_solid = reader.IsSolid;
|
||||||
|
_type = reader.Format.ToString();
|
||||||
|
|
||||||
|
var root = new ArchiveFileEntry(Path.GetFileName(path), true);
|
||||||
|
_fileEntries.Add("", root);
|
||||||
|
|
||||||
|
foreach (var entry in reader.ArchiveFileData)
|
||||||
|
ProcessByLevel(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessByLevel(ArchiveFileInfo entry)
|
||||||
|
{
|
||||||
|
var pf = GetPathFragments(entry.FileName);
|
||||||
|
|
||||||
|
// process folders. When entry is a directory, all fragments are folders.
|
||||||
|
pf.Take(entry.IsDirectory ? pf.Length : pf.Length - 1)
|
||||||
|
.ForEach(f =>
|
||||||
|
{
|
||||||
|
// skip if current dir is already added
|
||||||
|
if (_fileEntries.ContainsKey(f))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ArchiveFileEntry parent;
|
||||||
|
_fileEntries.TryGetValue(GetDirectoryName(f), out parent);
|
||||||
|
|
||||||
|
var afe = new ArchiveFileEntry(Path.GetFileName(f), true, parent);
|
||||||
|
|
||||||
|
_fileEntries.Add(f, afe);
|
||||||
|
});
|
||||||
|
|
||||||
|
// add the last path fragments, which is a file
|
||||||
|
if (!entry.IsDirectory)
|
||||||
|
{
|
||||||
|
var file = pf.Last();
|
||||||
|
|
||||||
|
ArchiveFileEntry parent;
|
||||||
|
_fileEntries.TryGetValue(GetDirectoryName(file), out parent);
|
||||||
|
|
||||||
|
_fileEntries.Add(file, new ArchiveFileEntry(Path.GetFileName(entry.FileName), false, parent)
|
||||||
|
{
|
||||||
|
Encrypted = entry.Encrypted,
|
||||||
|
Size = entry.Size,
|
||||||
|
ModifiedDate = entry.LastWriteTime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetDirectoryName(string path)
|
||||||
|
{
|
||||||
|
var d = Path.GetDirectoryName(path);
|
||||||
|
|
||||||
|
return d ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private string[] GetPathFragments(string path)
|
||||||
|
{
|
||||||
|
var frags = path.Split('\\');
|
||||||
|
|
||||||
|
return frags.Select((s, i) => frags.Take(i + 1).Aggregate((a, b) => a + "\\" + b)).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
103
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Converters.cs
Normal file
103
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Converters.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
public class LevelToIndentConverter : DependencyObject, IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var level = (int) values[0];
|
||||||
|
var indent = (double) values[1];
|
||||||
|
return indent * level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LevelToBooleanConverter : DependencyObject, IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var level = (int) value;
|
||||||
|
|
||||||
|
return level < 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BooleanToAsteriskConverter : DependencyObject, IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var b = (bool) value;
|
||||||
|
|
||||||
|
return b ? "*" : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SizePrettyPrintConverter : DependencyObject, IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var size = (ulong) values[0];
|
||||||
|
var isFolder = (bool) values[1];
|
||||||
|
|
||||||
|
return isFolder ? "" : size.ToPrettySize(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DatePrintConverter : DependencyObject, IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var date = (DateTime) values[0];
|
||||||
|
var isFolder = (bool) values[1];
|
||||||
|
|
||||||
|
return isFolder ? "" : date.ToString(CultureInfo.CurrentCulture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileExtToIconConverter : DependencyObject, IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var name = (string) values[0];
|
||||||
|
var isFolder = (bool) values[1];
|
||||||
|
|
||||||
|
if (isFolder)
|
||||||
|
return IconManager.FindIconForDir(false);
|
||||||
|
|
||||||
|
return IconManager.FindIconForFilename(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
|
||||||
|
{
|
||||||
|
foreach (var item in enumeration)
|
||||||
|
action(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetDescendantByType<T>(this Visual element) where T : class
|
||||||
|
{
|
||||||
|
if (element == null)
|
||||||
|
return default(T);
|
||||||
|
if (element.GetType() == typeof(T))
|
||||||
|
return element as T;
|
||||||
|
|
||||||
|
T foundElement = null;
|
||||||
|
(element as FrameworkElement)?.ApplyTemplate();
|
||||||
|
|
||||||
|
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
|
||||||
|
{
|
||||||
|
var visual = VisualTreeHelper.GetChild(element, i) as Visual;
|
||||||
|
foundElement = visual.GetDescendantByType<T>();
|
||||||
|
if (foundElement != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return foundElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToPrettySize(this ulong value, int decimalPlaces = 0)
|
||||||
|
{
|
||||||
|
const long OneKb = 1024;
|
||||||
|
const long OneMb = OneKb * 1024;
|
||||||
|
const long OneGb = OneMb * 1024;
|
||||||
|
const long OneTb = OneGb * 1024;
|
||||||
|
|
||||||
|
var asTb = Math.Round((double) value / OneTb, decimalPlaces);
|
||||||
|
var asGb = Math.Round((double) value / OneGb, decimalPlaces);
|
||||||
|
var asMb = Math.Round((double) value / OneMb, decimalPlaces);
|
||||||
|
var asKb = Math.Round((double) value / OneKb, decimalPlaces);
|
||||||
|
var chosenValue = asTb > 1
|
||||||
|
? $"{asTb} TB"
|
||||||
|
: asGb > 1
|
||||||
|
? $"{asGb} GB"
|
||||||
|
: asMb > 1
|
||||||
|
? $"{asMb} MB"
|
||||||
|
: asKb > 1
|
||||||
|
? $"{asKb} KB"
|
||||||
|
: $"{Math.Round((double) value, decimalPlaces)} bytes";
|
||||||
|
|
||||||
|
return chosenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
217
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/IconManager.cs
Normal file
217
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/IconManager.cs
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Internals are mostly from here:
|
||||||
|
/// http://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using
|
||||||
|
/// Caches all results.
|
||||||
|
/// </summary>
|
||||||
|
public static class IconManager
|
||||||
|
{
|
||||||
|
private static ImageSource SmallDirIcon;
|
||||||
|
private static ImageSource LargeDirIcon;
|
||||||
|
private static readonly Dictionary<string, ImageSource> SmallIconCache = new Dictionary<string, ImageSource>();
|
||||||
|
private static readonly Dictionary<string, ImageSource> LargeIconCache = new Dictionary<string, ImageSource>();
|
||||||
|
|
||||||
|
public static void ClearCache()
|
||||||
|
{
|
||||||
|
SmallDirIcon = LargeDirIcon = null;
|
||||||
|
|
||||||
|
SmallIconCache.Clear();
|
||||||
|
LargeIconCache.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the icon of a directory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="large">16x16 or 32x32 icon</param>
|
||||||
|
/// <returns>an icon</returns>
|
||||||
|
public static ImageSource FindIconForDir(bool large)
|
||||||
|
{
|
||||||
|
var icon = large ? LargeDirIcon : SmallDirIcon;
|
||||||
|
if (icon != null)
|
||||||
|
return icon;
|
||||||
|
icon = IconReader.GetFolderIcon(large ? IconReader.IconSize.Large : IconReader.IconSize.Small,
|
||||||
|
false)
|
||||||
|
.ToImageSource();
|
||||||
|
if (large)
|
||||||
|
LargeDirIcon = icon;
|
||||||
|
else
|
||||||
|
SmallDirIcon = icon;
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an icon for a given filename
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">any filename</param>
|
||||||
|
/// <param name="large">16x16 or 32x32 icon</param>
|
||||||
|
/// <returns>null if path is null, otherwise - an icon</returns>
|
||||||
|
public static ImageSource FindIconForFilename(string fileName, bool large)
|
||||||
|
{
|
||||||
|
var extension = Path.GetExtension(fileName);
|
||||||
|
if (extension == null)
|
||||||
|
return null;
|
||||||
|
var cache = large ? LargeIconCache : SmallIconCache;
|
||||||
|
ImageSource icon;
|
||||||
|
if (cache.TryGetValue(extension, out icon))
|
||||||
|
return icon;
|
||||||
|
icon = IconReader.GetFileIcon(fileName, large ? IconReader.IconSize.Large : IconReader.IconSize.Small,
|
||||||
|
false)
|
||||||
|
.ToImageSource();
|
||||||
|
cache.Add(extension, icon);
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// http://stackoverflow.com/a/6580799/1943849
|
||||||
|
/// </summary>
|
||||||
|
private static ImageSource ToImageSource(this Icon icon)
|
||||||
|
{
|
||||||
|
var imageSource = Imaging.CreateBitmapSourceFromHIcon(
|
||||||
|
icon.Handle,
|
||||||
|
Int32Rect.Empty,
|
||||||
|
BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
return imageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides static methods to read system icons for both folders and files.
|
||||||
|
/// </summary>
|
||||||
|
/// <example>
|
||||||
|
/// <code>IconReader.GetFileIcon("c:\\general.xls");</code>
|
||||||
|
/// </example>
|
||||||
|
private static class IconReader
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options to specify the size of icons to return.
|
||||||
|
/// </summary>
|
||||||
|
public enum IconSize
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specify large icon - 32 pixels by 32 pixels.
|
||||||
|
/// </summary>
|
||||||
|
Large = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Specify small icon - 16 pixels by 16 pixels.
|
||||||
|
/// </summary>
|
||||||
|
Small = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the icon of a folder.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="size">Large or small</param>
|
||||||
|
/// <param name="linkOverlay">Whether to include the link icon</param>
|
||||||
|
/// <returns>System.Drawing.Icon</returns>
|
||||||
|
public static Icon GetFolderIcon(IconSize size, bool linkOverlay)
|
||||||
|
{
|
||||||
|
var shfi = new Shell32.Shfileinfo();
|
||||||
|
var flags = Shell32.ShgfiIcon | Shell32.ShgfiUsefileattributes;
|
||||||
|
if (linkOverlay) flags += Shell32.ShgfiLinkoverlay;
|
||||||
|
/* Check the size specified for return. */
|
||||||
|
if (IconSize.Small == size)
|
||||||
|
flags += Shell32.ShgfiSmallicon;
|
||||||
|
else
|
||||||
|
flags += Shell32.ShgfiLargeicon;
|
||||||
|
Shell32.SHGetFileInfo("placeholder",
|
||||||
|
Shell32.FileAttributeDirectory,
|
||||||
|
ref shfi,
|
||||||
|
(uint) Marshal.SizeOf(shfi),
|
||||||
|
flags);
|
||||||
|
// Copy (clone) the returned icon to a new object, thus allowing us to clean-up properly
|
||||||
|
var icon = (Icon) Icon.FromHandle(shfi.hIcon).Clone();
|
||||||
|
User32.DestroyIcon(shfi.hIcon); // Cleanup
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an icon for a given file - indicated by the name parameter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Pathname for file.</param>
|
||||||
|
/// <param name="size">Large or small</param>
|
||||||
|
/// <param name="linkOverlay">Whether to include the link icon</param>
|
||||||
|
/// <returns>System.Drawing.Icon</returns>
|
||||||
|
public static Icon GetFileIcon(string name, IconSize size, bool linkOverlay)
|
||||||
|
{
|
||||||
|
var shfi = new Shell32.Shfileinfo();
|
||||||
|
var flags = Shell32.ShgfiIcon | Shell32.ShgfiUsefileattributes;
|
||||||
|
if (linkOverlay) flags += Shell32.ShgfiLinkoverlay;
|
||||||
|
/* Check the size specified for return. */
|
||||||
|
if (IconSize.Small == size)
|
||||||
|
flags += Shell32.ShgfiSmallicon;
|
||||||
|
else
|
||||||
|
flags += Shell32.ShgfiLargeicon;
|
||||||
|
Shell32.SHGetFileInfo(name,
|
||||||
|
Shell32.FileAttributeNormal,
|
||||||
|
ref shfi,
|
||||||
|
(uint) Marshal.SizeOf(shfi),
|
||||||
|
flags);
|
||||||
|
// Copy (clone) the returned icon to a new object, thus allowing us to clean-up properly
|
||||||
|
var icon = (Icon) Icon.FromHandle(shfi.hIcon).Clone();
|
||||||
|
User32.DestroyIcon(shfi.hIcon); // Cleanup
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wraps necessary Shell32.dll structures and functions required to retrieve Icon Handles using SHGetFileInfo. Code
|
||||||
|
/// courtesy of MSDN Cold Rooster Consulting case study.
|
||||||
|
/// </summary>
|
||||||
|
private static class Shell32
|
||||||
|
{
|
||||||
|
private const int MaxPath = 256;
|
||||||
|
public const uint ShgfiIcon = 0x000000100; // get icon
|
||||||
|
public const uint ShgfiLinkoverlay = 0x000008000; // put a link overlay on icon
|
||||||
|
public const uint ShgfiLargeicon = 0x000000000; // get large icon
|
||||||
|
public const uint ShgfiSmallicon = 0x000000001; // get small icon
|
||||||
|
public const uint ShgfiUsefileattributes = 0x000000010; // use passed dwFileAttribute
|
||||||
|
public const uint FileAttributeNormal = 0x00000080;
|
||||||
|
public const uint FileAttributeDirectory = 0x00000010;
|
||||||
|
|
||||||
|
[DllImport("Shell32.dll")]
|
||||||
|
public static extern IntPtr SHGetFileInfo(
|
||||||
|
string pszPath,
|
||||||
|
uint dwFileAttributes,
|
||||||
|
ref Shfileinfo psfi,
|
||||||
|
uint cbFileInfo,
|
||||||
|
uint uFlags
|
||||||
|
);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct Shfileinfo
|
||||||
|
{
|
||||||
|
private const int Namesize = 80;
|
||||||
|
public readonly IntPtr hIcon;
|
||||||
|
private readonly int iIcon;
|
||||||
|
private readonly uint dwAttributes;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MaxPath)] private readonly string szDisplayName;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Namesize)] private readonly string szTypeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wraps necessary functions imported from User32.dll. Code courtesy of MSDN Cold Rooster Consulting example.
|
||||||
|
/// </summary>
|
||||||
|
private static class User32
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides access to function required to delete handle. This method is used internally
|
||||||
|
/// and is not required to be called separately.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hIcon">Pointer to icon handle.</param>
|
||||||
|
/// <returns>N/A</returns>
|
||||||
|
[DllImport("User32.dll")]
|
||||||
|
public static extern int DestroyIcon(IntPtr hIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
71
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs
Normal file
71
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using SevenZip;
|
||||||
|
|
||||||
|
namespace QuickLook.Plugin.ArchiveViewer
|
||||||
|
{
|
||||||
|
public class Plugin : IViewer
|
||||||
|
{
|
||||||
|
private ArchiveInfoPanel _panel;
|
||||||
|
|
||||||
|
public int Priority => 0;
|
||||||
|
|
||||||
|
public bool CanHandle(string path)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SevenZipExtractor archive = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (archive = new SevenZipExtractor(path))
|
||||||
|
{
|
||||||
|
// dummy access to the data. If it throws exception, return false
|
||||||
|
if (archive.ArchiveFileData == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// ignore some formats
|
||||||
|
switch (archive.Format)
|
||||||
|
{
|
||||||
|
case InArchiveFormat.Chm:
|
||||||
|
case InArchiveFormat.Flv:
|
||||||
|
case InArchiveFormat.Elf:
|
||||||
|
case InArchiveFormat.Msi:
|
||||||
|
case InArchiveFormat.PE:
|
||||||
|
case InArchiveFormat.Swf:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
archive?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Prepare(string path, ViewContentContainer container)
|
||||||
|
{
|
||||||
|
container.PreferedSize = new Size {Width = 800, Height = 600};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void View(string path, ViewContentContainer container)
|
||||||
|
{
|
||||||
|
_panel = new ArchiveInfoPanel(path);
|
||||||
|
|
||||||
|
container.SetContent(_panel);
|
||||||
|
container.Title = $"{Path.GetFileName(path)}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
_panel.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\Build\Debug\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\Build\Release\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.ArchiveViewer\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -34,11 +34,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="SharpCompress, Version=0.15.2.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
<Reference Include="SevenZipSharp">
|
||||||
<HintPath>..\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll</HintPath>
|
<HintPath>References\SevenZipSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -49,18 +50,35 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ArchiveInfoPanel.xaml.cs">
|
||||||
|
<DependentUpon>ArchiveInfoPanel.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ArchiveFileEntry.cs" />
|
||||||
|
<Compile Include="IconManager.cs" />
|
||||||
|
<Compile Include="Extensions.cs" />
|
||||||
|
<Compile Include="Converters.cs" />
|
||||||
<Compile Include="Plugin.cs" />
|
<Compile Include="Plugin.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="ArchiveFileListView.xaml.cs">
|
||||||
|
<DependentUpon>ArchiveFileListView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
|
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||||
<Name>QuickLook</Name>
|
<Name>QuickLook</Name>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<Page Include="ArchiveInfoPanel.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="ArchiveFileListView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\Build\Debug\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\Build\Release\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.ImageViewer\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
|
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||||
<Name>QuickLook</Name>
|
<Name>QuickLook</Name>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
@@ -28,7 +28,7 @@ namespace QuickLook.Plugin.PDFViewer
|
|||||||
|
|
||||||
var desiredSize = _pdfControl.GetDesiredControlSizeByFirstPage(path);
|
var desiredSize = _pdfControl.GetDesiredControlSizeByFirstPage(path);
|
||||||
|
|
||||||
container.SetPreferedSizeFit(desiredSize, 0.7);
|
container.SetPreferedSizeFit(desiredSize, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void View(string path, ViewContentContainer container)
|
public void View(string path, ViewContentContainer container)
|
@@ -16,7 +16,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\Build\Debug\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\Build\Release\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.PDFViewer\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
|
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||||
<Name>QuickLook</Name>
|
<Name>QuickLook</Name>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
@@ -16,7 +16,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\Build\Debug\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
<OutputPath>..\..\Build\Debug\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\Build\Release\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
<OutputPath>..\..\Build\Release\Plugins\QuickLook.Plugin.TextViewer\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
|
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
|
<HintPath>..\..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
@@ -53,20 +53,20 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
|
<ProjectReference Include="..\..\QuickLook\QuickLook.csproj">
|
||||||
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
|
||||||
<Name>QuickLook</Name>
|
<Name>QuickLook</Name>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="TextViewerPanel.xaml">
|
<Page Include="TextViewerPanel.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@@ -10,15 +10,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook", "QuickLook\Quic
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuickLook.Native.Shell32", "QuickLook.Native.Shell32\QuickLook.Native.Shell32.vcxproj", "{D31EE321-C2B0-4984-B749-736F7DE509F1}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuickLook.Native.Shell32", "QuickLook.Native.Shell32\QuickLook.Native.Shell32.vcxproj", "{D31EE321-C2B0-4984-B749-736F7DE509F1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.PdfViewer", "QuickLook.Plugin.PDFViewer\QuickLook.Plugin.PdfViewer.csproj", "{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QuickLook.Plugin", "QuickLook.Plugin", "{06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.LastResort", "QuickLook.Plugin.LastResort\QuickLook.Plugin.LastResort.csproj", "{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.ArchiveViewer", "QuickLook.Plugin\QuickLook.Plugin.ArchiveViewer\QuickLook.Plugin.ArchiveViewer.csproj", "{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.TextViewer", "QuickLook.Plugin.TextViewer\QuickLook.Plugin.TextViewer.csproj", "{AE041682-E3A1-44F6-8BB4-916A98D89FBE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.ImageViewer", "QuickLook.Plugin\QuickLook.Plugin.ImageViewer\QuickLook.Plugin.ImageViewer.csproj", "{FE5A5111-9607-4721-A7BE-422754002ED8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.ImageViewer", "QuickLook.Plugin.ImageViewer\QuickLook.Plugin.ImageViewer.csproj", "{FE5A5111-9607-4721-A7BE-422754002ED8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.PdfViewer", "QuickLook.Plugin\QuickLook.Plugin.PDFViewer\QuickLook.Plugin.PdfViewer.csproj", "{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.ArchiveViewer", "QuickLook.Plugin.ArchiveViewer\QuickLook.Plugin.ArchiveViewer.csproj", "{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.TextViewer", "QuickLook.Plugin\QuickLook.Plugin.TextViewer\QuickLook.Plugin.TextViewer.csproj", "{AE041682-E3A1-44F6-8BB4-916A98D89FBE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -42,38 +42,6 @@ Global
|
|||||||
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|Any CPU.ActiveCfg = Release|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.ActiveCfg = Release|Win32
|
||||||
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x86.Build.0 = Release|Win32
|
{D31EE321-C2B0-4984-B749-736F7DE509F1}.Release|x86.Build.0 = Release|Win32
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{B9A5A4F6-813E-40CE-AD32-DC5C1356215D}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
@@ -82,8 +50,38 @@ Global
|
|||||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.ActiveCfg = Release|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
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||||
|
{FE5A5111-9607-4721-A7BE-422754002ED8} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||||
|
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||||
|
{AE041682-E3A1-44F6-8BB4-916A98D89FBE} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@@ -28,7 +28,7 @@ namespace QuickLook
|
|||||||
Closed += MainWindow_Closed;
|
Closed += MainWindow_Closed;
|
||||||
|
|
||||||
buttonCloseWindow.MouseLeftButtonUp += CloseCurrentWindow;
|
buttonCloseWindow.MouseLeftButtonUp += CloseCurrentWindow;
|
||||||
titlebarTitleArea.MouseDown += (sender, e) => DragMove();
|
titlebarTitleArea.MouseLeftButtonDown += (sender, e) => DragMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.LastResort
|
namespace QuickLook.Plugin.InfoPanel
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.LastResort
|
namespace QuickLook.Plugin.InfoPanel
|
||||||
{
|
{
|
||||||
public static class FileHelper
|
public static class FileHelper
|
||||||
{
|
{
|
@@ -1,20 +1,20 @@
|
|||||||
<UserControl x:Class="QuickLook.Plugin.LastResort.InfoPanel"
|
<UserControl x:Class="QuickLook.Plugin.InfoPanel.InfoPanel"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:QuickLook.Plugin.LastResort"
|
xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel"
|
||||||
mc:Ignorable="d" Width="484.5" Height="172" UseLayoutRounding="True">
|
mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="150" />
|
<ColumnDefinition Width="150" />
|
||||||
<ColumnDefinition Width="65*" />
|
<ColumnDefinition Width="65*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image x:Name="image" Grid.Column="0" Height="128" Width="128" Stretch="None" />
|
<Image x:Name="image" Grid.Column="0" Height="128" Width="128" Stretch="None" Margin="0,-20,0,0" />
|
||||||
<Grid Grid.Column="1">
|
<Grid Grid.Column="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="20*" />
|
<ColumnDefinition Width="70" />
|
||||||
<ColumnDefinition Width="80*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
@@ -1,8 +1,9 @@
|
|||||||
using System.IO;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.LastResort
|
namespace QuickLook.Plugin.InfoPanel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for InfoPanel.xaml
|
/// Interaction logic for InfoPanel.xaml
|
||||||
@@ -36,7 +37,7 @@ namespace QuickLook.Plugin.LastResort
|
|||||||
filename.Content = string.IsNullOrEmpty(name) ? path : name;
|
filename.Content = string.IsNullOrEmpty(name) ? path : name;
|
||||||
|
|
||||||
var last = File.GetLastWriteTime(path);
|
var last = File.GetLastWriteTime(path);
|
||||||
modDate.Content = $"{last.ToLongDateString()} {last.ToLongTimeString()}";
|
modDate.Content = last.ToString(CultureInfo.CurrentCulture);
|
||||||
|
|
||||||
Stop = false;
|
Stop = false;
|
||||||
|
|
@@ -1,8 +1,8 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.LastResort
|
namespace QuickLook.Plugin.InfoPanel
|
||||||
{
|
{
|
||||||
public class Plugin : IViewer
|
public class PluginInterface : IViewer
|
||||||
{
|
{
|
||||||
private InfoPanel _ip;
|
private InfoPanel _ip;
|
||||||
|
|
@@ -4,7 +4,7 @@ using System.Drawing.Imaging;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.LastResort
|
namespace QuickLook.Plugin.InfoPanel
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
internal enum ThumbnailOptions
|
internal enum ThumbnailOptions
|
@@ -1,11 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace QuickLook.Plugin
|
|
||||||
{
|
|
||||||
[Flags]
|
|
||||||
public enum PluginType
|
|
||||||
{
|
|
||||||
ByExtension = 0x01,
|
|
||||||
ByContent = 0x10
|
|
||||||
}
|
|
||||||
}
|
|
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using QuickLook.Plugin;
|
using QuickLook.Plugin;
|
||||||
|
using QuickLook.Plugin.InfoPanel;
|
||||||
|
|
||||||
namespace QuickLook
|
namespace QuickLook
|
||||||
{
|
{
|
||||||
@@ -16,6 +17,8 @@ namespace QuickLook
|
|||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal IViewer DefaultPlugin { get; set; } = new PluginInterface();
|
||||||
|
|
||||||
internal List<IViewer> LoadedPlugins { get; private set; } = new List<IViewer>();
|
internal List<IViewer> LoadedPlugins { get; private set; } = new List<IViewer>();
|
||||||
|
|
||||||
internal static PluginManager GetInstance()
|
internal static PluginManager GetInstance()
|
||||||
@@ -23,13 +26,15 @@ namespace QuickLook
|
|||||||
return _instance ?? (_instance = new PluginManager());
|
return _instance ?? (_instance = new PluginManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IViewer FindMatch(string path)
|
internal IViewer FindMatch(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return GetInstance()
|
var matched = GetInstance()
|
||||||
.LoadedPlugins.FirstOrDefault(plugin => plugin.CanHandle(path));
|
.LoadedPlugins.FirstOrDefault(plugin => plugin.CanHandle(path));
|
||||||
|
|
||||||
|
return matched ?? DefaultPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPlugins()
|
private void LoadPlugins()
|
||||||
|
@@ -54,6 +54,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -74,13 +75,23 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="PluginManager.cs" />
|
<Compile Include="PluginManager.cs" />
|
||||||
|
<Compile Include="Plugin\InfoPanel\Extensions.cs" />
|
||||||
|
<Compile Include="Plugin\InfoPanel\FileHelper.cs" />
|
||||||
|
<Compile Include="Plugin\InfoPanel\InfoPanel.xaml.cs">
|
||||||
|
<DependentUpon>InfoPanel.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Plugin\InfoPanel\PluginInterface.cs" />
|
||||||
|
<Compile Include="Plugin\InfoPanel\WindowsThumbnailProvider.cs" />
|
||||||
<Compile Include="Plugin\IViewer.cs" />
|
<Compile Include="Plugin\IViewer.cs" />
|
||||||
<Compile Include="Plugin\PluginPriority.cs" />
|
|
||||||
<Compile Include="Plugin\ViewContentContainer.xaml.cs">
|
<Compile Include="Plugin\ViewContentContainer.xaml.cs">
|
||||||
<DependentUpon>ViewContentContainer.xaml</DependentUpon>
|
<DependentUpon>ViewContentContainer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utilities\WindowHelper.cs" />
|
<Compile Include="Utilities\WindowHelper.cs" />
|
||||||
<Compile Include="ViewWindowManager.cs" />
|
<Compile Include="ViewWindowManager.cs" />
|
||||||
|
<Page Include="Plugin\InfoPanel\InfoPanel.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Styles\ScrollBarStyleDictionary.xaml">
|
<Page Include="Styles\ScrollBarStyleDictionary.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@@ -25,9 +25,7 @@ namespace QuickLook
|
|||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var matchedPlugin = PluginManager.FindMatch(path);
|
var matchedPlugin = PluginManager.GetInstance().FindMatch(path);
|
||||||
if (matchedPlugin == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BeginShowNewWindow(matchedPlugin, path);
|
BeginShowNewWindow(matchedPlugin, path);
|
||||||
}
|
}
|
||||||
@@ -37,7 +35,15 @@ namespace QuickLook
|
|||||||
_viewWindow = new MainWindow();
|
_viewWindow = new MainWindow();
|
||||||
_viewWindow.Closed += (sender2, e2) => { _viewWindow = null; };
|
_viewWindow.Closed += (sender2, e2) => { _viewWindow = null; };
|
||||||
|
|
||||||
_viewWindow.BeginShow(matchedPlugin, path);
|
try
|
||||||
|
{
|
||||||
|
_viewWindow.BeginShow(matchedPlugin, path);
|
||||||
|
}
|
||||||
|
catch (Exception) // if current plugin failed, switch to default one
|
||||||
|
{
|
||||||
|
if (matchedPlugin.GetType() != PluginManager.GetInstance().DefaultPlugin.GetType())
|
||||||
|
_viewWindow.BeginShow(PluginManager.GetInstance().DefaultPlugin, path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CloseCurrentWindow()
|
private bool CloseCurrentWindow()
|
||||||
|
Reference in New Issue
Block a user