diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
index b407c85..858272f 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveFile/Converters.cs
@@ -20,6 +20,7 @@ using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
+using System.Windows.Media;
namespace QuickLook.Plugin.ArchiveViewer.ArchiveFile;
@@ -142,10 +143,13 @@ public sealed class FileExtToIconConverter : DependencyObject, IMultiValueConver
var name = (string)values[0];
var isFolder = (bool)values[1];
+ object result;
if (isFolder)
- return IconManager.FindIconForDir(false);
+ result = IconManager.FindIconForDir(false);
+ else
+ result = IconManager.FindIconForFilename(name, false);
- return IconManager.FindIconForFilename(name, false);
+ return result is ImageSource img ? img : DependencyProperty.UnsetValue;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml
index 64546c3..39eaf65 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml
@@ -16,10 +16,14 @@
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml.cs
index 798c802..5530e15 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ChromiumResourcePackage/PakInfoPanel.xaml.cs
@@ -22,6 +22,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
+using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Controls;
@@ -57,7 +58,6 @@ public partial class PakInfoPanel : UserControl, IDisposable, INotifyPropertyCha
{
GC.SuppressFinalize(this);
_disposed = true;
- fileListView?.Dispose();
}
public event PropertyChangedEventHandler PropertyChanged;
@@ -106,7 +106,7 @@ public partial class PakInfoPanel : UserControl, IDisposable, INotifyPropertyCha
{
if (_disposed)
return;
- fileListView?.SetDataContext(_fileEntries[string.Empty].Children.Keys);
+ fileListView?.DataContext = _fileEntries[string.Empty].Children.Keys;
archiveCount.Content = $"PAK File{t}";
archiveSizeC.Content = string.Empty;
archiveSizeU.Content = $"Total resource size {((long)sizeU).ToPrettySize(2)}";
@@ -118,14 +118,40 @@ public partial class PakInfoPanel : UserControl, IDisposable, INotifyPropertyCha
private void LoadItemsFromPak(string path)
{
var dict = PakExtractor.ExtractToDictionary(path, true);
+ var modifiedDate = File.GetLastWriteTime(path);
+
foreach (var kv in dict)
{
- _fileEntries.TryGetValue(string.Empty, out var parent);
- var entry = new ArchiveFileEntry(kv.Key, false, parent)
+ var fragments = kv.Key.Split(['/', '\\'], StringSplitOptions.RemoveEmptyEntries);
+ string currentPath = string.Empty;
+ ArchiveFileEntry parent = _fileEntries[string.Empty];
+
+ for (int i = 0; i < fragments.Length - 1; i++)
{
- Size = (ulong)kv.Value.Length
- };
- _fileEntries.Add(kv.Key, entry);
+ var dirName = fragments[i];
+ currentPath = string.IsNullOrEmpty(currentPath) ? dirName : currentPath + "\\" + dirName;
+ if (!_fileEntries.TryGetValue(currentPath, out var dirEntry))
+ {
+ dirEntry = new ArchiveFileEntry(dirName, true, parent)
+ {
+ ModifiedDate = modifiedDate,
+ };
+ _fileEntries.Add(currentPath, dirEntry);
+ }
+ parent = dirEntry;
+ }
+
+ var fileName = fragments.Last();
+ var filePath = fragments.Length > 1 ? currentPath + "\\" + fileName : fileName;
+ if (!_fileEntries.ContainsKey(filePath))
+ {
+ var entry = new ArchiveFileEntry(fileName, false, parent)
+ {
+ Size = (ulong)kv.Value.Length,
+ ModifiedDate = modifiedDate,
+ };
+ _fileEntries.Add(filePath, entry);
+ }
}
}