Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
detailed logging at startup upd title
Greedeks7fa05493c709
diff --git a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs b/.Source/GTweak/Utilities/Controls/ErrorLogging.csindex 2eb4409e..81849848 100644--- a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs+++ b/.Source/GTweak/Utilities/Controls/ErrorLogging.cs@@ -15,7 +15,7 @@ namespace GTweak.Utilities.Controlsinternal static void LogDebug(Exception ex, [CallerMemberName] string memberName = "") => Debug.WriteLine($"Debug: {ex.Message}\nStack Trace: {ex.StackTrace}\nMember: {memberName}\n");- internal static async Task LogToFile(Exception ex, string memberName)+ private static async Task LogToFile(Exception ex, string memberName){try{diff --git a/.Source/GTweak/Utilities/Helpers/TrustedInstaller.cs b/.Source/GTweak/Utilities/Helpers/TrustedInstaller.csindex 543a2589..4e37a169 100644--- a/.Source/GTweak/Utilities/Helpers/TrustedInstaller.cs+++ b/.Source/GTweak/Utilities/Helpers/TrustedInstaller.cs@@ -177,6 +177,7 @@ namespace GTweak.Utilities.HelpersCloseHandle(tokenHandle);return false;}+internal static int StartTrustedInstallerService(){IntPtr hSCManager = OpenSCManager(null, ServicesActiveDatabase, SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_QUERY_LOCK_STATUS);@@ -221,6 +222,7 @@ namespace GTweak.Utilities.HelpersCloseServiceHandle(hSCManager);throw new Win32Exception("QueryServiceStatusEx failed: " + Marshal.GetLastWin32Error());}+internal static void CreateProcessAsTrustedInstaller(int parentProcessId, string binaryPath){diff --git a/.Source/GTweak/Utilities/Tweaks/Firewall.cs b/.Source/GTweak/Utilities/Tweaks/Firewall.csindex 1f4aa8bc..584d64ed 100644--- a/.Source/GTweak/Utilities/Tweaks/Firewall.cs+++ b/.Source/GTweak/Utilities/Tweaks/Firewall.cs@@ -3,7 +3,6 @@ using GTweak.Utilities.Helpers.Managers;using NetFwTypeLib;using System;using System.Collections.Generic;-using System.Diagnostics;using System.IO;using System.Threading.Tasks;@@ -129,7 +128,7 @@ namespace GTweak.Utilities.Tweaksprotected static void BlockWDefender(bool isChoose){try { Parallel.Invoke(() => { ChangeRules(isChoose, _сollectExecutablePaths["WD"], _nameRules["WDefender"], NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT, "blocking Windows Defender database updates"); }); }- catch (Exception ex) { Debug.Write(ex.Message); }+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }}}}diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.csindex ecce3114..4fbf934f 100644--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs@@ -40,7 +40,7 @@ namespace GTweak.WindowsbackgroundWorker.RunWorkerAsync();}- private async void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)+ private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e){for (byte i = 0; i <= 100; i++){@@ -48,18 +48,29 @@ namespace GTweak.WindowsThread.Sleep(17);}++ static void ExecuteWithLogging(Action action, string methodName)+ {+ try { action(); }+ catch (Exception ex) { ErrorLogging.LogWritingFile(ex, methodName); }+ }++Parallel.Invoke(- delegate { SettingsRepository.PID = TrustedInstaller.StartTrustedInstallerService(); },- new SettingsRepository().СheckingParameters,- new WindowsLicense().LicenseStatus,- new SystemDiagnostics().GetHardwareData,- new SystemDiagnostics().ValidateVersionUpdates,- new UninstallingPakages().LoadInstalledPackages,- new UninstallingPakages().CheckingForLocalAccount,- new SystemTweaks().ViewNetshState,- new SystemTweaks().ViewBluetoothStatus);+ () => ExecuteWithLogging(() => SettingsRepository.PID = TrustedInstaller.StartTrustedInstallerService(), nameof(SettingsRepository.PID)),+ () => ExecuteWithLogging(new SettingsRepository().СheckingParameters, nameof(SettingsRepository.СheckingParameters)),+ () => ExecuteWithLogging(new WindowsLicense().LicenseStatus, nameof(WindowsLicense.LicenseStatus)),+ () => ExecuteWithLogging(new SystemDiagnostics().GetHardwareData, nameof(SystemDiagnostics.GetHardwareData)),+ () => ExecuteWithLogging(new SystemDiagnostics().ValidateVersionUpdates, nameof(SystemDiagnostics.ValidateVersionUpdates)),+ () => ExecuteWithLogging(new UninstallingPakages().LoadInstalledPackages, nameof(UninstallingPakages.LoadInstalledPackages)),+ () => ExecuteWithLogging(new UninstallingPakages().CheckingForLocalAccount, nameof(UninstallingPakages.CheckingForLocalAccount)),+ () => ExecuteWithLogging(new SystemTweaks().ViewNetshState, nameof(SystemTweaks.ViewNetshState)),+ () => ExecuteWithLogging(new SystemTweaks().ViewBluetoothStatus, nameof(SystemTweaks.ViewBluetoothStatus))+ );+- await new MonitoringSystem().GetTotalProcessorUsage();+ MonitoringSystem monitoringSystem = new MonitoringSystem();+ ExecuteWithLogging(async () => await monitoringSystem.GetTotalProcessorUsage(), nameof(monitoringSystem.GetTotalProcessorUsage));}private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)diff --git "a/.github/ISSUE_TEMPLATE/\342\234\250-feature-request-.yaml" "b/.github/ISSUE_TEMPLATE/\342\234\250-feature-request-.yaml"index 09645022..107b3681 100644--- "a/.github/ISSUE_TEMPLATE/\342\234\250-feature-request-.yaml"+++ "b/.github/ISSUE_TEMPLATE/\342\234\250-feature-request-.yaml"@@ -1,6 +1,6 @@name: "✨ Feature Request"description: "Suggest an idea for this project"-title: "[Feature Request] <Feature Title>"+title: "[Feature Request] Title"labels:- enhancement- experience usingdiff --git "a/.github/ISSUE_TEMPLATE/\342\235\223-questions-and-answers.yaml" "b/.github/ISSUE_TEMPLATE/\342\235\223-questions-and-answers.yaml"index 62f443bb..1946c4ac 100644--- "a/.github/ISSUE_TEMPLATE/\342\235\223-questions-and-answers.yaml"+++ "b/.github/ISSUE_TEMPLATE/\342\235\223-questions-and-answers.yaml"@@ -1,6 +1,6 @@name: "❓ Questions and Answers"description: "Frequently Asked Questions"-title: "[Question] <Question Title>"+title: "[Question] Title"labels:- documentation- questiondiff --git "a/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-report.yaml" "b/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-report.yaml"index 40a28036..f84baf88 100644--- "a/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-report.yaml"+++ "b/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-report.yaml"@@ -1,6 +1,6 @@name: "🐞 Bug Report"description: "Description of the error or the problem with the utility"-title: "[BUG] <Brief description of the issue>"+title: "[BUG] Title"labels:- bug- help wanted