diff --git a/QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj b/QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj index d382463..1c3126c 100644 --- a/QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj +++ b/QuickLook.Native/QuickLook.Native32/QuickLook.Native32.vcxproj @@ -15,20 +15,20 @@ {D31EE321-C2B0-4984-B749-736F7DE509F1} Win32Proj QuickLookNative32 - 10.0.17134.0 + 10.0 QuickLook.Native32 DynamicLibrary true - v141 + v142 Unicode DynamicLibrary false - v141 + v142 true Unicode diff --git a/QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj b/QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj index 6ac16c6..d4e348b 100644 --- a/QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj +++ b/QuickLook.Native/QuickLook.Native64/QuickLook.Native64.vcxproj @@ -35,20 +35,20 @@ 15.0 {794E4DCF-F715-4836-9D30-ABD296586D23} QuickLookNative64 - 10.0.17134.0 + 10.0 QuickLook.Native64 DynamicLibrary true - v141 + v142 Unicode DynamicLibrary false - v141 + v142 true Unicode diff --git a/QuickLook.Native/QuickLook.WoW64HookHelper/QuickLook.WoW64HookHelper.vcxproj b/QuickLook.Native/QuickLook.WoW64HookHelper/QuickLook.WoW64HookHelper.vcxproj index 34ef1f6..0d584ce 100644 --- a/QuickLook.Native/QuickLook.WoW64HookHelper/QuickLook.WoW64HookHelper.vcxproj +++ b/QuickLook.Native/QuickLook.WoW64HookHelper/QuickLook.WoW64HookHelper.vcxproj @@ -15,20 +15,20 @@ {2C58F9B2-D8FA-4586-942B-5170CECE5963} Win32Proj QuickLookWoW64HookHelper - 10.0.17134.0 + 10.0 QuickLook.WoW64HookHelper Application true - v141 + v142 Unicode Application false - v141 + v142 true Unicode diff --git a/QuickLook/Helpers/OSThemeHelper.cs b/QuickLook/Helpers/OSThemeHelper.cs new file mode 100644 index 0000000..5e7f31c --- /dev/null +++ b/QuickLook/Helpers/OSThemeHelper.cs @@ -0,0 +1,41 @@ +// Copyright © 2019 Paddy Xu +// +// 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 Microsoft.Win32; + +namespace QuickLook.Helpers +{ + internal class OSThemeHelper + { + public static bool AppsUseDarkTheme() + { + var value = Registry.GetValue( + @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", + "AppsUseLightTheme", 1); + + return value != null && (int)value == 0; + } + public static bool SystemUsesDarkTheme() + { + var value = Registry.GetValue( + @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", + "SystemUsesLightTheme", 0); + + return value == null || (int)value == 0; + } + } +} \ No newline at end of file diff --git a/QuickLook/Properties/Resources.Designer.cs b/QuickLook/Properties/Resources.Designer.cs index 5e25a89..ba8196b 100644 --- a/QuickLook/Properties/Resources.Designer.cs +++ b/QuickLook/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace QuickLook.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -80,6 +80,36 @@ namespace QuickLook.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon app_black { + get { + object obj = ResourceManager.GetObject("app_black", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon app_black_16 { + get { + object obj = ResourceManager.GetObject("app_black_16", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap app_black_png { + get { + object obj = ResourceManager.GetObject("app_black_png", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/QuickLook/Properties/Resources.resx b/QuickLook/Properties/Resources.resx index 7057d36..344f48d 100644 --- a/QuickLook/Properties/Resources.resx +++ b/QuickLook/Properties/Resources.resx @@ -124,6 +124,15 @@ ..\Resources\app_16.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\app_black.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\app_black_16.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\app_black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\app.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index 3821eee..095a325 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -94,7 +94,7 @@ False - ..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll + $(SystemRoot)\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll @@ -103,13 +103,13 @@ 4.0 - ..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0\Facade\windows.winmd + $(SystemRoot)\..\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0\Facade\windows.winmd - ..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd + $(SystemRoot)\..\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd - ..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.UniversalApiContract\6.0.0.0\Windows.Foundation.UniversalApiContract.winmd + $(SystemRoot)\..\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.UniversalApiContract\7.0.0.0\Windows.Foundation.UniversalApiContract.winmd @@ -142,6 +142,7 @@ + @@ -196,6 +197,9 @@ True Resources.resx + + + diff --git a/QuickLook/Resources/app_black.ico b/QuickLook/Resources/app_black.ico new file mode 100644 index 0000000..ef28dc8 Binary files /dev/null and b/QuickLook/Resources/app_black.ico differ diff --git a/QuickLook/Resources/app_black.png b/QuickLook/Resources/app_black.png new file mode 100644 index 0000000..aa31969 Binary files /dev/null and b/QuickLook/Resources/app_black.png differ diff --git a/QuickLook/Resources/app_black_16.ico b/QuickLook/Resources/app_black_16.ico new file mode 100644 index 0000000..8c6ad96 Binary files /dev/null and b/QuickLook/Resources/app_black_16.ico differ diff --git a/QuickLook/TrayIconManager.cs b/QuickLook/TrayIconManager.cs index bd0777b..27bc74b 100644 --- a/QuickLook/TrayIconManager.cs +++ b/QuickLook/TrayIconManager.cs @@ -74,9 +74,12 @@ namespace QuickLook { var scale = DpiHelper.GetCurrentScaleFactor().Vertical; - if (App.IsWin10) - return scale > 1 ? Resources.app_white : Resources.app_white_16; - return scale > 1 ? Resources.app : Resources.app_16; + if (!App.IsWin10) + return scale > 1 ? Resources.app : Resources.app_16; + + return OSThemeHelper.SystemUsesDarkTheme() + ? (scale > 1 ? Resources.app_white : Resources.app_white_16) + : (scale > 1 ? Resources.app_black : Resources.app_black_16); } public static void ShowNotification(string title, string content, bool isError = false, int timeout = 5000, diff --git a/QuickLook/ViewerWindow.Properties.cs b/QuickLook/ViewerWindow.Properties.cs index d057b4e..43055ef 100644 --- a/QuickLook/ViewerWindow.Properties.cs +++ b/QuickLook/ViewerWindow.Properties.cs @@ -19,9 +19,9 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows; -using Microsoft.Win32; using QuickLook.Common.Annotations; using QuickLook.Common.Plugin; +using QuickLook.Helpers; namespace QuickLook { @@ -73,10 +73,7 @@ namespace QuickLook switch (theme) { case Themes.None: - var t = Registry.GetValue( - @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", - "AppsUseLightTheme", 1); - isDark = t != null && (int) t == 0; + isDark = OSThemeHelper.AppsUseDarkTheme(); break; case Themes.Dark: case Themes.Light: diff --git a/Scripts/pack-appx-dev.ps1 b/Scripts/pack-appx-dev.ps1 index cec415f..b97e87e 100644 --- a/Scripts/pack-appx-dev.ps1 +++ b/Scripts/pack-appx-dev.ps1 @@ -24,11 +24,11 @@ if(-not (Test-Path env:CI)) Update-Version("..\Build\Appx\AppxManifest.xml") # generate resources - $priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makepri.exe' + $priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe' .$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri # packing - $packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makeappx.exe' + $packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe' $folder = '..\Build\Appx\' .$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx diff --git a/Scripts/pack-appx.ps1 b/Scripts/pack-appx.ps1 index 6d40bbc..7af158c 100644 --- a/Scripts/pack-appx.ps1 +++ b/Scripts/pack-appx.ps1 @@ -24,11 +24,11 @@ if(-not (Test-Path env:CI)) Update-Version("..\Build\Appx\AppxManifest.xml") # generate resources - $priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makepri.exe' + $priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe' .$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri # packing - $packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\makeappx.exe' + $packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe' $folder = '..\Build\Appx\' .$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx diff --git a/Scripts/sign-appx.ps1 b/Scripts/sign-appx.ps1 index e633ced..b86eb9b 100644 --- a/Scripts/sign-appx.ps1 +++ b/Scripts/sign-appx.ps1 @@ -1,4 +1,4 @@ -$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86\signtool.exe' +$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe' $files = gci '..\Build\QuickLook-*.appx' | %{('"{0}"' -f $_.FullName)} $timestampUrl = 'http://time.certum.pl/'