diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/CompoundInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/CompoundInfoPanel.xaml.cs index 0dbe18d..51ef023 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/CompoundInfoPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/CompoundFileBinary/CompoundInfoPanel.xaml.cs @@ -1,3 +1,20 @@ +// Copyright © 2017-2025 QL-Win Contributors +// +// 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 . + using QuickLook.Common.ExtensionMethods; using QuickLook.Common.Helpers; using QuickLook.Plugin.ArchiveViewer.ArchiveFile; @@ -6,7 +23,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices.ComTypes; using System.Threading.Tasks; using System.Windows.Controls; diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.MoreMenu.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.MoreMenu.cs new file mode 100644 index 0000000..788b275 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.MoreMenu.cs @@ -0,0 +1,88 @@ +// Copyright © 2017-2025 QL-Win Contributors +// +// 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 . + +using QuickLook.Common.Commands; +using QuickLook.Common.Controls; +using QuickLook.Common.Helpers; +using QuickLook.Common.Plugin.MoreMenu; +using QuickLook.Plugin.ArchiveViewer.CompoundFileBinary; +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows.Input; +using WindowsAPICodePack.Dialogs; + +namespace QuickLook.Plugin.ArchiveViewer; + +public partial class Plugin +{ + public ICommand ExtractToDirectoryCommand { get; } + + public Plugin() + { + ExtractToDirectoryCommand = new AsyncRelayCommand(ExtractToDirectoryAsync); + } + + public IEnumerable GetMenuItems() + { + if (_path.EndsWith(".eif", StringComparison.OrdinalIgnoreCase)) + { + string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config"); + + yield return new MoreMenuItem() + { + Icon = FontSymbols.MoveToFolder, + Header = TranslationHelper.Get("MW_ExtractToDirectory", translationFile), + MenuItems = null, + Command = ExtractToDirectoryCommand, + }; + } + } + + public async Task ExtractToDirectoryAsync() + { + using CommonOpenFileDialog dialog = new() + { + IsFolderPicker = true, + }; + + if (dialog.ShowDialog() == CommonFileDialogResult.Ok) + { + await Task.Run(() => + { + if (_path.EndsWith(".cfb", StringComparison.OrdinalIgnoreCase)) + { + CompoundFileExtractor.ExtractToDirectory(_path, dialog.FileName); + } + else if (_path.EndsWith(".eif", StringComparison.OrdinalIgnoreCase)) + { + CompoundFileExtractor.ExtractToDirectory(_path, dialog.FileName); + + string faceDatPath = Path.Combine(dialog.FileName, "face.dat"); + + if (File.Exists(faceDatPath)) + { + Dictionary> faceDat = FaceDatDecoder.Decode(File.ReadAllBytes(faceDatPath)); + _ = faceDat; + } + } + }); + } + } +} diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs index 433ef15..181d4fd 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs @@ -16,16 +16,18 @@ // along with this program. If not, see . using QuickLook.Common.Plugin; +using QuickLook.Common.Plugin.MoreMenu; using QuickLook.Plugin.ArchiveViewer.ArchiveFile; using QuickLook.Plugin.ArchiveViewer.CompoundFileBinary; using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; namespace QuickLook.Plugin.ArchiveViewer; -public class Plugin : IViewer +public partial class Plugin : IViewer, IMoreMenu { private static readonly string[] _extensions = [ @@ -56,9 +58,12 @@ public class Plugin : IViewer ]; private IDisposable _panel; + private string _path; public int Priority => -5; + public IEnumerable MenuItems => GetMenuItems(); + public void Init() { } @@ -70,6 +75,7 @@ public class Plugin : IViewer public void Prepare(string path, ContextObject context) { + _path = path; context.PreferredSize = new Size { Width = 800, Height = 400 }; } diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj index 15c1d3c..78f0041 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj @@ -54,6 +54,7 @@ + @@ -70,4 +71,10 @@ + + + PreserveNewest + + + diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config new file mode 100644 index 0000000..8019dba --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Translations.config @@ -0,0 +1,91 @@ + + + + + استخراج إلى المجلد + + + Extreu a la carpeta + + + חלץ לתיקייה + + + डायरेक्टरी में निकालें + + + डायरेक्टरीमध्ये काढा + + + Kibontás mappába + + + Pakk ut til mappe + + + Uitpakken naar map + + + Extrahovať do priečinka + + + Ekstrak ke folder + + + Extract to directory + + + 폴더로 추출 + + + Extrair para a pasta + + + Extrair para a pasta + + + Извлечь в папку + + + Klasöre çıkar + + + Trích xuất vào thư mục + + + Extrair para a pasta + + + Extraire vers le dossier + + + Extraer a la carpeta + + + Estrai nella cartella + + + Wyodrębnij do folderu + + + Εξαγωγή σε φάκελο + + + Розпакувати до папки + + + 提取到目录 + + + 提取到資料夾 + + + フォルダに抽出 + + + In Ordner extrahieren + + + Extrahera till mapp + +