Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
add fallback to desktop wallpaper cache & upd. nuget & improve IsTaskEnabled method
Greedeks947eafb166ed
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 7e1f41c4..92723dd0 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -113,11 +113,11 @@<Reference Include="WindowsBase" /><Reference Include="PresentationCore" /><Reference Include="PresentationFramework" />- <Reference Include="Wpf.Ui, Version=4.1.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">- <HintPath>..\..\packages\WPF-UI.4.1.0\lib\net472\Wpf.Ui.dll</HintPath>+ <Reference Include="Wpf.Ui, Version=4.2.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">+ <HintPath>..\..\packages\WPF-UI.4.2.0\lib\net472\Wpf.Ui.dll</HintPath></Reference>- <Reference Include="Wpf.Ui.Abstractions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">- <HintPath>..\..\packages\WPF-UI.Abstractions.4.1.0\lib\net462\Wpf.Ui.Abstractions.dll</HintPath>+ <Reference Include="Wpf.Ui.Abstractions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=11f9f5cc97b3ffd6, processorArchitecture=MSIL">+ <HintPath>..\..\packages\WPF-UI.Abstractions.4.2.0\lib\net462\Wpf.Ui.Abstractions.dll</HintPath></Reference><Reference Include="XamlRadialProgressBar.DotNet, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL"><HintPath>..\..\packages\XamlRadialProgressBar.1.0.3\lib\net452\XamlRadialProgressBar.DotNet.dll</HintPath>diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.csindex 9f6ae491..0ef30ddd 100644--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs@@ -170,11 +170,14 @@ namespace GTweak.Utilities.Configuration{string wallpaperPath = RegistryHelp.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper", string.Empty);- if (!string.IsNullOrWhiteSpace(wallpaperPath) && File.Exists(wallpaperPath))+ string filePath = !string.IsNullOrWhiteSpace(wallpaperPath) && File.Exists(wallpaperPath) ? wallpaperPath :+ Directory.GetFiles(PathLocator.Folders.WallpaperCache, "TranscodedWallpaper*").Select(f => new FileInfo(f)).Where(f => f.Exists).OrderByDescending(f => f.LastWriteTime).FirstOrDefault()?.FullName;++ if (!string.IsNullOrWhiteSpace(filePath)){BitmapImage bmp = new BitmapImage();bmp.BeginInit();- bmp.UriSource = new Uri(wallpaperPath, UriKind.Absolute);+ bmp.UriSource = new Uri(filePath, UriKind.Absolute);bmp.DecodePixelWidth = 100;bmp.CacheOption = BitmapCacheOption.OnLoad;bmp.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;diff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Utilities/Controls/PathLocator.csindex f1a96ccb..03654003 100644--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs+++ b/.Source/GTweak/Utilities/Controls/PathLocator.cs@@ -20,6 +20,8 @@ namespace GTweak.Utilities.Controlsinternal static readonly string WindowsOld = Path.Combine(SystemDrive, "Windows.old");internal static readonly string Tasks = Path.Combine(Environment.SystemDirectory, "Tasks");++ internal static readonly string WallpaperCache = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft", "Windows", "Themes");}internal static class Executable@@ -276,7 +278,6 @@ namespace GTweak.Utilities.Controlsreturn (string.Empty, string.Empty);}-internal static readonly string CommandShell = FindExecutablePath("cmd.exe");internal static readonly string PowerShell = FindExecutablePath("pwsh.exe", "powershell.exe");diff --git a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.csindex a108b8cf..4c9921b0 100644--- a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs+++ b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs@@ -13,30 +13,23 @@ namespace GTweak.Utilities.Managers{internal static bool IsTaskEnabled(params string[] tasklist){- Task<bool> task = Task.Run(() =>+ if (tasklist != null && tasklist.Length != 0){- bool result = false;+ using Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService();- string[] existingTasks = GetExistingTasks(tasklist);-- if (existingTasks.Length != 0)+ foreach (var taskName in tasklist){- byte numberRunningTask = 0;- using (Microsoft.Win32.TaskScheduler.TaskService taskService = new Microsoft.Win32.TaskScheduler.TaskService())+ Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(taskName);+ if (task != null && task.Enabled){- numberRunningTask += (byte)(from string taskname in existingTasks- let task = taskService.GetTask(taskname)- where task != null- where task.Enabled- select taskname).Count();+ return true;}- result = numberRunningTask > 0;}- return result;- });+ return false;+ }- return task.Result;+ return false;}internal static void SetTaskState(bool state, params string[] tasklist)diff --git a/.Source/GTweak/packages.config b/.Source/GTweak/packages.configindex a39f662a..ac0af6e5 100644--- a/.Source/GTweak/packages.config+++ b/.Source/GTweak/packages.config@@ -9,7 +9,7 @@<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" /><package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" /><package id="TaskScheduler" version="2.12.2" targetFramework="net48" />- <package id="WPF-UI" version="4.1.0" targetFramework="net48" />- <package id="WPF-UI.Abstractions" version="4.1.0" targetFramework="net48" />+ <package id="WPF-UI" version="4.2.0" targetFramework="net48" />+ <package id="WPF-UI.Abstractions" version="4.2.0" targetFramework="net48" /><package id="XamlRadialProgressBar" version="1.0.3" targetFramework="net48" /></packages>\ No newline at end of file