Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
v 5.2.1 | upd methods & re
Greedeks4e2bf8128cce
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.csindex 78d9dd84..362340d3 100644--- a/.Source/GTweak/Properties/AssemblyInfo.cs+++ b/.Source/GTweak/Properties/AssemblyInfo.cs@@ -7,9 +7,9 @@ using System.Windows;[assembly: AssemblyProduct("GTweak")][assembly: AssemblyCopyright("© 2024-2025 Greedeks")][assembly: AssemblyTrademark("Greedeks")]-[assembly: AssemblyInformationalVersion("Build: 5.2.0")]-[assembly: AssemblyVersion("5.2.62.782")]-[assembly: AssemblyFileVersion("5.2.62.782")]+[assembly: AssemblyInformationalVersion("Build: 5.2.1")]+[assembly: AssemblyVersion("5.2.46.779")]+[assembly: AssemblyFileVersion("5.2.46.779")][assembly: ComVisible(false)]diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.ttindex 15fd0044..525384f3 100644--- a/.Source/GTweak/Properties/AssemblyInfo.tt+++ b/.Source/GTweak/Properties/AssemblyInfo.tt@@ -20,7 +20,7 @@ using System.Windows;ResourceDictionaryLocation.SourceAssembly)]<#+- private const string buildVersion = "Build: 5.2.0";+ private const string buildVersion = "Build: 5.2.1";private string GenerateVersion(){diff --git a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.csindex 70b4dadd..ca865f76 100644--- a/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs+++ b/.Source/GTweak/Utilities/Tweaks/ClearingMemory.cs@@ -178,8 +178,11 @@ namespace GTweak.Utilities.Tweaksreturn num != 0;}- private static void ClearTempSystemCache(bool shouldRemoveWinOld = false)+ internal static void StartMemoryCleanupAsync(bool shouldRemoveWinOld = false){+ ClearFileSystemCache(true);+ EmptyWorkingSetFunction();+if (shouldRemoveWinOld){string filePath = Path.Combine(StoragePaths.SystemDisk, "Windows.old");@@ -209,12 +212,5 @@ namespace GTweak.Utilities.Tweaksawait Task.Delay(200);});}-- internal async void StartMemoryCleanup(bool removeWinOldFlag = false)- {- BackgroundQueue backgroundQueue = new BackgroundQueue();- await backgroundQueue.QueueTask(delegate { ClearFileSystemCache(true); EmptyWorkingSetFunction(); ClearTempSystemCache(removeWinOldFlag); });- new ViewNotification(500).Show("", "info", "clear_ram_notification");- }}}diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.csindex 18299dcc..e8f1d82e 100644--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs@@ -66,7 +66,7 @@ namespace GTweak.Utilities.TweaksSystemDiagnostics.IsWindowsVersion[11] && RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAl", "0");interfaceV.TglButton16.StateNA =- SystemDiagnostics.IsWindowsVersion[11] &&+ SystemDiagnostics.IsWindowsVersion[11] &&(RegistryHelp.CheckValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_Layout", "1") ||SystemDiagnostics.HardwareData.OSVersion.IndexOf("home", StringComparison.OrdinalIgnoreCase) < 0 &&(RegistryHelp.CheckValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\current\device\Start", "HideRecommendedSection", "1") ||diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.csindex 8a876fe0..725c71f9 100644--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs@@ -81,7 +81,7 @@ namespace GTweak.Utilities.Tweaksinternal void LoadInstalledPackages() => InstalledPackages = RegistryHelp.GetSubKeyNames<HashSet<string>>(Registry.CurrentUser, @"Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages");- internal static Task DeletingPackage(string packageName, bool removeWebViewFlag = false)+ internal static Task DeletingPackage(string packageName, bool shouldRemoveWebView = false){if (packageName == "OneDrive")return DeletedOneDrive();@@ -185,59 +185,10 @@ namespace GTweak.Utilities.Tweakscatch (Exception ex) { ErrorLogging.LogDebug(ex); }break;case "Edge":- string script = $@"- $region = (Get-ItemProperty -Path 'Registry::HKEY_USERS\.DEFAULT\Control Panel\International\Geo').Name- $policyFile = '{StoragePaths.SystemDisk}Windows\System32\IntegratedServicesRegionPolicySet.json'-- if (Test-Path $policyFile) {{- $json = Get-Content -Path $policyFile -Raw | ConvertFrom-Json-- if (-not $json.Policies) {{- exit 1- }}-- $policy = $json.Policies | Where-Object {{ $_.'$comment' -eq 'Edge is uninstallable.' }}-- if ($policy) {{- if ($policy.defaultState -ne 'enabled') {{- $policy.defaultState = 'enabled'- }}-- if ($policy.conditions.region.enabled -notcontains $region) {{- $policy.conditions.region.enabled += $region- $policy.conditions.region.enabled = $policy.conditions.region.enabled | Sort-Object -Unique-- $json | ConvertTo-Json -Depth 10 | Set-Content -Path $policyFile -Encoding UTF8- }}- }}- }} else {{- exit 1- }}";-- TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"{Path.Combine(Environment.SystemDirectory, "WindowsPowerShell\\v1.0\\powershell.exe")} -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command \"{script}\"");-+ TakingOwnership.GrantDebugPrivilege();foreach (string process in new string[] { "msedge.exe", "edgeupdate.exe", "edgeupdatem.exe", "msedgewebview2.exe", "MicrosoftEdgeUpdate.exe", "msedgewebviewhost.exe", "msedgeuserbroker.exe", "usocoreworker.exe", "RuntimeBroker.exe" })- CommandExecutor.RunCommand($"/c taskkill /f /im {process} /t");- foreach (var package in new[] { new { AppName = "Edge", Arguments = "--uninstall --msedge --channel=stable --system-level --verbose-logging" }, new { AppName = "EdgeWebView", Arguments = "--uninstall --msedgewebview --system-level --verbose-logging" } })- {- try- {- string setupPath = Path.Combine(Directory.GetDirectories(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft", package.AppName, "Application")).FirstOrDefault(), "Installer", "setup.exe");+ TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"cmd.exe /c taskkill /f /im {process} /t");- if (!removeWebViewFlag && package.AppName == "EdgeWebView")- continue;-- Process.Start(new ProcessStartInfo- {- FileName = setupPath,- Arguments = package.Arguments,- UseShellExecute = true,- WindowStyle = ProcessWindowStyle.Hidden- })?.WaitForExitAsync();-- }- catch (Exception ex) { ErrorLogging.LogDebug(ex); }- }DeletingTask(edgeTasks);TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, @"cmd.exe /с rmdir /s /q %LocalAppData%\Microsoft\Edge");@@ -255,7 +206,7 @@ namespace GTweak.Utilities.TweaksRegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Classes\MSEdgeHTM", true);RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Clients\StartMenuInternet\Microsoft Edge", true);- if (removeWebViewFlag)+ if (shouldRemoveWebView){RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update", true);RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\edgeupdate", true);@@ -271,7 +222,6 @@ namespace GTweak.Utilities.TweaksRegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\MicrosoftEdgeElevationService", true);}-static void RemoveDirectory(string path){TrustedInstaller.CreateProcessAsTrustedInstaller(SettingsRepository.PID, $"cmd.exe /c takeown /f \"{path}\"");@@ -282,7 +232,7 @@ namespace GTweak.Utilities.Tweaksforeach (string folder in new[] { "Edge", "EdgeCore", "EdgeUpdate", "Temp", "EdgeWebView" }){- if (!removeWebViewFlag && (folder == "EdgeWebView" || folder == "EdgeCore" || folder == "EdgeUpdate"))+ if (!shouldRemoveWebView && (folder == "EdgeWebView" || folder == "EdgeCore" || folder == "EdgeUpdate"))continue;string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft", folder);@@ -298,7 +248,7 @@ namespace GTweak.Utilities.Tweaksstring path = subKeyEntry?.GetValue("Path") as string;if (!string.IsNullOrEmpty(path) && path.Equals("Edge")){- if (!removeWebViewFlag && path.Contains("WebView"))+ if (!shouldRemoveWebView && path.Contains("WebView"))continue;if (path.EndsWith(@"\AppxManifest.xml", StringComparison.OrdinalIgnoreCase))diff --git a/.Source/GTweak/View/MoreView.xaml.cs b/.Source/GTweak/View/MoreView.xaml.csindex fbb4b55e..c76de8ca 100644--- a/.Source/GTweak/View/MoreView.xaml.cs+++ b/.Source/GTweak/View/MoreView.xaml.cs@@ -95,7 +95,9 @@ namespace GTweak.ViewOverlayAnimation(1, 0, 0.25, (s, e) => Overlay.Visibility = Visibility.Collapsed);}- new ClearingMemory().StartMemoryCleanup(_isWinOldRemoval);+ BackgroundQueue backgroundQueue = new BackgroundQueue();+ await backgroundQueue.QueueTask(delegate { ClearingMemory.StartMemoryCleanupAsync(_isWinOldRemoval); });+ new ViewNotification(500).Show("", "info", "clear_ram_notification");}private void BtnDisableDefrag_ClickButton(object sender, EventArgs e) => SystemMaintenance.SetDefragState(false);