-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
6,843 additions
and
6,745 deletions.
There are no files selected for viewing
Submodule QuickLook.Common
updated
21 files
+100 −101 | ExtensionMethods/BitmapExtensions.cs | |
+24 −25 | ExtensionMethods/DispatcherExtensions.cs | |
+11 −12 | ExtensionMethods/EnumerableExtensions.cs | |
+27 −28 | ExtensionMethods/FileExtensions.cs | |
+10 −11 | ExtensionMethods/TypeExtensions.cs | |
+85 −85 | Helpers/DisplayDeviceHelper.cs | |
+122 −123 | Helpers/FileHelper.cs | |
+21 −21 | Helpers/OSThemeHelper.cs | |
+53 −54 | Helpers/ProcessHelper.cs | |
+99 −101 | Helpers/SettingHelper.cs | |
+57 −59 | Helpers/TranslationHelper.cs | |
+165 −165 | Helpers/WindowHelper.cs | |
+38 −43 | NativeMethods/Dwmapi.cs | |
+28 −29 | NativeMethods/Kernel32.cs | |
+62 −63 | NativeMethods/MsCms.cs | |
+184 −178 | NativeMethods/User32.cs | |
+181 −182 | Plugin/ContextObject.cs | |
+40 −41 | Plugin/IViewer.cs | |
+11 −12 | Plugin/Themes.cs | |
+1 −2 | Styles/MainWindowStyles.Dark.xaml | |
+64 −64 | Styles/ScrollBarStyleDictionary.xaml |
127 changes: 63 additions & 64 deletions
127
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileEntry.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,98 @@ | ||
// Copyright © 2017 Paddy Xu | ||
// | ||
// | ||
// This file is part of QuickLook program. | ||
// | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace QuickLook.Plugin.ArchiveViewer | ||
namespace QuickLook.Plugin.ArchiveViewer; | ||
|
||
public class ArchiveFileEntry : IComparable<ArchiveFileEntry> | ||
{ | ||
public class ArchiveFileEntry : IComparable<ArchiveFileEntry> | ||
{ | ||
private readonly ArchiveFileEntry _parent; | ||
private int _cachedDepth = -1; | ||
private int _cachedLevel = -1; | ||
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; | ||
public ArchiveFileEntry(string name, bool isFolder, ArchiveFileEntry parent = null) | ||
{ | ||
Name = name; | ||
IsFolder = isFolder; | ||
|
||
_parent = parent; | ||
_parent?.Children.Add(this, false); | ||
} | ||
_parent = parent; | ||
_parent?.Children.Add(this, false); | ||
} | ||
|
||
public SortedList<ArchiveFileEntry, bool> Children { get; set; } = new SortedList<ArchiveFileEntry, bool>(); | ||
public SortedList<ArchiveFileEntry, bool> Children { get; set; } = new SortedList<ArchiveFileEntry, bool>(); | ||
|
||
public string Name { get; set; } | ||
public bool Encrypted { get; set; } | ||
public bool IsFolder { get; set; } | ||
public ulong Size { get; set; } | ||
public DateTime ModifiedDate { get; set; } | ||
public string Name { get; set; } | ||
public bool Encrypted { get; set; } | ||
public bool IsFolder { get; set; } | ||
public ulong Size { get; set; } | ||
public DateTime ModifiedDate { get; set; } | ||
|
||
/// <summary> | ||
/// Returns the maximum depth of all siblings | ||
/// </summary> | ||
public int Level | ||
/// <summary> | ||
/// Returns the maximum depth of all siblings | ||
/// </summary> | ||
public int Level | ||
{ | ||
get | ||
{ | ||
get | ||
{ | ||
if (_cachedLevel != -1) | ||
return _cachedLevel; | ||
if (_cachedLevel != -1) | ||
return _cachedLevel; | ||
|
||
if (_parent == null) | ||
_cachedLevel = GetDepth(); | ||
else | ||
_cachedLevel = _parent.Level - 1; | ||
if (_parent == null) | ||
_cachedLevel = GetDepth(); | ||
else | ||
_cachedLevel = _parent.Level - 1; | ||
|
||
return _cachedLevel; | ||
} | ||
return _cachedLevel; | ||
} | ||
} | ||
|
||
public int CompareTo(ArchiveFileEntry other) | ||
{ | ||
if (IsFolder == other.IsFolder) | ||
return string.Compare(Name, other.Name, StringComparison.CurrentCulture); | ||
|
||
if (IsFolder) | ||
return -1; | ||
public int CompareTo(ArchiveFileEntry other) | ||
{ | ||
if (IsFolder == other.IsFolder) | ||
return string.Compare(Name, other.Name, StringComparison.CurrentCulture); | ||
|
||
return 1; | ||
} | ||
if (IsFolder) | ||
return -1; | ||
|
||
/// <summary> | ||
/// Returns the number of nodes in the longest path to a leaf | ||
/// </summary> | ||
private int GetDepth() | ||
{ | ||
if (_cachedDepth != -1) | ||
return _cachedDepth; | ||
return 1; | ||
} | ||
|
||
var max = Children.Keys.Count == 0 ? 0 : Children.Keys.Max(r => r.GetDepth()); | ||
_cachedDepth = max + 1; | ||
/// <summary> | ||
/// Returns the number of nodes in the longest path to a leaf | ||
/// </summary> | ||
private int GetDepth() | ||
{ | ||
if (_cachedDepth != -1) | ||
return _cachedDepth; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
if (IsFolder) | ||
return $"{Name}"; | ||
var max = Children.Keys.Count == 0 ? 0 : Children.Keys.Max(r => r.GetDepth()); | ||
_cachedDepth = max + 1; | ||
return _cachedDepth; | ||
} | ||
|
||
var en = Encrypted ? "*" : ""; | ||
return $"{Name}{en},{IsFolder},{Size},{ModifiedDate}"; | ||
} | ||
public override string ToString() | ||
{ | ||
if (IsFolder) | ||
return $"{Name}"; | ||
|
||
var en = Encrypted ? "*" : ""; | ||
return $"{Name}{en},{IsFolder},{Size},{ModifiedDate}"; | ||
} | ||
} | ||
} |
71 changes: 35 additions & 36 deletions
71
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFileListView.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,61 @@ | ||
// Copyright © 2017 Paddy Xu | ||
// | ||
// | ||
// This file is part of QuickLook program. | ||
// | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Windows.Controls; | ||
|
||
namespace QuickLook.Plugin.ArchiveViewer | ||
namespace QuickLook.Plugin.ArchiveViewer; | ||
|
||
/// <summary> | ||
/// Interaction logic for ArchiveFileListView.xaml | ||
/// </summary> | ||
public partial class ArchiveFileListView : UserControl, IDisposable | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ArchiveFileListView.xaml | ||
/// </summary> | ||
public partial class ArchiveFileListView : UserControl, IDisposable | ||
public ArchiveFileListView() | ||
{ | ||
public ArchiveFileListView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
GC.SuppressFinalize(this); | ||
public void Dispose() | ||
{ | ||
GC.SuppressFinalize(this); | ||
|
||
IconManager.ClearCache(); | ||
} | ||
IconManager.ClearCache(); | ||
} | ||
|
||
public void SetDataContext(object context) | ||
{ | ||
treeGrid.DataContext = context; | ||
public void SetDataContext(object context) | ||
{ | ||
treeGrid.DataContext = context; | ||
|
||
treeView.LayoutUpdated += (sender, e) => | ||
{ | ||
// return when empty | ||
if (treeView.Items.Count == 0) | ||
return; | ||
treeView.LayoutUpdated += (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; | ||
// 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; | ||
var root = (TreeViewItem)treeView.ItemContainerGenerator.ContainerFromItem(treeView.Items[0]); | ||
if (root == null) | ||
return; | ||
|
||
root.IsExpanded = true; | ||
}; | ||
} | ||
root.IsExpanded = true; | ||
}; | ||
} | ||
} | ||
} |
54 changes: 40 additions & 14 deletions
54
QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.