Compare commits

..

8 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
41ecf12abb Add SessionEnding handler to prevent shutdown errors
- Add SessionEnding event handler to gracefully handle Windows shutdown/logoff
- Refactor cleanup code into PerformCleanup method with individual error handling
- Wrap each disposal operation in try-catch to prevent cascade failures
- This fixes exception code c0020001 during Windows 25H2 shutdown

Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-10-21 04:02:09 +00:00
copilot-swe-agent[bot]
16712cf508 Initial plan 2025-10-21 03:55:33 +00:00
ema
e0eb87bcc3 Add .slnx solution file
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled
2025-10-20 01:11:47 +08:00
ema
7146a2a220 Update changelog for 4.2.2 release
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled
2025-10-15 23:09:49 +08:00
ema
491f55b6a8 Update changelog for 4.2.1 release
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled
2025-10-15 01:18:57 +08:00
ema
d25b7b32de Fix theme error in some theme-changable plugin #1507 2025-10-15 00:03:56 +08:00
ema
a887ca3014 Refactor SvgImagePanel.MimeTypes to use base class methods 2025-10-14 23:52:11 +08:00
ema
5d3fd85238 Fix theme error in MediaInfoViewer plugin #1775 2025-10-14 23:28:08 +08:00
7 changed files with 174 additions and 24 deletions

View File

@@ -1,3 +1,12 @@
## 4.2.2
- Fix version display issue [#1776](https://github.com/QL-Win/QuickLook/issues/1776)
## 4.2.1
- Fix theme error in MediaInfoViewer plugin [#1775](https://github.com/QL-Win/QuickLook/issues/1775)
- Fix theme error in any theme-changable plugin [#1507](https://github.com/QL-Win/QuickLook/issues/1507)
## 4.2.0
- Add built-in MediaInfoViewer plugin and support it in more menu

View File

@@ -186,24 +186,13 @@ public class SvgImagePanel : WebpagePanel, IWebImagePanel
return reader.ReadToEnd();
}
public static class MimeTypes
public new static class MimeTypes
{
public const string Html = "text/html";
public const string JavaScript = "application/javascript";
public const string Json = "application/json";
public const string Css = "text/css";
public const string Binary = "application/octet-stream";
public static string GetContentTypeHeader(string extension = null)
=> $"Content-Type: {WebpagePanel.MimeTypes.GetMimeType(extension)}";
public static string GetContentTypeHeader(string extension = null) => $"Content-Type: {GetMimeType(extension)}";
public static string GetMimeType(string extension = null) => extension?.ToLowerInvariant() switch
{
".js" => JavaScript, // Only handle known extensions from resources
".json" => Json,
".css" => Css,
".html" => Html,
_ => Binary,
};
public static string GetMimeType(string extension = null)
=> WebpagePanel.MimeTypes.GetMimeType(extension);
}
}

View File

@@ -24,6 +24,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace QuickLook.Plugin.MediaInfoViewer;
@@ -100,14 +101,15 @@ public partial class Plugin : IViewer, IMoreMenuExtended
if (isDark)
{
context.Theme = Themes.Dark;
tvp.Foreground = new BrushConverter().ConvertFromString("#FFEFEFEF") as SolidColorBrush;
tvp.Background = Brushes.Transparent;
tvp.SetResourceReference(TextBlock.ForegroundProperty, "WindowTextForeground");
}
else
{
context.Theme = Themes.Light;
tvp.Foreground = new BrushConverter().ConvertFromString("#BBFAFAFA") as SolidColorBrush;
tvp.Background = Brushes.Transparent;
tvp.Background = OSThemeHelper.AppsUseDarkTheme()
? new SolidColorBrush(Color.FromArgb(175, 255, 255, 255))
: Brushes.Transparent;
}
}
}

71
QuickLook.slnx Normal file
View File

