diff --git a/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin.ArchiveViewer/Plugin.cs deleted file mode 100644 index 113eb8a..0000000 --- a/QuickLook.Plugin.ArchiveViewer/Plugin.cs +++ /dev/null @@ -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(); - - if (SevenZipArchive.IsSevenZipFile(path)) - GetItemsFromSevenZip(path, files); - else - GetItemsFromIReader(path, files); - } - - public void Close() - { - throw new NotImplementedException(); - } - - private void GetItemsFromSevenZip(string path, List 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 files) - { - using (var s = File.OpenRead(path)) - { - using (var reader = ReaderFactory.Open(s)) - { - while (reader.MoveToNextEntry()) - files.Add(reader.Entry); - } - } - } - } -} \ No newline at end of file diff --git a/QuickLook.Plugin.ArchiveViewer/packages.config b/QuickLook.Plugin.ArchiveViewer/packages.config deleted file mode 100644 index 64b6360..0000000 --- a/QuickLook.Plugin.ArchiveViewer/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/QuickLook.Plugin.LastResort/Properties/AssemblyInfo.cs b/QuickLook.Plugin.LastResort/Properties/AssemblyInfo.cs deleted file mode 100644 index e89521e..0000000 --- a/QuickLook.Plugin.LastResort/Properties/AssemblyInfo.cs +++ /dev/null @@ -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")] \ No newline at end of file diff --git a/QuickLook.Plugin.LastResort/QuickLook.Plugin.LastResort.csproj b/QuickLook.Plugin.LastResort/QuickLook.Plugin.LastResort.csproj deleted file mode 100644 index 45408b7..0000000 --- a/QuickLook.Plugin.LastResort/QuickLook.Plugin.LastResort.csproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Debug - AnyCPU - {B9A5A4F6-813E-40CE-AD32-DC5C1356215D} - Library - Properties - QuickLook.Plugin.LastResort - QuickLook.Plugin.LastResort - v4.5.2 - 512 - - - true - full - false - ..\Build\Debug\Plugins\QuickLook.Plugin.LastResort\ - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - ..\Build\Release\Plugins\QuickLook.Plugin.LastResort\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - InfoPanel.xaml - - - - - - - - {8B4A9CE5-67B5-4A94-81CB-3771F688FDEB} - QuickLook - False - - - - - Designer - MSBuild:Compile - - - - \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileEntry.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileEntry.cs new file mode 100644 index 0000000..92c1f8f --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileEntry.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace QuickLook.Plugin.ArchiveViewer +{ + public class ArchiveFileEntry : IComparable + { + 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 Children { get; set; } = new SortedList(); + + 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; } + + /// + /// Returns the maximum depth of all siblings + /// + 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; + } + + /// + /// Returns the number of nodes in the longest path to a leaf + /// + 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}"; + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml new file mode 100644 index 0000000..5207efb --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml.cs new file mode 100644 index 0000000..60703db --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml.cs @@ -0,0 +1,43 @@ +using System; +using System.Windows.Controls; + +namespace QuickLook.Plugin.ArchiveViewer +{ + /// + /// Interaction logic for ArchiveFileListView.xaml + /// + 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; + }; + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml new file mode 100644 index 0000000..8689762 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs new file mode 100644 index 0000000..b5cdef9 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ArchiveInfoPanel.xaml + /// + public partial class ArchiveInfoPanel : UserControl, IDisposable + { + private readonly Dictionary _fileEntries = new Dictionary(); + 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(); + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Converters.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Converters.cs new file mode 100644 index 0000000..9b23544 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Converters.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Extensions.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Extensions.cs new file mode 100644 index 0000000..05de561 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Extensions.cs @@ -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(this IEnumerable enumeration, Action action) + { + foreach (var item in enumeration) + action(item); + } + + public static T GetDescendantByType(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(); + 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; + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/IconManager.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/IconManager.cs new file mode 100644 index 0000000..a0d71ab --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/IconManager.cs @@ -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 +{ + /// + /// Internals are mostly from here: + /// http://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using + /// Caches all results. + /// + public static class IconManager + { + private static ImageSource SmallDirIcon; + private static ImageSource LargeDirIcon; + private static readonly Dictionary SmallIconCache = new Dictionary(); + private static readonly Dictionary LargeIconCache = new Dictionary(); + + public static void ClearCache() + { + SmallDirIcon = LargeDirIcon = null; + + SmallIconCache.Clear(); + LargeIconCache.Clear(); + } + + /// + /// Get the icon of a directory + /// + /// 16x16 or 32x32 icon + /// an icon + 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; + } + + /// + /// Get an icon for a given filename + /// + /// any filename + /// 16x16 or 32x32 icon + /// null if path is null, otherwise - an icon + 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; + } + + /// + /// http://stackoverflow.com/a/6580799/1943849 + /// + private static ImageSource ToImageSource(this Icon icon) + { + var imageSource = Imaging.CreateBitmapSourceFromHIcon( + icon.Handle, + Int32Rect.Empty, + BitmapSizeOptions.FromEmptyOptions()); + return imageSource; + } + + /// + /// Provides static methods to read system icons for both folders and files. + /// + /// + /// IconReader.GetFileIcon("c:\\general.xls"); + /// + private static class IconReader + { + /// + /// Options to specify the size of icons to return. + /// + public enum IconSize + { + /// + /// Specify large icon - 32 pixels by 32 pixels. + /// + Large = 0, + /// + /// Specify small icon - 16 pixels by 16 pixels. + /// + Small = 1 + } + + /// + /// Returns the icon of a folder. + /// + /// Large or small + /// Whether to include the link icon + /// System.Drawing.Icon + 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; + } + + /// + /// Returns an icon for a given file - indicated by the name parameter. + /// + /// Pathname for file. + /// Large or small + /// Whether to include the link icon + /// System.Drawing.Icon + 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; + } + } + + /// + /// Wraps necessary Shell32.dll structures and functions required to retrieve Icon Handles using SHGetFileInfo. Code + /// courtesy of MSDN Cold Rooster Consulting case study. + /// + 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; + } + } + + /// + /// Wraps necessary functions imported from User32.dll. Code courtesy of MSDN Cold Rooster Consulting example. + /// + private static class User32 + { + /// + /// Provides access to function required to delete handle. This method is used internally + /// and is not required to be called separately. + /// + /// Pointer to icon handle. + /// N/A + [DllImport("User32.dll")] + public static extern int DestroyIcon(IntPtr hIcon); + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs new file mode 100644 index 0000000..695f336 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/QuickLook.Plugin.ArchiveViewer/Properties/AssemblyInfo.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Properties/AssemblyInfo.cs similarity index 100% rename from QuickLook.Plugin.ArchiveViewer/Properties/AssemblyInfo.cs rename to QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Properties/AssemblyInfo.cs diff --git a/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj similarity index 70% rename from QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj rename to QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj index 4f30405..e1d424e 100644 --- a/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj @@ -16,7 +16,7 @@ true full false - ..\Build\Debug\Plugins\QuickLook.Plugin.ArchiveViewer\ + ..\..\Build\Debug\Plugins\QuickLook.Plugin.ArchiveViewer\ DEBUG;TRACE prompt 4 @@ -25,7 +25,7 @@ pdbonly true - ..\Build\Release\Plugins\QuickLook.Plugin.ArchiveViewer\ + ..\..\Build\Release\Plugins\QuickLook.Plugin.ArchiveViewer\ TRACE prompt 4 @@ -34,11 +34,12 @@ - - ..\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + + References\SevenZipSharp.dll + @@ -49,18 +50,35 @@ + + ArchiveInfoPanel.xaml + + + + + + + ArchiveFileListView.xaml + - + {8b4a9ce5-67b5-4a94-81cb-3771f688fdeb} QuickLook False - + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.dll b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.dll new file mode 100644 index 0000000..d69e3c0 Binary files /dev/null and b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.dll differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.xml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.xml new file mode 100644 index 0000000..8dcdce7 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/References/SevenZipSharp.xml @@ -0,0 +1,4319 @@ + + + + SevenZipSharp + + + + + The Stream extension class to emulate the archive part of a stream. + + + + + Gets the file offset. + + + + + The source wrapped stream. + + + + + Initializes a new instance of the ArchiveEmulationStream class. + + The stream to wrap. + The stream offset. + + + + Archive extraction callback to handle the process of unpacking files + + + + + For Compressing event. + + + + + Rate of the done work from [0, 1]. + + + + Usage: string legalFilename = InvalidFileNameCharsRegex.Replace(illegal, "_"); + + + Usage: string legalPath = InvalidPathCharsRegex.Replace(illegal, "_"); + + + + Initializes a new instance of the ArchiveExtractCallback class + + IInArchive interface for the archive + Directory where files are to be unpacked to + The archive files count' + The owner of the callback + The list of actual indexes (solid archives support) + The value indicating whether to preserve directory structure of extracted files. + Alt Paths. + + + Initializes a new instance of the ArchiveExtractCallback class. + IInArchive interface for the archive. + Directory where files are to be unpacked to. + The archive files count. + The value indicating whether to preserve directory + structure of extracted files. + The list of actual indexes (solid archives support) + Alt Paths. + Password for the archive. + The owner of the callback. + + + + Initializes a new instance of the ArchiveExtractCallback class + + IInArchive interface for the archive + The stream where files are to be unpacked to + The archive files count + The file index for the stream + The owner of the callback + + + + Initializes a new instance of the ArchiveExtractCallback class + + IInArchive interface for the archive + The stream where files are to be unpacked to + The archive files count + The file index for the stream + Password for the archive + The owner of the callback + + + + Occurs when a new file is going to be unpacked + + Occurs when 7-zip engine requests for an output stream for a new file to unpack in + + + + Occurs when a file has been successfully unpacked + + + + + Occurs when the archive is opened and 7-zip sends the size of unpacked data + + + + + Occurs when the extraction is performed + + + + + Occurs during the extraction when a file already exists + + + + + Gives the size of the unpacked archive files + + Size of the unpacked archive files (in bytes) + + + + Sets output stream for writing unpacked data + + Current file index + Output stream pointer + Extraction mode + 0 if OK + + + + Called when the archive was extracted + + + + + + Sets password for the archive + + Password for the archive + Zero if everything is OK + + + + Validates the file name and ensures that the directory to the file name is valid and creates intermediate directories if necessary + + File name + The valid file name + + + Given a proposed filename, returns a string that eliminates any disallowed characters. + If stripping characters results in an empty string, it returns '_' + proposed filename. + Sanitized filename. + + + Given a proposed directory path, returns a string that eliminates any disallowed characters. + If stripping characters results in an empty string, it returns '_' + + proposed pathname. + Sanitized pathname. + + + + Callback to handle the archive opening + + + + + Gets the list of volume file names. + + + + + Performs the common initialization. + + Volume file name. + + + + Initializes a new instance of the ArchiveOpenCallback class. + + The archive file name. + + + + Initializes a new instance of the ArchiveOpenCallback class. + + The archive file name. + Password for the archive. + + + + Sets password for the archive + + Password for the archive + Zero if everything is OK + + + + Archive update callback to handle the process of packing files + + + + + _files.Count if do not count directories + + + + + For Compressing event. + + + + + No directories. + + + + + Rate of the done work from [0, 1] + + + + + The names of the archive entries + + + + + Array of files to pack + + + + + Common root of file names length. + + + + + Input streams to be compressed. + + + + + Gets or sets the default item name used in MemoryStream compression. + + + + + Gets or sets the value indicating whether to compress as fast as possible, without calling events. + + + + Initializes a new instance of the ArchiveUpdateCallback class. + Array of files to pack. + List of names of the alternates. + Common file names root length. + The owner of the callback. + The compression parameters. + Preserve directory structure. + + + Initializes a new instance of the ArchiveUpdateCallback class. + Array of files to pack. + List of names of the alternates. + Common file names root length. + The archive password. + The owner of the callback. + The compression parameters. + Preserve directory structure. + + + + Initializes a new instance of the ArchiveUpdateCallback class + + The input stream + The owner of the callback + The compression parameters. + Preserve directory structure. + + + + Initializes a new instance of the ArchiveUpdateCallback class + + The input stream + The archive password + The owner of the callback + The compression parameters. + Preserve directory structure. + + + + Initializes a new instance of the ArchiveUpdateCallback class + + Dictionary<file stream, name of the archive entry> + The owner of the callback + The compression parameters. + Preserve directory structure. + + + + Initializes a new instance of the ArchiveUpdateCallback class + + Dictionary<file stream, name of the archive entry> + The archive password + The owner of the callback + The compression parameters. + Preserve directory structure. + + + + Gets or sets the dictionary size. + + + + + Raises events for the GetStream method. + + The current item index. + True if not cancelled; otherwise, false. + + + + Occurs when the next file is going to be packed. + + Occurs when 7-zip engine requests for an input stream for the next file to pack it + + + + Occurs when data are being compressed. + + + + + Occurs when the current file was compressed. + + + + + Gets the stream for 7-zip library. + + File index + Input file stream + Zero if Ok + + + + The structure to fix x64 and x32 variant size mismatch. + + + + + COM VARIANT structure with special interface routines. + + + + + IntPtr variant value. + + + + + Signed int variant value. + + + + + Unsigned int variant value. + + + + + Long variant value. + + + + + Unsigned long variant value. + + + + + FILETIME variant value. + + + + + The PropArray instance to fix the variant size on x64 bit systems. + + + + + Gets or sets variant type. + + + + + Gets or sets the pointer value of the COM variant + + + + + Gets or sets the UInt32 value of the COM variant. + + + + + Gets or sets the UInt32 value of the COM variant. + + + + + Gets or sets the Int64 value of the COM variant + + + + + Gets or sets the UInt64 value of the COM variant + + + + + Gets the object for this PropVariant. + + + + + + Determines whether the specified System.Object is equal to the current PropVariant. + + The System.Object to compare with the current PropVariant. + true if the specified System.Object is equal to the current PropVariant; otherwise, false. + + + + Determines whether the specified PropVariant is equal to the current PropVariant. + + The PropVariant to compare with the current PropVariant. + true if the specified PropVariant is equal to the current PropVariant; otherwise, false. + + + + Serves as a hash function for a particular type. + + A hash code for the current PropVariant. + + + + Returns a System.String that represents the current PropVariant. + + A System.String that represents the current PropVariant. + + + + Determines whether the specified PropVariant instances are considered equal. + + The first PropVariant to compare. + The second PropVariant to compare. + true if the specified PropVariant instances are considered equal; otherwise, false. + + + + Determines whether the specified PropVariant instances are not considered equal. + + The first PropVariant to compare. + The second PropVariant to compare. + true if the specified PropVariant instances are not considered equal; otherwise, false. + + + + Stores file extraction modes. + + + + + Extraction mode + + + + + Test mode + + + + + Skip mode + + + + + Stores operation result values + + + + + Success + + + + + Method is unsupported + + + + + Data error has occured + + + + + CrcError has occured + + + + + Codes of item properities + + + + + No property + + + + + Handler item index + + + + + Item path + + + + + Item name + + + + + Item extension + + + + + true if the item is a folder; otherwise, false + + + + + Item size + + + + + Item packed sise; usually absent + + + + + Item attributes; usually absent + + + + + Item creation time; usually absent + + + + + Item last access time; usually absent + + + + + Item last write time + + + + + true if the item is solid; otherwise, false + + + + + true if the item is commented; otherwise, false + + + + + true if the item is encrypted; otherwise, false + + + + + (?) + + + + + (?) + + + + + Dictionary size(?) + + + + + Item CRC checksum + + + + + Item type(?) + + + + + (?) + + + + + Compression method + + + + + (?); usually absent + + + + + Item file system; usually absent + + + + + Item user(?); usually absent + + + + + Item group(?); usually absent + + + + + Bloack size(?) + + + + + Item comment; usually absent + + + + + Item position + + + + + Item prefix(?) + + + + + Number of subdirectories + + + + + Numbers of subfiles + + + + + The archive legacy unpacker version + + + + + Volume(?) + + + + + Is a volume + + + + + Offset value(?) + + + + + Links(?) + + + + + Number of blocks + + + + + Number of volumes(?) + + + + + Time type(?) + + + + + 64-bit(?) + + + + + BigEndian + + + + + Cpu(?) + + + + + Physical archive size + + + + + Headers size + + + + + Archive checksum + + + + + (?) + + + + + (?) + + + + + Cluster size(?) + + + + + Volume name(?) + + + + + Local item name(?); usually absent + + + + + (?) + + + + + Path in file system to allow direct streaming from 7z engine + + + + + User defined property; usually absent + + + + + PropId string names dictionary wrapper. + + + + + PropId string names + + + + + 7-zip IArchiveOpenCallback imported interface to handle the opening of an archive. + + + + + Sets total data size + + Files pointer + Total size in bytes + + + + Sets completed size + + Files pointer + Completed size in bytes + + + + 7-zip ICryptoGetTextPassword imported interface to get the archive password. + + + + + Gets password for the archive + + Password for the archive + Zero if everything is OK + + + + 7-zip ICryptoGetTextPassword2 imported interface for setting the archive password. + + + + + Sets password for the archive + + Specifies whether archive has a password or not (0 if not) + Password for the archive + Zero if everything is OK + + + + 7-zip IArchiveExtractCallback imported interface. + + + + + Gives the size of the unpacked archive files + + Size of the unpacked archive files (in bytes) + + + + SetCompleted 7-zip function + + + + + + Gets the stream for file extraction + + File index in the archive file table + Pointer to the stream + Extraction mode + S_OK - OK, S_FALSE - skip this file + + + + PrepareOperation 7-zip function + + Ask mode + + + + Sets the operaton result + + The operation result + + + + 7-zip IArchiveUpdateCallback imported interface. + + + + + Gives the size of the unpacked archive files. + + Size of the unpacked archive files (in bytes) + + + + SetCompleted 7-zip internal function. + + + + + + Gets archive update mode. + + File index + 1 if new, 0 if not + 1 if new, 0 if not + -1 if doesn't matter + + + + + Gets the archive item property data. + + Item index + Property identificator + Property value + Zero if Ok + + + + Gets the stream for reading. + + The item index. + The ISequentialInStream pointer for reading. + Zero if Ok + + + + Sets the result for currently performed operation. + + The result value. + + + + EnumProperties 7-zip internal function. + + The enumerator pointer. + + + + + 7-zip IArchiveOpenVolumeCallback imported interface to handle archive volumes. + + + + + Gets the archive property data. + + The property identificator. + The property value. + + + + Gets the stream for reading the volume. + + The volume file name. + The IInStream pointer for reading. + Zero if Ok + + + + 7-zip ISequentialInStream imported interface + + + + + Writes data to 7-zip packer + + Array of bytes available for writing + Array size + S_OK if success + If (size > 0) and there are bytes in stream, + this function must read at least 1 byte. + This function is allowed to read less than "size" bytes. + You must call Read function in loop, if you need exact amount of data. + + + + + 7-zip ISequentialOutStream imported interface + + + + + Writes data to unpacked file stream + + Array of bytes available for reading + Array size + Processed data size + S_OK if success + If size != 0, return value is S_OK and (*processedSize == 0), + then there are no more bytes in stream. + If (size > 0) and there are bytes in stream, + this function must read at least 1 byte. + This function is allowed to rwrite less than "size" bytes. + You must call Write function in loop, if you need exact amount of data. + + + + + 7-zip IInStream imported interface + + + + + Read routine + + Array of bytes to set + Array size + Zero if Ok + + + + Seek routine + + Offset value + Seek origin value + New position pointer + + + + 7-zip IOutStream imported interface + + + + + Write routine + + Array of bytes to get + Array size + Processed size + Zero if Ok + + + + Seek routine + + Offset value + Seek origin value + New position pointer + + + + Set size routine + + New size value + Zero if Ok + + + + 7-zip essential in archive interface + + + + + Opens archive for reading. + + Archive file stream + Maximum start position for checking + Callback for opening archive + + + + + Closes the archive. + + + + + Gets the number of files in the archive file table . + + The number of files in the archive + + + + Retrieves specific property data. + + File index in the archive file table + Property code + Property variant value + + + + Extracts files from the opened archive. + + indexes of files to be extracted (must be sorted) + 0xFFFFFFFF means all files + testMode != 0 means "test files operation" + IArchiveExtractCallback for operations handling + 0 if success + + + + Gets archive property data + + Archive property identificator + Archive property value + + + + Gets the number of properties + + The number of properties + + + + Gets property information + + Item index + Name + Property identificator + Variant type + + + + Gets the number of archive properties + + The number of archive properties + + + + Gets the archive property information + + Item index + Name + Property identificator + Variant type + + + + 7-zip essential out archive interface + + + + + Updates archive items + + The ISequentialOutStream pointer for writing the archive data + Number of archive items + The IArchiveUpdateCallback pointer + Zero if Ok + + + + Gets file time type(?) + + Type pointer + + + + 7-zip ISetProperties interface for setting various archive properties + + + + + Sets the archive properties + + The names of the properties + The values of the properties + The properties count + + + + + The definition of the interface which supports the cancellation of a process. + + + + + Gets or sets whether to stop the current archive operation. + + + + + EventArgs for storing PercentDone property. + + + + + Initializes a new instance of the PercentDoneEventArgs class. + + The percent of finished work. + + + + + Gets the percent of finished work. + + + + + Converts a [0, 1] rate to its percent equivalent. + + The rate of the done work. + Percent integer equivalent. + + + + + The EventArgs class for accurate progress handling. + + + + + Initializes a new instance of the ProgressEventArgs class. + + The percent of finished work. + The percent of work done after the previous event. + + + + Gets the change in done work percentage. + + + + + EventArgs for handling (some) errors during compression. + + + + Constructor. + The default action. + The type of error that occurred. + The source file that is to be compressed. + The intended path/name for this file in the archive. + The ex. + + + + In the handler for this event, initially set to the default strategy. You can set this to + your desired behavior to override the default for this issue. + + + + The type of error that occurred. + + + The source file that is to be compressed. + + + The intended path/name for this file in the archive. + + + The Exception (or null) encountered when attempting to access the file. + + + + EventArgs used to report the file information which is going to be packed. + + + + + Initializes a new instance of the FileInfoEventArgs class. + + The current ArchiveFileInfo. + The percent of finished work. + + + + Gets or sets whether to stop the current archive operation. + + + + + Gets the corresponding FileInfo to the event. + + + + + EventArgs used to report the size of unpacked archive data + + + + + Initializes a new instance of the OpenEventArgs class + + Size of unpacked archive data + + + + Gets the size of unpacked archive data + + + + + Stores an int number + + + + + Initializes a new instance of the IntEventArgs class + + Useful data carried by the IntEventArgs class + + + + Gets the value of the IntEventArgs class + + + + + EventArgs class which stores the file name. + + + + + Initializes a new instance of the FileNameEventArgs class. + + The file name. + The percent of finished work + + + + Gets or sets whether to stop the current archive operation. + + + + + Gets the file name. + + + + + EventArgs for FileExists event, stores the file name and asks whether to overwrite it in case it already exists. + + + + + Initializes a new instance of the FileOverwriteEventArgs class + + The file name. + + + + Gets or sets the value indicating whether to cancel the extraction. + + + + + Gets or sets the file name to extract to. Null means skip. + + + + + The reason for calling . + + + + + is called the first time for a file. + + + + + All data has been written to the target without any exceptions. + + + + + An exception occured during extraction of the file. + + + + + The arguments passed to . + + + For each file, is first called with + set to . If the callback chooses to extract the + file data by setting or , the callback + will be called a second time with set to + or + to allow for any cleanup task like closing the stream. + + + + + Initializes a new instance of the class. + + The information about file in the archive. + + + + Information about file in the archive. + + Information about file in the archive. + + + + The reason for calling . + + + If neither nor is set, + will not be called after . + + The reason. + + + + The exception that occurred during extraction. + + The _Exception. + + If the callback is called with set to , + this member contains the _Exception that occurred. + The default behavior is to rethrow the _Exception after return of the callback. + However the callback can set to null to swallow the _Exception + and continue extraction with the next file. + + + + + Gets or sets a value indicating whether to cancel the extraction. + + true to cancel the extraction; false to continue. The default is false. + + + + Gets or sets whether and where to extract the file. + + The path where to extract the file to. + + If is set, this mmember will be ignored. + + + + + Gets or sets whether and where to extract the file. + + The the extracted data is written to. + + If both this member and are null (the defualt), the file + will not be extracted and the callback will be be executed a second time with the + set to or . + + + + + Gets or sets any data that will be preserved between the callback call + and the or calls. + + The data. + + + + Callback delegate for . + + + + + Base SevenZip exception class. + + + + + The message for thrown user exceptions. + + + + + Initializes a new instance of the SevenZipException class + + + + + Initializes a new instance of the SevenZipException class + + Default exception message + + + + Initializes a new instance of the SevenZipException class + + Default exception message + Additional detailed message + + + + Initializes a new instance of the SevenZipException class + + Default exception message + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipException class + + Default exception message + Inner exception occured + + + + Initializes a new instance of the SevenZipException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for ArchiveExtractCallback. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the ExtractionFailedException class + + + + + Initializes a new instance of the ExtractionFailedException class + + Additional detailed message + + + + Initializes a new instance of the ExtractionFailedException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the ExtractionFailedException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for ArchiveUpdateCallback. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the CompressionFailedException class + + + + + Initializes a new instance of the CompressionFailedException class + + Additional detailed message + + + + Initializes a new instance of the CompressionFailedException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the CompressionFailedException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for LZMA operations. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the LzmaException class + + + + + Initializes a new instance of the LzmaException class + + Additional detailed message + + + + Initializes a new instance of the LzmaException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the LzmaException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for 7-zip archive open or read operations. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the SevenZipArchiveException class + + + + + Initializes a new instance of the SevenZipArchiveException class + + Additional detailed message + + + + Initializes a new instance of the SevenZipArchiveException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipArchiveException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for empty common root if file name array in SevenZipCompressor. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the SevenZipInvalidFileNamesException class + + + + + Initializes a new instance of the SevenZipInvalidFileNamesException class + + Additional detailed message + + + + Initializes a new instance of the SevenZipInvalidFileNamesException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipInvalidFileNamesException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for fail to create an archive in SevenZipCompressor. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the SevenZipCompressionFailedException class + + + + + Initializes a new instance of the SevenZipCompressionFailedException class + + Additional detailed message + + + + Initializes a new instance of the SevenZipCompressionFailedException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipCompressionFailedException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for fail to extract an archive in SevenZipExtractor. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the SevenZipExtractionFailedException class + + + + + Initializes a new instance of the SevenZipExtractionFailedException class + + Additional detailed message + + + + Initializes a new instance of the SevenZipExtractionFailedException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipExtractionFailedException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + Exception class for 7-zip library operations. + + + + + Exception dafault message which is displayed if no extra information is specified + + + + + Initializes a new instance of the SevenZipLibraryException class + + + + + Initializes a new instance of the SevenZipLibraryException class + + Additional detailed message + + + + Initializes a new instance of the SevenZipLibraryException class + + Additional detailed message + Inner exception occured + + + + Initializes a new instance of the SevenZipLibraryException class + + All data needed for serialization or deserialization + Serialized stream descriptor + + + + The signature checker class. Original code by Siddharth Uppal, adapted by Markhor. + + Based on the code at http://blog.somecreativity.com/2008/04/08/how-to-check-if-a-file-is-compressed-in-c/# + + + + Gets the InArchiveFormat for a specific extension. + + The stream to identify. + The archive beginning offset. + True if the original format of the stream is PE; otherwise, false. + Corresponding InArchiveFormat. + + + + Gets the InArchiveFormat for a specific file name. + + The archive file name. + The archive beginning offset. + True if the original format of the file is PE; otherwise, false. + Corresponding InArchiveFormat. + + + + + Readable archive format enumeration. + + + + + Open 7-zip archive format. + + Wikipedia information + + + + Proprietary Arj archive format. + + Wikipedia information + + + + Open Bzip2 archive format. + + Wikipedia information + + + + Microsoft cabinet archive format. + + Wikipedia information + + + + Microsoft Compiled HTML Help file format. + + Wikipedia information + + + + Microsoft Compound file format. + + Wikipedia information + + + + Open Cpio archive format. + + Wikipedia information + + + + Open Debian software package format. + + Wikipedia information + + + + Open Gzip archive format. + + Wikipedia information + + + + Open ISO disk image format. + + Wikipedia information + + + + Open Lzh archive format. + + Wikipedia information + + + + Open core 7-zip Lzma raw archive format. + + Wikipedia information + + + + Nullsoft installation package format. + + Wikipedia information + + + + RarLab Rar archive format. + + Wikipedia information + + + + Open Rpm software package format. + + Wikipedia information + + + + Open split file format. + + Wikipedia information + + + + Open Tar archive format. + + Wikipedia information + + + + Microsoft Windows Imaging disk image format. + + Wikipedia information + + + + Open LZW archive format; implemented in "compress" program; also known as "Z" archive format. + + Wikipedia information + + + + Open Zip archive format. + + Wikipedia information + + + + Open Udf disk image format. + + + + + Xar open source archive format. + + Wikipedia information + + + + Mub + + + + + Macintosh Disk Image on CD. + + Wikipedia information + + + + Apple Mac OS X Disk Copy Disk Image format. + + + + + Open Xz archive format. + + Wikipedia information + + + + MSLZ archive format. + + + + + Flash video format. + + Wikipedia information + + + + Shockwave Flash format. + + Wikipedia information + + + + Windows PE executable format. + + Wikipedia information + + + + Linux executable Elf format. + + Wikipedia information + + + + Windows Installer Database. + + Wikipedia information + + + + Microsoft virtual hard disk file format. + + Wikipedia information + + + + Writable archive format enumeration. + + + + + Open 7-zip archive format. + + Wikipedia information + + + + Open Zip archive format. + + Wikipedia information + + + + Open Gzip archive format. + + Wikipedia information + + + + Open Bzip2 archive format. + + Wikipedia information + + + + Open Tar archive format. + + Wikipedia information + + + + Open Xz archive format. + + Wikipedia information + + + + Compression level enumeration + + + + + No compression + + + + + Very low compression level + + + + + Low compression level + + + + + Normal compression level (default) + + + + + High compression level + + + + + The best compression level (slow) + + + + + Compression method enumeration. + + Some methods are applicable only to Zip format, some - only to 7-zip. + + + + Zip or 7-zip|no compression method. + + + + + Zip|Deflate method. + + + + + Zip|Deflate64 method. + + + + + Zip or 7-zip|Bzip2 method. + + Wikipedia information + + + + Zip or 7-zip|LZMA method based on Lempel-Ziv algorithm, it is default for 7-zip. + + + + + 7-zip|LZMA version 2, LZMA with improved multithreading and usually slight archive size decrease. + + + + + Zip or 7-zip|PPMd method based on Dmitry Shkarin's PPMdH source code, very efficient for compressing texts. + + Wikipedia information + + + + No method change. + + + + Settings for how errors compressing files are handled. + + + Default - Throws exception. + + + The file is skipped - no entry in the archive. + + + + The file is replaced by a UTF-8 encoded text file that explains the reason for the compression failure. + + + + Type of error encountered when compressing. + + + The source file does not exist. + + + The source file cannot be opened. + + + + Archive format routines + + + + + List of readable archive format interface guids for 7-zip COM interop. + + + + + List of writable archive format interface guids for 7-zip COM interop. + + + + + List of archive formats corresponding to specific extensions + + + + + List of archive formats corresponding to specific signatures + + Based on the information at this site. + + + + Gets InArchiveFormat for specified archive file name + + Archive file name + Indicates whether to throw exceptions + InArchiveFormat recognized by the file name extension + + + + + The set of features supported by the library. + + + + + Default feature. + + + + + The library can extract 7zip archives compressed with LZMA method. + + + + + The library can extract 7zip archives compressed with LZMA2 method. + + + + + The library can extract 7z archives compressed with all known methods. + + + + + The library can extract zip archives. + + + + + The library can extract rar archives. + + + + + The library can extract gzip archives. + + + + + The library can extract bzip2 archives. + + + + + The library can extract tar archives. + + + + + The library can extract xz archives. + + + + + The library can extract all types of archives supported. + + + + + The library can compress data to 7zip archives with LZMA method. + + + + + The library can compress data to 7zip archives with LZMA2 method. + + + + + The library can compress data to 7zip archives with all methods known. + + + + + The library can compress data to tar archives. + + + + + The library can compress data to gzip archives. + + + + + The library can compress data to bzip2 archives. + + + + + The library can compress data to xz archives. + + + + + The library can compress data to zip archives. + + + + + The library can compress data to all types of archives supported. + + + + + The library can modify archives. + + + + + 7-zip library low-level wrapper. + + + + + Synchronization root for all locking. + + + + + Path to the 7-zip dll. + + 7zxa.dll supports only decoding from .7z archives. + Features of 7za.dll: + - Supporting 7z format; + - Built encoders: LZMA, PPMD, BCJ, BCJ2, COPY, AES-256 Encryption. + - Built decoders: LZMA, PPMD, BCJ, BCJ2, COPY, AES-256 Encryption, BZip2, Deflate. + 7z.dll (from the 7-zip distribution) supports every InArchiveFormat for encoding and decoding. + + + + + 7-zip library handle. + + + + + 7-zip library features. + + + + + Loads the 7-zip library if necessary and adds user to the reference list + + Caller of the function + Archive format + + + + Gets the value indicating whether the library supports modifying archives. + + + + + Removes user from reference list and frees the 7-zip library if it becomes empty + + Caller of the function + Archive format + + + + Gets IInArchive interface to extract 7-zip archives. + + Archive format. + Archive format user. + + + + Gets IOutArchive interface to pack 7-zip archives. + + Archive format. + Archive format user. + + + Gets the 7zip library path. + Thrown when a Timeout error condition occurs. + The library path. + In WindowsCE, a file called 7z.dll in the same directory as this assembly. If it does not exist, + an Embedded resource is extracted to this directory and used. All other platforms use the following + logic: + 1. [All] The value provided to a previous call to SetLibraryPath() is used. + 2. [Full Framework] app.config AppSetting '7zLocation' which must be path to the proper bit 7z.dll + 3. [All] Embedded resource is extracted to %TEMP% and used. (assuming build with embedded 7z.dll is used) + 4. [All] 7z.dll from a x86 or x64 subdirectory of this assembly's directory. + 5. [All] 7za.dll from a x86 or x64 subdirectory of this assembly's directory. + 6. [All] 7z86.dll or 7z64.dll in the same directory as this assembly. + 7. [All] 7za86.dll or 7za64.dll in the same directory as this assembly. + 8. [All] A file called 7z.dll in the same directory as this assembly. + 9. [All] A file called 7za.dll in the same directory as this assembly. + If not found, we give up and fail. + + + + + Sets the application-wide default module path of the native 7zip library. In WindowsCE this is a no-op. The library MUST be in the app directory. + + The native 7zip module path. + + This method must be called prior to any other calls to this library. + The can be relative or absolute. + + + + + Returns the version information of the native 7zip library. + + An object representing the version information of the native 7zip library. + + + + The way of the event synchronization. + + + + + Events are called synchronously if user can do some action; that is, cancel the execution process for example. + + + + + Always call events asynchronously. + + + + + Always call events synchronously. + + + + + SevenZip Extractor/Compressor base class. Implements Password string, ReportErrors flag. + + + + Unique identifier source. Use System.Threading.Interlocked.Increment(ref IncrementingUniqueId) to get the next UniqueID. + + + + True if the instance of the class needs to be recreated in new thread context; otherwise, false. + + + + + AsyncCallback implementation used in asynchronous invocations. + + IAsyncResult instance. + + + + Gets or sets the Dispatcher object for this instance. + It will be used to fire events in the user context. + + + + + Gets or sets the Dispatcher priority of calling user events. + + + + + Gets or sets the event synchronization strategy. + + + + + Gets the unique identifier of this SevenZipBase instance. + + + + + User exceptions thrown during the requested operations, for example, in events. + + + + + Initializes a new instance of the SevenZipBase class. + + + + + Initializes a new instance of the SevenZipBase class + + The archive password. + + + + Gets or sets the archive password + + + + + Gets or sets throw exceptions on archive errors flag + + + + + Gets the user exceptions thrown during the requested operations, for example, in events. + + + + + Throws the specified exception when is able to. + + The exception to throw. + The handler responsible for the exception. + + + + Throws exception if HRESULT != 0. + + Result code to check. + Exception message. + The class responsible for the callback. + + + + Changes the path to the 7-zip native library. + + The path to the 7-zip native library. + + + + Returns the version information of the native 7zip library. + + An object representing the version information of the native 7zip library. + + + + Gets the current library features. + + + + + Determines whether the specified System.Object is equal to the current SevenZipBase. + + The System.Object to compare with the current SevenZipBase. + true if the specified System.Object is equal to the current SevenZipBase; otherwise, false. + + + + Serves as a hash function for a particular type. + + A hash code for the current SevenZipBase. + + + + Returns a System.String that represents the current SevenZipBase. + + A System.String that represents the current SevenZipBase. + + + + User exceptions thrown during the requested operations, for example, in events. + + + + + Initializes a new instance of the CallbackBase class. + + + + + Initializes a new instance of the CallbackBase class. + + The archive password. + + + + Gets or sets the archive password + + + + + Gets or sets the value indicating whether the current procedure was cancelled. + + + + + Gets or sets throw exceptions on archive errors flag + + + + + Gets the user exceptions thrown during the requested operations, for example, in events. + + + + + Throws the specified exception when is able to. + + The exception to throw. + The handler responsible for the exception. + + + + Throws the first exception in the list if any exists. + + True means no exceptions. + + + + Struct for storing information about files in the 7-zip archive. + + + + + Gets or sets index of the file in the archive file table. + + + + + Gets or sets file name + + + + + Gets or sets the file last write time. + + + + + Gets or sets the file creation time. + + + + + Gets or sets the file creation time. + + + + + Gets or sets size of the file (unpacked). + + + + + Gets or sets CRC checksum of the file. + + + + + Gets or sets file attributes. + + + + + Gets or sets being a directory. + + + + + Gets or sets being encrypted. + + + + + Gets or sets comment for the file. + + + + + Determines whether the specified System.Object is equal to the current ArchiveFileInfo. + + The System.Object to compare with the current ArchiveFileInfo. + true if the specified System.Object is equal to the current ArchiveFileInfo; otherwise, false. + + + + Determines whether the specified ArchiveFileInfo is equal to the current ArchiveFileInfo. + + The ArchiveFileInfo to compare with the current ArchiveFileInfo. + true if the specified ArchiveFileInfo is equal to the current ArchiveFileInfo; otherwise, false. + + + + Serves as a hash function for a particular type. + + A hash code for the current ArchiveFileInfo. + + + + Returns a System.String that represents the current ArchiveFileInfo. + + A System.String that represents the current ArchiveFileInfo. + + + + Determines whether the specified ArchiveFileInfo instances are considered equal. + + The first ArchiveFileInfo to compare. + The second ArchiveFileInfo to compare. + true if the specified ArchiveFileInfo instances are considered equal; otherwise, false. + + + + Determines whether the specified ArchiveFileInfo instances are not considered equal. + + The first ArchiveFileInfo to compare. + The second ArchiveFileInfo to compare. + true if the specified ArchiveFileInfo instances are not considered equal; otherwise, false. + + + + Archive property struct. + + + + + Gets the name of the archive property. + + + + + Gets the value of the archive property. + + + + + Determines whether the specified System.Object is equal to the current ArchiveProperty. + + The System.Object to compare with the current ArchiveProperty. + true if the specified System.Object is equal to the current ArchiveProperty; otherwise, false. + + + + Determines whether the specified ArchiveProperty is equal to the current ArchiveProperty. + + The ArchiveProperty to compare with the current ArchiveProperty. + true if the specified ArchiveProperty is equal to the current ArchiveProperty; otherwise, false. + + + + Serves as a hash function for a particular type. + + A hash code for the current ArchiveProperty. + + + + Returns a System.String that represents the current ArchiveProperty. + + A System.String that represents the current ArchiveProperty. + + + + Determines whether the specified ArchiveProperty instances are considered equal. + + The first ArchiveProperty to compare. + The second ArchiveProperty to compare. + true if the specified ArchiveProperty instances are considered equal; otherwise, false. + + + + Determines whether the specified ArchiveProperty instances are not considered equal. + + The first ArchiveProperty to compare. + The second ArchiveProperty to compare. + true if the specified ArchiveProperty instances are not considered equal; otherwise, false. + + + + Archive compression mode. + + + + + Create a new archive; overwrite the existing one. + + + + + Add data to the archive. + + + + + Create a new archive; overwrite the existing one. + + + + + Add data to the archive. + + + + + Modify archive data. + + + + + Zip encryption method enum. + + + + + ZipCrypto encryption method. + + + + + AES 128 bit encryption method. + + + + + AES 192 bit encryption method. + + + + + AES 256 bit encryption method. + + + + + Archive update data for UpdateCallback. + + + + + The stream which decompresses data with LZMA on the fly. + + + + + Initializes a new instance of the LzmaDecodeStream class. + + A compressed stream. + + + + Gets the chunk size. + + + + + Gets a value indicating whether the current stream supports reading. + + + + + Gets a value indicating whether the current stream supports seeking. + + + + + Gets a value indicating whether the current stream supports writing. + + + + + Gets the length in bytes of the output stream. + + + + + Gets or sets the position within the output stream. + + + + + Does nothing. + + + + + Reads a sequence of bytes from the current stream and decompresses data if necessary. + + An array of bytes. + The zero-based byte offset in buffer at which to begin storing the data read from the current stream. + The maximum number of bytes to be read from the current stream. + The total number of bytes read into the buffer. + + + + Sets the position within the current stream. + + A byte offset relative to the origin parameter. + A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position. + The new position within the current stream. + + + + Sets the length of the current stream. + + The desired length of the current stream in bytes. + + + + Writes a sequence of bytes to the current stream. + + An array of bytes. + The zero-based byte offset in buffer at which to begin storing the data read from the current stream. + The maximum number of bytes to be read from the current stream. + + + + The stream which compresses data with LZMA on the fly. + + + + + Initializes a new instance of the LzmaEncodeStream class. + + + + + Initializes a new instance of the LzmaEncodeStream class. + + The buffer size. The bigger size, the better compression. + + + + Initializes a new instance of the LzmaEncodeStream class. + + An output stream which supports writing. + + + + Initializes a new instance of the LzmaEncodeStream class. + + An output stream which supports writing. + A buffer size. The bigger size, the better compression. + + + + Gets a value indicating whether the current stream supports reading. + + + + + Gets a value indicating whether the current stream supports seeking. + + + + + Gets a value indicating whether the current stream supports writing. + + + + + Gets the length in bytes of the output stream. + + + + + Gets or sets the position within the output stream. + + + + + Checked whether the class was disposed. + + + + + + Converts the LzmaEncodeStream to the LzmaDecodeStream to read data. + + + + + + Clears all buffers for this stream and causes any buffered data to be compressed and written. + + + + + Releases all unmanaged resources used by LzmaEncodeStream. + + + + + Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. + + An array of bytes. + The zero-based byte offset in buffer at which to begin storing the data read from the current stream. + The maximum number of bytes to be read from the current stream. + The total number of bytes read into the buffer. + + + + Sets the position within the current stream. + + A byte offset relative to the origin parameter. + A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position. + The new position within the current stream. + + + + Sets the length of the current stream. + + The desired length of the current stream in bytes. + + + + Writes a sequence of bytes to the current stream and compresses it if necessary. + + An array of bytes. + The zero-based byte offset in buffer at which to begin storing the data read from the current stream. + The maximum number of bytes to be read from the current stream. + + + + Callback to implement the ICodeProgress interface + + + + + Initializes a new instance of the LzmaProgressCallback class + + The input size + Progress event handler + + + + Sets the progress + + The processed input size + The processed output size + + + + The exception that is thrown when an error in input stream occurs during decoding. + + + + + The exception that is thrown when the value of an argument is outside the allowable range. + + + + + Callback progress. + + + input size. -1 if unknown. + + + output size. -1 if unknown. + + + + + Codes streams. + + + input Stream. + + + output Stream. + + + input Size. -1 if unknown. + + + output Size. -1 if unknown. + + + callback progress reference. + + + if input stream is not valid + + + + + Provides the fields that represent properties identifiers for compressing. + + + + + Specifies default property. + + + + + Specifies size of dictionary. + + + + + Specifies size of memory for PPM*. + + + + + Specifies order for PPM methods. + + + + + Specifies Block Size. + + + + + Specifies number of postion state bits for LZMA (0 <= x <= 4). + + + + + Specifies number of literal context bits for LZMA (0 <= x <= 8). + + + + + Specifies number of literal position bits for LZMA (0 <= x <= 4). + + + + + Specifies number of fast bytes for LZ*. + + + + + Specifies match finder. LZMA: "BT2", "BT4" or "BT4B". + + + + + Specifies the number of match finder cycles. + + + + + Specifies number of passes. + + + + + Specifies number of algorithm. + + + + + Specifies the number of threads. + + + + + Specifies mode with end marker. + + + + + Class to pack data into archives supported by 7-Zip. + + + var compr = new SevenZipCompressor(); + compr.CompressDirectory(@"C:\Dir", @"C:\Archive.7z"); + + + + + Gets or sets the archiving compression level. + + + + + Gets or sets the stream0 parameters. + + + + + Gets or sets a value indicating whether [alt names for volumes]. + + + + + Gets the custom compression parameters - for advanced users only. + + + + + Gets or sets the value indicating whether to include empty directories to archives. Default is true. + + + + + Gets or sets the value indicating whether to preserve the directory root for CompressDirectory. + + + + + Gets or sets the value indicating whether to preserve the directory structure. + + + + + Gets or sets the compression mode. + + + + + Gets or sets the value indicating whether to encrypt 7-Zip archive headers. + + + + + Gets or sets the value indicating whether to compress files only open for writing. + This applies to CompressDirectory() only. + + + + + Gets or sets the encryption method for zip archives. + + + + + Gets or sets the temporary folder path. + + + + + Gets or sets the default archive item name used when an item to be compressed has no name, + for example, when you compress a MemoryStream instance. + + + + + If true, events are not published, which (if you don't need an accurate progress bar) will speed up compression. + + + + + Determines the behavior if a file cannot be compressed. For instance, a missing file or a + file that is not opened with FileShare.Read permissions. + This setting applies to CompressFileDictionary. + + + + + Initializes a new instance of the SevenZipCompressor class. + + + + + Initializes a new instance of the SevenZipCompressor class. + + Your own temporary path (default is set in the parameterless constructor overload.) + + + + Checks if the specified stream supports compression. + + The stream to check. + + + + Guaranties the correct work of the SetCompressionProperties function + + The compression method to check + The value indicating whether the specified method is valid for the current ArchiveFormat + + + + Sets the compression properties + + + + + Finds the common root of file names + + Array of file names + Common root + + + + Validates the common root + + The length of the common root of the file names. + Array of file names + + + + Ensures that directory directory is not empty + + Directory name + False if is not empty + + + + Makes special FileInfo array for the archive file table. + + Array of files to pack. + The length of the common root of file names + The value indicating whether to produce the array for files in a particular directory or just for an array of files. + Preserve directory structure. + Special FileInfo array for the archive file table. + + + + Recursive function for adding files in directory + + Directory directory + List of files + Search string, such as "*.txt" + + + + Performs the common ArchiveUpdateCallback initialization. + + The ArchiveUpdateCallback instance to initialize. + + + Produces a new instance of ArchiveUpdateCallback class. + Array of FileInfo - files to pack. + List of names of the alternates. + Length of the common root of file names. + The archive password. + The archive update callback. + + + + Produces a new instance of ArchiveUpdateCallback class. + + The archive input stream. + The archive password. + + + + + Produces a new instance of ArchiveUpdateCallback class. + + Dictionary<name of the archive entry, stream>. + The archive password + + + + + Occurs when the next file is going to be packed. + + Occurs when 7-zip engine requests for an input stream for the next file to pack it + + + + Occurs when the current file was compressed. + + + + + Occurs when data are being compressed. This is NOT called if FastCompression is true! + + Use this event for accurate progress handling and various ProgressBar.StepBy(e.PercentDelta) routines + + + + Occurs when all files information was determined and SevenZipCompressor is about to start to compress them. + + The incoming int value indicates the number of scanned files. + + + Occurs when a recoverable/ignorable compression error occurs, such as when a + file intended to be archived cannot be found or opened. Handling + this event allows you to be notified when an error occurs AND/OR + address how this specific error should be handled if different from + CompressionErrorBehavior. + + + + Occurs when the compression procedure is finished + + + + + Event proxy for FileCompressionStarted. + + The sender of the event. + The event arguments. + + + + Event proxy for FileCompressionFinished. + + The sender of the event. + The event arguments. + + + + Event proxy for Compressing. + + The sender of the event. + The event arguments. + + + + Event proxy for Compression Errors. + + The sender of the event. + The event arguments. + + + + Event proxy for FilesFound. + + The sender of the event. + The event arguments. + + + + Gets or sets the archive format + + + + + Gets or sets the compression method + + + + + Gets or sets the size in bytes of an archive volume (0 for no volumes). + + + + + Packs files into the archive. + + Array of file names to pack. + The archive file name. + + + + Packs files into the archive. + + Array of file names to pack. + The archive output stream. + Use CompressFiles(string archiveName ... ) overloads for archiving to disk. + + + + Packs files into the archive. + + Array of file names to pack. + The length of the common root of the file names. + The archive file name. + + + + Packs files into the archive. + + Array of file names to pack. + The length of the common root of the file names. + The archive output stream. + Use CompressFiles(string archiveName, ... ) overloads for archiving to disk. + + + + Packs files into the archive. + + Array of file names to pack. + The archive file name. + The archive password. + + + + Packs files into the archive. + + Array of file names to pack. + The archive output stream. + Use CompressFiles( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + + + + Packs files into the archive. + + Array of file names to pack. + The length of the common root of the file names. + The archive file name. + The archive password. + + + + Packs files into the archive. + + Array of file names to pack. + The length of the common root of the file names. + The archive output stream. + Use CompressFiles( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + + + + Packs all files in the specified directory. + + The directory to compress. + The archive file name. + The archive password. + Search string, such as "*.txt". + If true, files will be searched for recursively; otherwise, not. + + + + Packs all files in the specified directory. + + The directory to compress. + The archive output stream. + Use CompressDirectory( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + Search string, such as "*.txt". + If true, files will be searched for recursively; otherwise, not. + + + + Packs the specified file dictionary. + + Dictionary<name of the archive entry, file name>. + If a file name is null, the corresponding archive entry becomes a directory. + The archive file name. + The archive password. + + + + Packs the specified file dictionary. + + Dictionary<name of the archive entry, file name>. + If a file name is null, the corresponding archive entry becomes a directory. + The archive output stream. + Use CompressStreamDictionary( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + + + + Packs the specified stream dictionary. + + Dictionary<name of the archive entry, stream>. + If a stream is null, the corresponding string becomes a directory name. Stream Dictionary will be cleared and Disposed. + The archive file name. + The archive password. + + + + Packs the specified stream dictionary. + + Dictionary<name of the archive entry, stream>. + If a stream is null, the corresponding string becomes a directory name. Stream Dictionary will be cleared and Disposed. + The archive output stream. + Use CompressStreamDictionary( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + + + + Compresses the specified stream. + + The source uncompressed stream. + The destination compressed stream. + The archive password. + ArgumentException: at least one of the specified streams is invalid. + + + + Modifies the existing archive (renames files or deletes them). + + The archive file name. + New file names. Null value to delete the corresponding index. + The archive password. + + + + Gets or sets the dictionary size for the managed LZMA algorithm. + + + + + Compresses the specified stream with LZMA algorithm (C# inside) + + The source uncompressed stream + The destination compressed stream + The length of uncompressed data (null for inStream.Length) + The event for handling the code progress + + + + Compresses byte array with LZMA algorithm (C# inside) + + Byte array to compress + Compressed byte array + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive file name. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive output stream. + Use CompressFiles(string archiveName ... ) overloads for archiving to disk. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The length of the common root of the file names. + The archive file name. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The length of the common root of the file names. + The archive output stream. + Use CompressFiles(string archiveName, ... ) overloads for archiving to disk. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive file name + The archive password. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive output stream. + Use CompressFiles( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive file name + The archive password. + The length of the common root of the file names. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs files into the archive asynchronously. + + Array of file names to pack. + The archive output stream. + Use CompressFiles( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + The length of the common root of the file names. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs all files in the specified directory asynchronously. + + The directory to compress. + The archive file name. + The archive password. + Search string, such as "*.txt". + If true, files will be searched for recursively; otherwise, not. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Packs all files in the specified directory asynchronously. + + The directory to compress. + The archive output stream. + Use CompressDirectory( ... string archiveName ... ) overloads for archiving to disk. + The archive password. + Search string, such as "*.txt". + If true, files will be searched for recursively; otherwise, not. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Compresses the specified stream. + + The source uncompressed stream. + The destination compressed stream. + The archive password. + ArgumentException: at least one of the specified streams is invalid. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Modifies the existing archive asynchronously (renames files or deletes them). + + The archive file name. + New file names. Null value to delete the corresponding index. + The archive password. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Class to unpack data from archives supported by 7-Zip. + + + using (var extr = new SevenZipExtractor(@"C:\Test.7z")) + { + extr.ExtractArchive(@"C:\TestDirectory"); + } + + + + + This is used to lock possible Dispose() calls. + + + + + General initialization function. + + The archive file name. + + + + General initialization function. + + The stream to read the archive from. + + + + Initializes a new instance of SevenZipExtractor class. + + The stream to read the archive from. + Use SevenZipExtractor(string) to extract from disk, though it is not necessary. + The archive format is guessed by the signature. + + + + Initializes a new instance of SevenZipExtractor class. + + The stream to read the archive from. + Use SevenZipExtractor(string) to extract from disk, though it is not necessary. + Manual archive format setup. You SHOULD NOT normally specify it this way. + Instead, use SevenZipExtractor(Stream archiveStream), that constructor + automatically detects the archive format. + + + + Initializes a new instance of SevenZipExtractor class. + + The archive full file name. + + + + Initializes a new instance of SevenZipExtractor class. + + The archive full file name. + Manual archive format setup. You SHOULD NOT normally specify it this way. + Instead, use SevenZipExtractor(string archiveFullName), that constructor + automatically detects the archive format. + + + + Initializes a new instance of SevenZipExtractor class. + + The archive full file name. + Password for an encrypted archive. + + + + Initializes a new instance of SevenZipExtractor class. + + The archive full file name. + Password for an encrypted archive. + Manual archive format setup. You SHOULD NOT normally specify it this way. + Instead, use SevenZipExtractor(string archiveFullName, string password), that constructor + automatically detects the archive format. + + + + Initializes a new instance of SevenZipExtractor class. + + The stream to read the archive from. + Password for an encrypted archive. + The archive format is guessed by the signature. + + + + Initializes a new instance of SevenZipExtractor class. + + The stream to read the archive from. + Password for an encrypted archive. + Manual archive format setup. You SHOULD NOT normally specify it this way. + Instead, use SevenZipExtractor(Stream archiveStream, string password), that constructor + automatically detects the archive format. + + + + Gets or sets archive full file name + + + + + Gets the size of the archive file + + + + + Gets the size of unpacked archive data + + + + + Gets a value indicating whether the archive is solid + + + + + Gets the number of files in the archive + + + + + Gets archive format + + + + + Gets or sets the value indicating whether to preserve the directory structure of extracted files. + + + + + Checked whether the class was disposed. + + + + + + Gets the archive input stream. + + The archive input wrapper stream. + + + + Opens the archive and throws exceptions or returns OperationResult.DataError if any error occurs. + + The IInStream compliant class instance, that is, the input stream. + The ArchiveOpenCallback instance. + OperationResult.Ok if Open() succeeds. + + + + Opens the archive and throws exceptions or returns OperationResult.DataError if any error occurs. + + The IInStream compliant class instance, that is, the input stream. + The ArchiveOpenCallback instance. + True if Open() succeeds; otherwise, false. + + + + Retrieves all information about the archive. + + + + + + Ensure that _archiveFileData is loaded. + + Dispose the archive stream after this operation. + + + + Produces an array of indexes from 0 to the maximum value in the specified array + + The source array + The array of indexes from 0 to the maximum value in the specified array + + + + Checkes whether all the indexes are valid. + + The indexes to check. + True is valid; otherwise, false. + + + Gets the IArchiveExtractCallback callback. + The directory where extract the files. + The number of files to be extracted. + The list of actual indexes (solid archives support) + The alternate paths. + The ArchiveExtractCallback callback. + + + + Gets the IArchiveExtractCallback callback + + The stream where extract the file + The file index + The number of files to be extracted + The ArchiveExtractCallback callback + + + + Checks if the specified stream supports extraction. + + The stream to check. + + + + Releases the unmanaged resources used by SevenZipExtractor. + + + + + Occurs when a new file is going to be unpacked. + + Occurs when 7-zip engine requests for an output stream for a new file to unpack in. + + + + Occurs when a file has been successfully unpacked. + + + + + Occurs when the archive has been unpacked. + + + + + Occurs when data are being extracted. + + Use this event for accurate progress handling and various ProgressBar.StepBy(e.PercentDelta) routines. + + + + Occurs during the extraction when a file already exists. + + + + + Event proxy for FileExtractionStarted. + + The sender of the event. + The event arguments. + + + + Event proxy for FileExtractionFinished. + + The sender of the event. + The event arguments. + + + + Event proxy for Extractng. + + The sender of the event. + The event arguments. + + + + Event proxy for FileExists. + + The sender of the event. + The event arguments. + + + + Gets the collection of ArchiveFileInfo with all information about files in the archive + + + + + Gets the properties for the current archive + + + + + Gets the collection of all file names contained in the archive. + + + Each get recreates the collection + + + + + Gets the list of archive volume file names. + + + + + Performs the archive integrity test. + + True is the archive is ok; otherwise, false. + + + + Unpacks the file by its name to the specified stream. + + The file full name in the archive file table. + The stream where the file is to be unpacked. + + + + Unpacks the file by its index to the specified stream. + + Index in the archive file table. + The stream where the file is to be unpacked. + + + + Unpacks files by their indices to the specified directory. + + indexes of the files in the archive file table. + Directory where the files are to be unpacked. + + + Unpacks files by their indices to the specified directory. + Directory where the files are to be unpacked. + The alternate paths. + indexes of the files in the archive file table. + + + + Unpacks files by their full names to the specified directory. + + Full file names in the archive file table. + Directory where the files are to be unpacked. + + + + Extracts files from the archive, giving a callback the choice what + to do with each file. The order of the files is given by the archive. + 7-Zip (and any other solid) archives are NOT supported. + + The callback to call for each file in the archive. + + + + Unpacks the whole archive to the specified directory. + + The directory where the files are to be unpacked. + + + + Decompress the specified stream (C# inside) + + The source compressed stream + The destination uncompressed stream + The length of compressed data (null for inStream.Length) + The event for handling the code progress + + + + Decompress byte array compressed with LZMA algorithm (C# inside) + + Byte array to decompress + Decompressed byte array + + + + Recreates the instance of the SevenZipExtractor class. + Used in asynchronous methods. + + + + + The delegate to use in BeginExtractArchive. + + The directory where the files are to be unpacked. + + + + The delegate to use in BeginExtractFile (by file name). + + The file full name in the archive file table. + The stream where the file is to be unpacked. + + + + The delegate to use in BeginExtractFile (by index). + + Index in the archive file table. + The stream where the file is to be unpacked. + + + + The delegate to use in BeginExtractFiles(string directory, params int[] indexes). + + indexes of the files in the archive file table. + Directory where the files are to be unpacked. + + + + The delegate to use in BeginExtractFiles(string directory, params string[] fileNames). + + Full file names in the archive file table. + Directory where the files are to be unpacked. + + + + The delegate to use in BeginExtractFiles(ExtractFileCallback extractFileCallback). + + The callback to call for each file in the archive. + + + + Unpacks the whole archive asynchronously to the specified directory name at the specified priority. + + The directory where the files are to be unpacked. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Unpacks the file asynchronously by its name to the specified stream. + + The file full name in the archive file table. + The stream where the file is to be unpacked. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Unpacks the file asynchronously by its index to the specified stream. + + Index in the archive file table. + The stream where the file is to be unpacked. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Unpacks files asynchronously by their indices to the specified directory. + + indexes of the files in the archive file table. + Directory where the files are to be unpacked. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Unpacks files asynchronously by their full names to the specified directory. + + Full file names in the archive file table. + Directory where the files are to be unpacked. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + Extracts files from the archive asynchronously, giving a callback the choice what + to do with each file. The order of the files is given by the archive. + 7-Zip (and any other solid) archives are NOT supported. + + The callback to call for each file in the archive. + The priority of events, relative to the other pending operations in the System.Windows.Threading.Dispatcher event queue, the specified method is invoked. + + + + A class that has DisposeStream property. + + + + + Stream wrapper used in InStreamWrapper + + + + + File name associated with the stream (for date fix) + + + + + Worker stream for reading, writing and seeking. + + + + + Initializes a new instance of the StreamWrapper class + + Worker stream for reading, writing and seeking + File name associated with the stream (for attributes fix) + File last write time (for attributes fix) + Indicates whether to dispose the baseStream + + + + Initializes a new instance of the StreamWrapper class + + Worker stream for reading, writing and seeking + Indicates whether to dispose the baseStream + + + + Gets the worker stream for reading, writing and seeking. + + + + + Cleans up any resources used and fixes file attributes. + + + + + IInStream wrapper used in stream read operations. + + + + + Initializes a new instance of the InStreamWrapper class. + + Stream for writing data + Indicates whether to dispose the baseStream + + + + Reads data from the stream. + + A data array. + The array size. + The read bytes count. + + + + Occurs when IntEventArgs.Value bytes were read from the source. + + + + + IOutStream wrapper used in stream write operations. + + + + + Initializes a new instance of the OutStreamWrapper class + + Stream for writing data + File name (for attributes fix) + Time of the file creation (for attributes fix) + Indicates whether to dispose the baseStream + + + + Initializes a new instance of the OutStreamWrapper class + + Stream for writing data + Indicates whether to dispose the baseStream + + + + Writes data to the stream + + Data array + Array size + Count of written bytes + Zero if Ok + + + + Occurs when IntEventArgs.Value bytes were written. + + + + + Base multi volume stream wrapper class. + + + + Initializes a new instance of the MultiStreamWrapper class. + Perform Dispose() if requested to. + true if this is a multiple volume zip. + + + + Gets the total length of input data. + + + + + Cleans up any resources used and fixes file attributes. + + + + + IInStream wrapper used in stream multi volume read operations. + + + + Initializes a new instance of the InMultiStreamWrapper class. + The archive file name. + true to alternate volume naming. + true to zip multi volume. + Perform Dispose() if requested to. + + + + Reads data from the stream. + + A data array. + The array size. + The read bytes count. + + + + + IOutStream wrapper used in multi volume stream write operations. + + + + Initializes a new instance of the OutMultiStreamWrapper class. + The archive name. + The volume size. + true to alternate names. + + + + Does nothing except calling the BytesWritten event + + Data array + Array size + Count of written bytes + Zero if Ok + + + + Occurs when IntEventArgs.Value bytes were written + + + + diff --git a/QuickLook.Plugin.ImageViewer/ImageFileHelper.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImageFileHelper.cs similarity index 100% rename from QuickLook.Plugin.ImageViewer/ImageFileHelper.cs rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImageFileHelper.cs diff --git a/QuickLook.Plugin.ImageViewer/ImagePanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml similarity index 100% rename from QuickLook.Plugin.ImageViewer/ImagePanel.xaml rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml diff --git a/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs similarity index 100% rename from QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs diff --git a/QuickLook.Plugin.ImageViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs similarity index 100% rename from QuickLook.Plugin.ImageViewer/Plugin.cs rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs diff --git a/QuickLook.Plugin.ImageViewer/Properties/AssemblyInfo.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Properties/AssemblyInfo.cs similarity index 100% rename from QuickLook.Plugin.ImageViewer/Properties/AssemblyInfo.cs rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Properties/AssemblyInfo.cs diff --git a/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj similarity index 92% rename from QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj index b754421..d8d4095 100644 --- a/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj @@ -16,7 +16,7 @@ true full false - ..\Build\Debug\Plugins\QuickLook.Plugin.ImageViewer\ + ..\..\Build\Debug\Plugins\QuickLook.Plugin.ImageViewer\ DEBUG;TRACE prompt 4 @@ -25,7 +25,7 @@ pdbonly true - ..\Build\Release\Plugins\QuickLook.Plugin.ImageViewer\ + ..\..\Build\Release\Plugins\QuickLook.Plugin.ImageViewer\ TRACE prompt 4 @@ -57,7 +57,7 @@ - + {8b4a9ce5-67b5-4a94-81cb-3771f688fdeb} QuickLook False diff --git a/QuickLook.Plugin.ImageViewer/packages.config b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config similarity index 100% rename from QuickLook.Plugin.ImageViewer/packages.config rename to QuickLook.Plugin/QuickLook.Plugin.ImageViewer/packages.config diff --git a/QuickLook.Plugin.PDFViewer/DpiHelpers.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/DpiHelpers.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/DpiHelpers.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/DpiHelpers.cs diff --git a/QuickLook.Plugin.PDFViewer/Extensions.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Extensions.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/Extensions.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Extensions.cs diff --git a/QuickLook.Plugin.PDFViewer/LibMuPdf.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/LibMuPdf.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.cs diff --git a/QuickLook.Plugin.PDFViewer/libmupdf.dll b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.dll similarity index 100% rename from QuickLook.Plugin.PDFViewer/libmupdf.dll rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/LibMuPdf.dll diff --git a/QuickLook.Plugin.PDFViewer/ListBoxItemStyleNoFocusedBorder.xaml b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/ListBoxItemStyleNoFocusedBorder.xaml similarity index 100% rename from QuickLook.Plugin.PDFViewer/ListBoxItemStyleNoFocusedBorder.xaml rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/ListBoxItemStyleNoFocusedBorder.xaml diff --git a/QuickLook.Plugin.PDFViewer/MouseWheelMonitor.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/MouseWheelMonitor.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/MouseWheelMonitor.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/MouseWheelMonitor.cs diff --git a/QuickLook.Plugin.PDFViewer/PageIdToImageConverter.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PageIdToImageConverter.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/PageIdToImageConverter.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PageIdToImageConverter.cs diff --git a/QuickLook.Plugin.PDFViewer/PdfFile.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/PdfFile.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfFile.cs diff --git a/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml similarity index 100% rename from QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml diff --git a/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml.cs diff --git a/QuickLook.Plugin.PDFViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs similarity index 96% rename from QuickLook.Plugin.PDFViewer/Plugin.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs index 91e7236..8d31b9d 100644 --- a/QuickLook.Plugin.PDFViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Plugin.cs @@ -28,7 +28,7 @@ namespace QuickLook.Plugin.PDFViewer var desiredSize = _pdfControl.GetDesiredControlSizeByFirstPage(path); - container.SetPreferedSizeFit(desiredSize, 0.7); + container.SetPreferedSizeFit(desiredSize, 0.8); } public void View(string path, ViewContentContainer container) diff --git a/QuickLook.Plugin.PDFViewer/Properties/AssemblyInfo.cs b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Properties/AssemblyInfo.cs similarity index 100% rename from QuickLook.Plugin.PDFViewer/Properties/AssemblyInfo.cs rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/Properties/AssemblyInfo.cs diff --git a/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj.DotSettings b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj.DotSettings similarity index 100% rename from QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj.DotSettings rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj.DotSettings diff --git a/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj similarity index 93% rename from QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj rename to QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj index 30b68f5..bb67856 100644 --- a/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PDFViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj @@ -16,7 +16,7 @@ true full false - ..\Build\Debug\Plugins\QuickLook.Plugin.PDFViewer\ + ..\..\Build\Debug\Plugins\QuickLook.Plugin.PDFViewer\ DEBUG;TRACE prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\Build\Release\Plugins\QuickLook.Plugin.PDFViewer\ + ..\..\Build\Release\Plugins\QuickLook.Plugin.PDFViewer\ TRACE prompt 4 @@ -62,7 +62,7 @@ - + {8b4a9ce5-67b5-4a94-81cb-3771f688fdeb} QuickLook False diff --git a/QuickLook.Plugin.TextViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs similarity index 100% rename from QuickLook.Plugin.TextViewer/Plugin.cs rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs diff --git a/QuickLook.Plugin.TextViewer/Properties/AssemblyInfo.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Properties/AssemblyInfo.cs similarity index 100% rename from QuickLook.Plugin.TextViewer/Properties/AssemblyInfo.cs rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/Properties/AssemblyInfo.cs diff --git a/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj similarity index 89% rename from QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj index 52b7fb0..3915e9a 100644 --- a/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj @@ -16,7 +16,7 @@ true full false - ..\Build\Debug\Plugins\QuickLook.Plugin.TextViewer\ + ..\..\Build\Debug\Plugins\QuickLook.Plugin.TextViewer\ DEBUG;TRACE prompt 4 @@ -25,7 +25,7 @@ pdbonly true - ..\Build\Release\Plugins\QuickLook.Plugin.TextViewer\ + ..\..\Build\Release\Plugins\QuickLook.Plugin.TextViewer\ TRACE prompt 4 @@ -33,7 +33,7 @@ - ..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll + ..\..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll @@ -53,20 +53,20 @@ - + {8b4a9ce5-67b5-4a94-81cb-3771f688fdeb} QuickLook False - - - Designer MSBuild:Compile + + + \ No newline at end of file diff --git a/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml similarity index 100% rename from QuickLook.Plugin.TextViewer/TextViewerPanel.xaml rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml diff --git a/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs similarity index 100% rename from QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.xaml.cs diff --git a/QuickLook.Plugin.TextViewer/packages.config b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/packages.config similarity index 100% rename from QuickLook.Plugin.TextViewer/packages.config rename to QuickLook.Plugin/QuickLook.Plugin.TextViewer/packages.config diff --git a/QuickLook.sln b/QuickLook.sln index 2bcc751..78d5ecc 100644 --- a/QuickLook.sln +++ b/QuickLook.sln @@ -10,15 +10,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook", "QuickLook\Quic EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuickLook.Native.Shell32", "QuickLook.Native.Shell32\QuickLook.Native.Shell32.vcxproj", "{D31EE321-C2B0-4984-B749-736F7DE509F1}" 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 -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 -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 -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 -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 Global 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|x86.ActiveCfg = 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.Build.0 = 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|x86.ActiveCfg = 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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE 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 diff --git a/QuickLook/MainWindow.xaml.cs b/QuickLook/MainWindow.xaml.cs index f77d2dd..cd28de5 100644 --- a/QuickLook/MainWindow.xaml.cs +++ b/QuickLook/MainWindow.xaml.cs @@ -28,7 +28,7 @@ namespace QuickLook Closed += MainWindow_Closed; buttonCloseWindow.MouseLeftButtonUp += CloseCurrentWindow; - titlebarTitleArea.MouseDown += (sender, e) => DragMove(); + titlebarTitleArea.MouseLeftButtonDown += (sender, e) => DragMove(); } public event PropertyChangedEventHandler PropertyChanged; diff --git a/QuickLook.Plugin.LastResort/Extensions.cs b/QuickLook/Plugin/InfoPanel/Extensions.cs similarity index 97% rename from QuickLook.Plugin.LastResort/Extensions.cs rename to QuickLook/Plugin/InfoPanel/Extensions.cs index 964b50e..09b87ec 100644 --- a/QuickLook.Plugin.LastResort/Extensions.cs +++ b/QuickLook/Plugin/InfoPanel/Extensions.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows.Media; using System.Windows.Media.Imaging; -namespace QuickLook.Plugin.LastResort +namespace QuickLook.Plugin.InfoPanel { public static class Extensions { diff --git a/QuickLook.Plugin.LastResort/FileHelper.cs b/QuickLook/Plugin/InfoPanel/FileHelper.cs similarity index 98% rename from QuickLook.Plugin.LastResort/FileHelper.cs rename to QuickLook/Plugin/InfoPanel/FileHelper.cs index a8d7a39..4b5bcc8 100644 --- a/QuickLook.Plugin.LastResort/FileHelper.cs +++ b/QuickLook/Plugin/InfoPanel/FileHelper.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.IO; -namespace QuickLook.Plugin.LastResort +namespace QuickLook.Plugin.InfoPanel { public static class FileHelper { diff --git a/QuickLook.Plugin.LastResort/InfoPanel.xaml b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml similarity index 82% rename from QuickLook.Plugin.LastResort/InfoPanel.xaml rename to QuickLook/Plugin/InfoPanel/InfoPanel.xaml index 4fadf70..398bec8 100644 --- a/QuickLook.Plugin.LastResort/InfoPanel.xaml +++ b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml @@ -1,20 +1,20 @@ - + xmlns:local="clr-namespace:QuickLook.Plugin.InfoPanel" + mc:Ignorable="d" Width="453" Height="172" UseLayoutRounding="True"> - + - - + + diff --git a/QuickLook.Plugin.LastResort/InfoPanel.xaml.cs b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs similarity index 91% rename from QuickLook.Plugin.LastResort/InfoPanel.xaml.cs rename to QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs index d0301e2..707a0db 100644 --- a/QuickLook.Plugin.LastResort/InfoPanel.xaml.cs +++ b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs @@ -1,8 +1,9 @@ -using System.IO; +using System.Globalization; +using System.IO; using System.Threading.Tasks; using System.Windows.Controls; -namespace QuickLook.Plugin.LastResort +namespace QuickLook.Plugin.InfoPanel { /// /// Interaction logic for InfoPanel.xaml @@ -36,7 +37,7 @@ namespace QuickLook.Plugin.LastResort filename.Content = string.IsNullOrEmpty(name) ? path : name; var last = File.GetLastWriteTime(path); - modDate.Content = $"{last.ToLongDateString()} {last.ToLongTimeString()}"; + modDate.Content = last.ToString(CultureInfo.CurrentCulture); Stop = false; diff --git a/QuickLook.Plugin.LastResort/Plugin.cs b/QuickLook/Plugin/InfoPanel/PluginInterface.cs similarity index 89% rename from QuickLook.Plugin.LastResort/Plugin.cs rename to QuickLook/Plugin/InfoPanel/PluginInterface.cs index 585ba16..6b1940e 100644 --- a/QuickLook.Plugin.LastResort/Plugin.cs +++ b/QuickLook/Plugin/InfoPanel/PluginInterface.cs @@ -1,8 +1,8 @@ using System.Windows; -namespace QuickLook.Plugin.LastResort +namespace QuickLook.Plugin.InfoPanel { - public class Plugin : IViewer + public class PluginInterface : IViewer { private InfoPanel _ip; diff --git a/QuickLook.Plugin.LastResort/WindowsThumbnailProvider.cs b/QuickLook/Plugin/InfoPanel/WindowsThumbnailProvider.cs similarity index 99% rename from QuickLook.Plugin.LastResort/WindowsThumbnailProvider.cs rename to QuickLook/Plugin/InfoPanel/WindowsThumbnailProvider.cs index 83df4f2..817e690 100644 --- a/QuickLook.Plugin.LastResort/WindowsThumbnailProvider.cs +++ b/QuickLook/Plugin/InfoPanel/WindowsThumbnailProvider.cs @@ -4,7 +4,7 @@ using System.Drawing.Imaging; using System.IO; using System.Runtime.InteropServices; -namespace QuickLook.Plugin.LastResort +namespace QuickLook.Plugin.InfoPanel { [Flags] internal enum ThumbnailOptions diff --git a/QuickLook/Plugin/PluginPriority.cs b/QuickLook/Plugin/PluginPriority.cs deleted file mode 100644 index 6ceccd8..0000000 --- a/QuickLook/Plugin/PluginPriority.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace QuickLook.Plugin -{ - [Flags] - public enum PluginType - { - ByExtension = 0x01, - ByContent = 0x10 - } -} \ No newline at end of file diff --git a/QuickLook/PluginManager.cs b/QuickLook/PluginManager.cs index b2de1a3..8529534 100644 --- a/QuickLook/PluginManager.cs +++ b/QuickLook/PluginManager.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; using QuickLook.Plugin; +using QuickLook.Plugin.InfoPanel; namespace QuickLook { @@ -16,6 +17,8 @@ namespace QuickLook LoadPlugins(); } + internal IViewer DefaultPlugin { get; set; } = new PluginInterface(); + internal List LoadedPlugins { get; private set; } = new List(); internal static PluginManager GetInstance() @@ -23,13 +26,15 @@ namespace QuickLook return _instance ?? (_instance = new PluginManager()); } - internal static IViewer FindMatch(string path) + internal IViewer FindMatch(string path) { if (string.IsNullOrEmpty(path)) return null; - return GetInstance() + var matched = GetInstance() .LoadedPlugins.FirstOrDefault(plugin => plugin.CanHandle(path)); + + return matched ?? DefaultPlugin; } private void LoadPlugins() diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index 5a2d401..77d89a7 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -54,6 +54,7 @@ + @@ -74,13 +75,23 @@ Designer + + + + InfoPanel.xaml + + + - ViewContentContainer.xaml + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/QuickLook/ViewWindowManager.cs b/QuickLook/ViewWindowManager.cs index 13e94ad..c345700 100644 --- a/QuickLook/ViewWindowManager.cs +++ b/QuickLook/ViewWindowManager.cs @@ -25,9 +25,7 @@ namespace QuickLook if (string.IsNullOrEmpty(path)) return; - var matchedPlugin = PluginManager.FindMatch(path); - if (matchedPlugin == null) - return; + var matchedPlugin = PluginManager.GetInstance().FindMatch(path); BeginShowNewWindow(matchedPlugin, path); } @@ -37,7 +35,15 @@ namespace QuickLook _viewWindow = new MainWindow(); _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()