Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
fix(optimization): remove comment on Apply
itsfatduck4e717fda4c65
diff --git a/optimizerDuck/Properties/launchSettings.json b/optimizerDuck/Properties/launchSettings.jsonindex e37d031..b4e2f19 100644--- a/optimizerDuck/Properties/launchSettings.json+++ b/optimizerDuck/Properties/launchSettings.json@@ -6,6 +6,10 @@"WithRestartArgument": {"commandName": "Project","commandLineArgs": "--restart"+ },+ "RestartAndDebug": {+ "commandName": "Project",+ "commandLineArgs": "--restart --debug"}}}\ No newline at end of filediff --git a/optimizerDuck/src/Core/Defaults.cs b/optimizerDuck/src/Core/Defaults.csindex c4f3a95..f79a741 100644--- a/optimizerDuck/src/Core/Defaults.cs+++ b/optimizerDuck/src/Core/Defaults.cs@@ -7,6 +7,8 @@ namespace optimizerDuck.Core;public static class Defaults{+ public static bool IsDebug = Environment.GetCommandLineArgs().Contains("--debug");+public const string RawLogo = """_ _ _ _____ _| | (_) (_) | __ \ | |diff --git a/optimizerDuck/src/Core/Managers/OptimizationManager.cs b/optimizerDuck/src/Core/Managers/OptimizationManager.csindex 83f4e04..925f019 100644--- a/optimizerDuck/src/Core/Managers/OptimizationManager.cs+++ b/optimizerDuck/src/Core/Managers/OptimizationManager.cs@@ -184,11 +184,6 @@ public class OptimizationManager(SystemSnapshot systemSnapshot)Log.LogDebug(new string('=', 60));- cancellationToken.Register(() =>- {-- });-await AnsiConsole.Status().Spinner(Spinner.Known.Dots2).SpinnerStyle($"bold {Theme.Primary}")@@ -198,7 +193,7 @@ public class OptimizationManager(SystemSnapshot systemSnapshot){try{- if (cancellationToken.IsCancellationRequested) break;+ cancellationToken.ThrowIfCancellationRequested();selectedOptimization = selectedOptimization with{@@ -217,8 +212,8 @@ public class OptimizationManager(SystemSnapshot systemSnapshot)var stopwatch = Stopwatch.StartNew();- //await selectedOptimization.Instance!.Apply(_systemSnapshot).ConfigureAwait(false);- await Task.Delay(5000, cancellationToken);+ await selectedOptimization.Instance!.Apply(_systemSnapshot, cancellationToken).ConfigureAwait(false);+ //await Task.Delay(5000, cancellationToken);stopwatch.Stop();Log.LogDebug("Applied in {Elapsed} ms", stopwatch.ElapsedMilliseconds);diff --git a/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs b/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.csindex 3447fb9..9dd9b66 100644--- a/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs+++ b/optimizerDuck/src/Core/Optimizers/BloatwareAndServices.cs@@ -33,6 +33,7 @@ public class BloatwareAndServices : IOptimizationCategorywhile (OptimizationManager.SelectedBloatware.TryDequeue(out var appxPackage)){+ t.ThrowIfCancellationRequested();appxPackage = appxPackage with { DisplayName = appxPackage.DisplayName.Trim(), Version = appxPackage.Version.Trim() };Log.LogInformation($"Removing bloatware app: [{Theme.Primary}]{appxPackage.DisplayName}[/] [{Theme.Success}]{appxPackage.Version}[/] ([dim]{appxPackage.Name}[/])");diff --git a/optimizerDuck/src/Core/Optimizers/Performance.cs b/optimizerDuck/src/Core/Optimizers/Performance.csindex 4ffc8ef..fd21b57 100644--- a/optimizerDuck/src/Core/Optimizers/Performance.cs+++ b/optimizerDuck/src/Core/Optimizers/Performance.cs@@ -228,6 +228,7 @@ public class Performance : IOptimizationCategoryforeach (var gpu in s.Gpus){+ t.ThrowIfCancellationRequested();Log.LogDebug("GPU Info: {GPUInfo}", gpu);if (string.IsNullOrWhiteSpace(gpu.DeviceId)){diff --git a/optimizerDuck/src/Core/Services/ShellService.cs b/optimizerDuck/src/Core/Services/ShellService.csindex adacc2b..a52a161 100644--- a/optimizerDuck/src/Core/Services/ShellService.cs+++ b/optimizerDuck/src/Core/Services/ShellService.cs@@ -18,7 +18,11 @@ public static class ShellService{private static ShellResult Run(string fileName, string arguments, string command, string serviceName){- var fullCommand =+ var decoded = command.DecodeBase64()+ .Replace("\"", "\\\"")+ .Replace("\r", " ")+ .Replace("\n", " ");+ var fullCommandForUser =$"{fileName} {arguments.Replace("-EncodedCommand", "-Command")} {command.DecodeBase64()}"; // let user see the real commandvar psi = new ProcessStartInfo@@ -74,7 +78,7 @@ public static class ShellService| Stderr: {Stderr}| ExitCode: {ProcessExitCode}| Duration: {TimeSpan}- """, fullCommand, stdoutDisplay, stderrDisplay, process.ExitCode, ServiceTracker.FormatTime(duration));+ """, fullCommandForUser, stdoutDisplay, stderrDisplay, process.ExitCode, ServiceTracker.FormatTime(duration));return new ShellResult($"{fileName} {arguments} {command}",diff --git a/optimizerDuck/src/UI/Logger/Logger.cs b/optimizerDuck/src/UI/Logger/Logger.csindex 2085972..4b92fff 100644--- a/optimizerDuck/src/UI/Logger/Logger.cs+++ b/optimizerDuck/src/UI/Logger/Logger.cs@@ -60,7 +60,7 @@ public class PlainTextFormatter : ITextFormatter// Messagevar message = RenderWithoutQuotes(logEvent);- if (logEvent.Level == LogEventLevel.Debug) // i want to keep markup for debug logs+ if (logEvent.Level == LogEventLevel.Debug && !Defaults.IsDebug) // i want to keep markup for debug logs when not in debug mode to avoid markup exceptionsoutput.Write($" {message}");elseoutput.Write($" {Markup.Remove(message)}");@@ -143,7 +143,7 @@ public static class Logger{builder.AddSpectreConsole(config =>{- config.SetMinimumLevel(Environment.GetCommandLineArgs().Contains("--debug")+ config.SetMinimumLevel(Defaults.IsDebug? LogLevel.Debug: LogLevel.Information);