@@ -0,0 +1,71 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="x64" />
</Configurations>
<Folder Name="/QuickLook.Native/">
<Project Path="QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj" Id="d31ee321-c2b0-4984-b749-736f7de509f1">
<Platform Project="Win32" />
</Project>
<Project Path="QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj" Id="794e4dcf-f715-4836-9d30-abd296586d23" />
</Folder>
<Folder Name="/QuickLook.Plugin/">
<Project Path="QuickLook.Plugin/QuickLook.Plugin.AppViewer/QuickLook.Plugin.AppViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/QuickLook.Plugin.CLSIDViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.ELFViewer/QuickLook.Plugin.ELFViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.FontViewer/QuickLook.Plugin.FontViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.HelixViewer/QuickLook.Plugin.HelixViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.MediaInfoViewer/QuickLook.Plugin.MediaInfoViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/QuickLook.Plugin.OfficeViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.PEViewer/QuickLook.Plugin.PEViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.PluginInstaller/QuickLook.Plugin.PluginInstaller.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.ThumbnailViewer/QuickLook.Plugin.ThumbnailViewer.csproj" />
<Project Path="QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path="GitVersion.cs" />
</Folder>
<Project Path="QuickLook.Common/QuickLook.Common.csproj">
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="QuickLook.Installer/QuickLook.Installer.wixproj" Id="f0214fc2-efbe-426c-842d-b42bc37d9525">
<BuildDependency Project="QuickLook.Common/QuickLook.Common.csproj" />
<BuildDependency Project="QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj" />
<BuildDependency Project="QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.AppViewer/QuickLook.Plugin.AppViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/QuickLook.Plugin.CLSIDViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.ELFViewer/QuickLook.Plugin.ELFViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.FontViewer/QuickLook.Plugin.FontViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.HelixViewer/QuickLook.Plugin.HelixViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.MediaInfoViewer/QuickLook.Plugin.MediaInfoViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/QuickLook.Plugin.OfficeViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.PEViewer/QuickLook.Plugin.PEViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.PluginInstaller/QuickLook.Plugin.PluginInstaller.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.ThumbnailViewer/QuickLook.Plugin.ThumbnailViewer.csproj" />
<BuildDependency Project="QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj" />
<BuildDependency Project="QuickLook/QuickLook.csproj" />
<Platform Project="x86" />
<Build />
</Project>
<Project Path="QuickLook/QuickLook.csproj">
<BuildDependency Project="QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj" />
<BuildDependency Project="QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj" />
<Platform Solution="*|x64" Project="x64" />
</Project>
</Solution>

View File

@@ -5,6 +5,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:vio="http://schemas.lepo.co/wpfui/2022/xaml/violeta"
Exit="App_OnExit"
SessionEnding="App_OnSessionEnding"
ShutdownMode="OnExplicitShutdown"
Startup="Application_Startup">
<Application.Resources>

View File

@@ -282,17 +282,83 @@ public partial class App : Application
PipeServerManager.GetInstance();
}
private void App_OnSessionEnding(object sender, SessionEndingCancelEventArgs e)
{
// Windows is shutting down or user is logging off
// Clean up resources gracefully to prevent CLR exceptions during shutdown
try
{
PerformCleanup();
}
catch (Exception ex)
{
// Log the error but don't prevent shutdown
ProcessHelper.WriteLog($"Error during SessionEnding: {ex}");
}
}
private void App_OnExit(object sender, ExitEventArgs e)
{
if (!_cleanExit)
return;
_isRunning.ReleaseMutex();
try
{
PerformCleanup();
}
catch (Exception ex)
{
// Log the error but don't crash during exit
ProcessHelper.WriteLog($"Error during Exit: {ex}");
}
}
PipeServerManager.GetInstance().Dispose();
TrayIconManager.GetInstance().Dispose();
KeystrokeDispatcher.GetInstance().Dispose();
ViewWindowManager.GetInstance().Dispose();
private void PerformCleanup()
{
try
{
_isRunning?.ReleaseMutex();
}
catch (Exception ex)
{
ProcessHelper.WriteLog($"Error releasing mutex: {ex}");
}
try
{
PipeServerManager.GetInstance()?.Dispose();
}
catch (Exception ex)
{
ProcessHelper.WriteLog($"Error disposing PipeServerManager: {ex}");
}
try
{
TrayIconManager.GetInstance()?.Dispose();
}
catch (Exception ex)
{
ProcessHelper.WriteLog($"Error disposing TrayIconManager: {ex}");
}
try
{
KeystrokeDispatcher.GetInstance()?.Dispose();
}
catch (Exception ex)
{
ProcessHelper.WriteLog($"Error disposing KeystrokeDispatcher: {ex}");
}
try
{
ViewWindowManager.GetInstance()?.Dispose();
}
catch (Exception ex)
{
ProcessHelper.WriteLog($"Error disposing ViewWindowManager: {ex}");
}
}
private bool EnsureFirstInstance(string[] args)

View File

@@ -23,6 +23,8 @@ using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;
using Wpf.Ui.Appearance;
using Wpf.Ui.Violeta.Appearance;
namespace QuickLook;
@@ -105,14 +107,24 @@ public partial class ViewerWindow : INotifyPropertyChanged
if (isDark)
{
CurrentTheme = Themes.Dark;
// Update theme for QuickLook controls
if (!Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Add(_darkDict);
// Update theme for WPF-UI controls
ThemeManager.Apply(ApplicationTheme.Dark);
}
else
{
CurrentTheme = Themes.Light;
// Update theme for QuickLook controls
if (Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Remove(_darkDict);
// Update theme for WPF-UI controls
ThemeManager.Apply(ApplicationTheme.Light);
}
}
}