Move archive viewer files to ArchiveFile namespace
Some checks failed
build / build (push) Has been cancelled
build / publish (push) Has been cancelled

Renamed and reorganized ArchiveViewer files into a new ArchiveFile subfolder and namespace for better code structure. Updated all relevant namespaces and references accordingly. Minor code cleanups were also applied, such as using collection initializers and default keyword.
This commit is contained in:
ema
2025-12-25 18:48:23 +08:00
parent 7073b132a9
commit 19805f06c5
10 changed files with 19 additions and 17 deletions

View File

@@ -19,7 +19,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
{
@@ -36,7 +36,7 @@ public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
_parent?.Children.Add(this, false);
}
public SortedList<ArchiveFileEntry, bool> Children { get; set; } = new SortedList<ArchiveFileEntry, bool>();
public SortedList<ArchiveFileEntry, bool> Children { get; set; } = [];
public string Name { get; set; }
public bool Encrypted { get; set; }

View File

@@ -1,8 +1,8 @@
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveFileListView"
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveFile.ArchiveFileListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.ArchiveViewer"
xmlns:local="clr-namespace:QuickLook.Plugin.ArchiveViewer.ArchiveFile"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="300"

View File

@@ -15,10 +15,11 @@
// 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 QuickLook.Plugin.ArchiveViewer.ArchiveFile;
using System;
using System.Windows.Controls;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
public partial class ArchiveFileListView : UserControl, IDisposable
{

View File

@@ -1,8 +1,8 @@
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveInfoPanel"
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveFile.ArchiveInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.ArchiveViewer"
xmlns:local="clr-namespace:QuickLook.Plugin.ArchiveViewer.ArchiveFile"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="infoPanel"
d:DesignHeight="600"

View File

@@ -15,12 +15,12 @@
// 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 QuickLook.Common.Annotations;
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using PureSharpCompress.Archives;
using PureSharpCompress.Common;
using PureSharpCompress.Readers;
using QuickLook.Common.Annotations;
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Helpers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropertyChanged
{

View File

@@ -21,7 +21,7 @@ using System;
using System.Text;
using UtfUnknown;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
internal class ChardetReaderOptions : ReaderOptions
{

View File

@@ -21,7 +21,7 @@ using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
public sealed class Percent100ToVisibilityVisibleConverter : DependencyObject, IValueConverter
{

View File

@@ -20,7 +20,7 @@ using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
public static class Extensions
{
@@ -33,7 +33,7 @@ public static class Extensions
public static T GetDescendantByType<T>(this Visual element) where T : class
{
if (element == null)
return default(T);
return default;
if (element.GetType() == typeof(T))
return element as T;

View File

@@ -25,7 +25,7 @@ using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.ArchiveViewer;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
/// <summary>
/// Internals are mostly from here:

View File

@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using QuickLook.Common.Plugin;
using QuickLook.Plugin.ArchiveViewer.ArchiveFile;
using System;
using System.IO;
using System.Linq;
@@ -53,7 +54,7 @@ public class Plugin : IViewer
//".eif", // QQ emoji file (Compound File Binary format)
];
private ArchiveInfoPanel _panel;
private IDisposable _panel;
public int Priority => -5;