diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml index 4507520..e35cf60 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml @@ -8,11 +8,5 @@ FontSize="14" UseLayoutRounding="True" mc:Ignorable="d"> - - - - + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml.cs index 60155e2..05ff0b9 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml.cs @@ -24,6 +24,7 @@ public partial class CLSIDInfoPanel : UserControl { public CLSIDInfoPanel() { + DataContext = this; InitializeComponent(); } @@ -31,13 +32,21 @@ public partial class CLSIDInfoPanel : UserControl { switch (path.ToUpper()) { - case "::{645FF040-5081-101B-9F08-00AA002F954E}" // Recycle Bin - or "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}": // This PC + case CLSIDRegister.RecycleBin: + Content = new RecycleBinPanel(); + break; + + case CLSIDRegister.ThisPC: + Content = new ThisPCPanel(); break; default: - UnsupportedTextBlock.Text = $"Unsupported for {path}"; - UnsupportedTextBlock.Visibility = Visibility.Visible; + Content = new TextBlock() + { + Text = $"Unsupported for {path}", + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + }; break; } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDRegister.cs b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDRegister.cs index 0ecf12a..087df31 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDRegister.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDRegister.cs @@ -23,6 +23,9 @@ namespace QuickLook.Plugin.CLSIDViewer; internal static class CLSIDRegister { + public const string RecycleBin = "::{645FF040-5081-101B-9F08-00AA002F954E}"; + public const string ThisPC = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"; + public static string GetName(string clsid) { try @@ -31,10 +34,10 @@ internal static class CLSIDRegister string displayName = Registry.GetValue($@"HKEY_CLASSES_ROOT\CLSID\{clsid.Replace(":", string.Empty)}", string.Empty, null)?.ToString(); return displayName; } - catch (Exception ex) + catch (Exception e) { - Debug.WriteLine("Error reading registry: " + ex.Message); + Debug.WriteLine("Error reading registry: " + e.Message); } - return string.Empty; + return null; } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/Plugin.cs index 79c52fa..eb53f52 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/Plugin.cs @@ -47,7 +47,12 @@ public class Plugin : IViewer public void Prepare(string path, ContextObject context) { - context.PreferredSize = new Size { Width = 520, Height = 192 }; + context.PreferredSize = path switch + { + CLSIDRegister.RecycleBin => new Size { Width = 520, Height = 192 }, + CLSIDRegister.ThisPC => new Size { Width = 900, Height = 800 }, + _ => new Size { Width = 520, Height = 192 }, + }; } public void View(string path, ContextObject context) @@ -59,7 +64,7 @@ public class Plugin : IViewer _ip.Tag = context; context.ViewerContent = _ip; - context.Title = $"{CLSIDRegister.GetName(path)}"; + context.Title = $"{CLSIDRegister.GetName(path) ?? path}"; context.IsBusy = false; } diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml new file mode 100644 index 0000000..44d10c3 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml @@ -0,0 +1,24 @@ + + + + +