Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

docs: refactor and enhance documentation across multiple files

fatDuck445cafba8b0c
diff --git a/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs b/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
index effc36a..eeabc3a 100644
--- a/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServiceIntegrationTests.cs
@@ -44,18 +44,15 @@ public class OptimizationServiceIntegrationTests : IDisposable
OptimizationContext context
)
{
- // Step 1: Always succeeds
context.Changes.Add("Step 1", "Step 1", true, new TestRevertStep { StepId = 1 });
_stepCount++;
- // Step 2: May fail
if (_shouldFail)
{
context.Changes.Add("Step 2", "Step 2", false, error: "Simulated failure");
_stepCount++;
}
- // Step 3: Only executes if step 2 succeeded
if (!_shouldFail)
{
context.Changes.Add("Step 3", "Step 3", true, new TestRevertStep { StepId = 3 });
@@ -144,10 +141,7 @@ public class OptimizationServiceIntegrationTests : IDisposable
if (File.Exists(path))
File.Delete(path);
}
- catch
- {
- // Ignore
- }
+ catch { }
}
}
}
diff --git a/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs b/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs
index 29cbceb..fcf2171 100644
--- a/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs
+++ b/optimizerDuck.Test/Services/OptimizationServices/ServiceProcessServiceTests.cs
@@ -39,10 +39,6 @@ public class ServiceProcessServiceTests
Assert.Contains("after the start type was written", detail);
}
- // =============================================
- // Integration tests: GetStartupTypeAsync (real sc.exe)
- // =============================================
-
[Fact]
public async Task GetStartupTypeAsync_ExistingAutoService_ReturnsAutomatic()
{
@@ -73,14 +69,12 @@ public class ServiceProcessServiceTests
Assert.True(notFound);
}
- // =============================================
// Contract fixture: the expected value comes from
// HKLM\SYSTEM\CurrentControlSet\Services, where Windows stores Start (2 auto, 3 manual,
// 4 disabled) and the DelayedAutoStart flag. Driver entries are included: the Service
// Control Manager reports their start type without the TYPE/START_TYPE ambiguity of
// sc.exe output. Boot (0) and system (1) starts fall outside the app's
// ServiceStartupType domain, and the registry is not authoritative for them.
- // =============================================
private const int PerTypeSampleLimit = 8;
@@ -164,10 +158,7 @@ public class ServiceProcessServiceTests
);
}
- // =============================================
- // Integration tests: ChangeServiceStartupTypeAsync (real service, SCM writes).
// sc.exe stays in this file only to create/inspect the scratch test service.
- // =============================================
private const string TestServiceName = "odTestSvc";
diff --git a/optimizerDuck.Test/Services/RegistryWatcherTests.cs b/optimizerDuck.Test/Services/RegistryWatcherTests.cs
index da12290..3664d60 100644
--- a/optimizerDuck.Test/Services/RegistryWatcherTests.cs
+++ b/optimizerDuck.Test/Services/RegistryWatcherTests.cs
@@ -87,12 +87,10 @@ public class RegistryWatcherTests : IDisposable
// Give the watcher thread time to start and block on RegNotifyChangeKeyValue
await Task.Delay(500, TestContext.Current.CancellationToken);
- // Write a value to trigger the notification
using var key = Registry.CurrentUser.OpenSubKey(TestRootNative, writable: true);
Assert.NotNull(key);
key.SetValue("TestValue", 42);
- // Wait for the event with a timeout
var completed = await Task.WhenAny(
tcs.Task,
Task.Delay(5000, TestContext.Current.CancellationToken)
@@ -120,7 +118,6 @@ public class RegistryWatcherTests : IDisposable
// Give cancellation time to interrupt any in-flight delay/operation
await Task.Delay(500, TestContext.Current.CancellationToken);
- // Create the key and write; the watcher should be stopped by now
using var key = Registry.CurrentUser.CreateSubKey(TestRootNative);
Assert.NotNull(key);
key.SetValue("TestValue", 99);
@@ -165,14 +162,12 @@ public class RegistryWatcherTests : IDisposable
// Give watcher threads time to block on RegNotifyChangeKeyValue, CI can be slower
await Task.Delay(1000, TestContext.Current.CancellationToken);
- // Write to path A
using (var keyA = Registry.CurrentUser.OpenSubKey(pathANative, writable: true))
{
Assert.NotNull(keyA);
keyA.SetValue("Val", 1);
}
- // Write to path B
using (var keyB = Registry.CurrentUser.OpenSubKey(pathBNative, writable: true))
{
Assert.NotNull(keyB);
@@ -200,7 +195,6 @@ public class RegistryWatcherTests : IDisposable
watcher.Watch(TestRoot);
watcher.Watch(TestRoot + @"\SubKey");
- // Should not throw
var exception = Record.Exception(() => watcher.Dispose());
Assert.Null(exception);
}
diff --git a/optimizerDuck.Test/Services/UI/DiskCleanupServiceTests.cs b/optimizerDuck.Test/Services/UI/DiskCleanupServiceTests.cs
index 406c94f..5b2e20b 100644
--- a/optimizerDuck.Test/Services/UI/DiskCleanupServiceTests.cs
+++ b/optimizerDuck.Test/Services/UI/DiskCleanupServiceTests.cs
@@ -61,10 +61,7 @@ public class DiskCleanupServiceTests
{
Directory.Delete(tempRoot, true);
}
- catch
- {
- // Ignore cleanup error
- }
+ catch { }
}
}
}
@@ -110,10 +107,7 @@ public class DiskCleanupServiceTests
{
Directory.Delete(tempRoot, true);
}
- catch
- {
- // Ignore cleanup error
- }
+ catch { }
}
}
}
diff --git a/optimizerDuck/ApplicationServiceCollectionExtensions.cs b/optimizerDuck/ApplicationServiceCollectionExtensions.cs
index 1d32e97..44a72d4 100644
--- a/optimizerDuck/ApplicationServiceCollectionExtensions.cs
+++ b/optimizerDuck/ApplicationServiceCollectionExtensions.cs
@@ -50,17 +50,14 @@ public static class ApplicationServiceCollectionExtensions
// otherwise supplies IConfiguration implicitly.
services.AddSingleton<IConfiguration>(configuration);
- // WPF UI shell
services.AddNavigationViewPageProvider();
services.AddSingleton<INavigationService, NavigationService>();
services.AddSingleton<IContentDialogService, ContentDialogService>();
services.AddSingleton<ISnackbarService, SnackbarService>();
- // Windows
services.AddSingleton<MainWindow>();
services.AddSingleton<MainWindowViewModel>();
- // Pages
services.AddSingleton<DashboardViewModel>();
services.AddSingleton<DashboardPage>();
services.AddSingleton<OptimizeViewModel>();
@@ -76,23 +73,18 @@ public static class ApplicationServiceCollectionExtensions
services.AddSingleton<ScheduledTasksViewModel>();
services.AddSingleton<ScheduledTasksPage>();
- // Dialogs
services.AddTransient<LegalDialogViewModel>();
services.AddTransient<optimizerDuck.UI.Dialogs.LegalDialog>();
- // Customize
services.AddSingleton<CustomizeViewModel>();
services.AddSingleton<CustomizePage>();
services.AddAllCustomizeCategoryPages();
- // Optimizations
services.AddAllOptimizationPages();
- // Managers
services.AddSingleton<ConfigManager>();
services.AddSingleton(TimeProvider.System);
- // Services
services.AddSingleton<ProcessRunner>();
services.AddSingleton<PowerPlanService>();
services.AddSingleton<SystemRestoreService>();
diff --git a/optimizerDuck/Common/Extensions/LanguageExtensions.cs b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
index 965130e..3dcd147 100644
--- a/optimizerDuck/Common/Extensions/LanguageExtensions.cs
+++ b/optimizerDuck/Common/Extensions/LanguageExtensions.cs
@@ -90,7 +90,6 @@ public class LocExtension : MarkupExtension
ConverterParameter = Key,
};
- // [0] Loc.Instance (required OneWay)
mb.Bindings.Add(new Binding { Source = Loc.Instance, Mode = BindingMode.OneWay });
foreach (var arg in Args)
@@ -123,7 +122,6 @@ public class LocDynamicConverter : IMultiValueConverter
if (values.Length == 1)
return format;
- // skip Loc.Instance, get args
var args = values.Skip(1).ToArray();
return string.Format(culture, format, args);
}
diff --git a/optimizerDuck/Common/Helpers/EmbeddedResourceHelper.cs b/optimizerDuck/Common/Helpers/EmbeddedResourceHelper.cs
index c74e368..fc92522 100644
--- a/optimizerDuck/Common/Helpers/EmbeddedResourceHelper.cs
+++ b/optimizerDuck/Common/Helpers/EmbeddedResourceHelper.cs
@@ -17,7 +17,7 @@ public static class EmbeddedResourceHelper
/// Relative path inside the Embedded namespace, for example "Icons/blank.ico".
/// </param>
/// <param name="outputPath">Full path where the resource will be extracted.</param>
- /// <param name="overwrite">Whether to overwrite the file if it already exists.</param>
+ /// <param name="overwrite"><see langword="true" /> to overwrite the file if it already exists; otherwise, <see langword="false" />.</param>
/// <returns>
/// <see langword="true" /> if extraction succeeded; otherwise <see langword="false" />.
/// </returns>
@@ -30,7 +30,6 @@ public static class EmbeddedResourceHelper
try
{
- // Normalize the relative path to use dots as separators for resource names
var normalizedPath = relativePath.Replace('/', '.').Replace('\\', '.');
var fullResourceName = $"{ResourceNamespace}.{normalizedPath}";
diff --git a/optimizerDuck/Common/Helpers/ReflectionHelper.cs b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
index 24a0e37..74defb5 100644
--- a/optimizerDuck/Common/Helpers/ReflectionHelper.cs
+++ b/optimizerDuck/Common/Helpers/ReflectionHelper.cs
@@ -2,6 +2,9 @@ using System.Reflection;
namespace optimizerDuck.Common.Helpers;
+/// <summary>
+/// Provides cached reflection discovery of implementations within application assemblies.
+/// </summary>
public static class ReflectionHelper
{
private static IEnumerable<Type> SafeGetTypes(Assembly asm)
@@ -12,7 +15,6 @@ public static class ReflectionHelper
}
catch (ReflectionTypeLoadException ex)
{
- // return only the types that were loaded successfully
return ex.Types.Where(t => t != null)!;
}
catch
@@ -24,6 +26,11 @@ public static class ReflectionHelper
private static readonly Dictionary<Type, List<Type>> _implementationCache = new();
private static readonly Lock _cacheLock = new();
+ /// <summary>
+ /// Finds all concrete class implementations of the specified interface type in loaded assemblies.
+ /// </summary>
+ /// <param name="interfaceType">The interface or base type to find implementations of.</param>
+ /// <returns>A collection of matching non-abstract class <see cref="Type" /> instances.</returns>
public static IEnumerable<Type> FindImplementationsInLoadedAssemblies(Type interfaceType)
{
lock (_cacheLock)
@@ -53,6 +60,11 @@ public static class ReflectionHelper
}
}
+ /// <summary>
+ /// Finds all concrete class implementations of <typeparamref name="TInterface" /> in loaded assemblies.
+ /// </summary>
+ /// <typeparam name="TInterface">The interface type to find implementations of.</typeparam>
+ /// <returns>A collection of matching non-abstract class <see cref="Type" /> instances.</returns>
public static IEnumerable<Type> FindImplementationsInLoadedAssemblies<TInterface>()
{
return FindImplementationsInLoadedAssemblies(typeof(TInterface));
diff --git a/optimizerDuck/Domain/Abstractions/ICustomizeCategory.cs b/optimizerDuck/Domain/Abstractions/ICustomizeCategory.cs
index 3b32ea1..acabd35 100644
--- a/optimizerDuck/Domain/Abstractions/ICustomizeCategory.cs
+++ b/optimizerDuck/Domain/Abstractions/ICustomizeCategory.cs
@@ -5,11 +5,23 @@ using Wpf.Ui.Controls;
namespace optimizerDuck.Domain.Abstractions;
+/// <summary>
+/// Defines a category that groups related customization settings together.
+/// </summary>
public interface ICustomizeCategory
{
+ /// <summary>Gets the localized display name of the category.</summary>
public string Name { get; }
+
+ /// <summary>Gets the localized description of what this category configures.</summary>
public string Description { get; }
+
+ /// <summary>Gets the icon symbol displayed for this category in the UI.</summary>
public SymbolRegular Icon { get; init; }
+
+ /// <summary>Gets the display order index used to sort categories.</summary>
public CustomizeOrder Order { get; init; }
+
+ /// <summary>Gets the collection of customization settings contained in this category.</summary>
public ObservableCollection<ICustomizeSetting> Features { get; init; }
}
diff --git a/optimizerDuck/Domain/Abstractions/ICustomizeSetting.cs b/optimizerDuck/Domain/Abstractions/ICustomizeSetting.cs
index e312c9d..eb18833 100644
--- a/optimizerDuck/Domain/Abstractions/ICustomizeSetting.cs
+++ b/optimizerDuck/Domain/Abstractions/ICustomizeSetting.cs
@@ -18,7 +18,7 @@ public interface ICustomizeSetting
string Section { get; }
/// <summary>Gets the icon symbol displayed next to the setting in the UI.</summary>
- public SymbolRegular Icon { get; }
+ SymbolRegular Icon { get; }
/// <summary>Gets the unique key used for localization lookup.</summary>
string FeatureKey { get; }
@@ -43,30 +43,37 @@ public interface ICustomizeSetting
/// </summary>
IReadOnlyList<SettingOption>? Options { get; }
- /// <summary>Read the current system state. For toggles: true = on, false = off.</summary>
+ /// <summary>Reads the current system state.</summary>
+ /// <returns><see langword="true" /> if the setting is active; otherwise, <see langword="false" />.</returns>
Task<bool> GetStateAsync();
/// <summary>
- /// Reads state until two consecutive reads agree or retries run out. Use after
- /// <see cref="ApplyAsync" /> to let the registry settle.
+ /// Reads state until two consecutive reads agree or retries run out.
/// </summary>
+ /// <remarks>
+ /// Used after <see cref="ApplyAsync" /> to let the registry settle.
+ /// </remarks>
+ /// <param name="maxRetries">The maximum number of read attempts.</param>
+ /// <param name="delayMs">The delay in milliseconds between read attempts.</param>
+ /// <returns><see langword="true" /> if the setting is active; otherwise, <see langword="false" />.</returns>
Task<bool> GetStateWithRetryAsync(int maxRetries = 3, int delayMs = 80);
/// <summary>
- /// Applies the value, recording every write into <paramref name="call" />
- /// for change tracking and revert. The first failure wins the return,
- /// but all writes are still attempted.
+ /// Applies the setting value, recording writes for change tracking and revert.
/// </summary>
+ /// <param name="value">The setting value to apply.</param>
+ /// <param name="call">The per-operation context used to record changes.</param>
+ /// <returns>The result of the apply operation.</returns>
Task<Execution.OpResult> ApplyAsync(object? value, Execution.OpCall call);
/// <summary>
- /// Registry key paths that should be watched for external changes,
- /// so the UI can auto-refresh when someone else modifies a setting.
+ /// Gets the registry key paths to monitor for external changes.
/// </summary>
IReadOnlyList<string> WatchedRegistryPaths { get; }
/// <summary>
- /// Returns the setting's recommendation, or <see langword="null" /> when none exists.
+ /// Gets the recommendation for this setting, or <see langword="null" /> if none exists.
/// </summary>
+ /// <returns>A <see cref="CustomizeRecommendationResult" />, or <see langword="null" />.</returns>
CustomizeRecommendationResult? GetRecommendation();
}
diff --git a/optimizerDuck/Domain/Abstractions/IOptimization.cs b/optimizerDuck/Domain/Abstractions/IOptimization.cs
index 9b15935..dbd7234 100644
--- a/optimizerDuck/Domain/Abstractions/IOptimization.cs
+++ b/optimizerDuck/Domain/Abstractions/IOptimization.cs
@@ -10,37 +10,35 @@ namespace optimizerDuck.Domain.Abstractions;
/// </summary>
public interface IOptimization
{
+ /// <summary>Gets the unique identifier for this optimization.</summary>
Guid Id { get; }
+ /// <summary>Gets the risk level associated with applying this optimization.</summary>
OptimizationRisk Risk { get; }
- /// <summary>
- /// The resource key used for localization lookup.
- /// </summary>
+ /// <summary>Gets the resource key used for localization lookup.</summary>
string OptimizationKey { get; }
- /// <summary>
- /// The localized display name of the optimization.
- /// </summary>
+ /// <summary>Gets the localized display name of the optimization.</summary>
string Name { get; }
- /// <summary>
- /// A localized short description of what this optimization does.
- /// </summary>
+ /// <summary>Gets a localized short description of what this optimization does.</summary>
string ShortDescription { get; }
+ /// <summary>Gets or sets the execution and applied state of the optimization.</summary>
OptimizationState State { get; set; }
- /// <summary>
- /// The <see cref="ICondition" /> implementation that must hold on the current system,
- /// or <see langword="null" /> when the optimization is always available.
- /// </summary>
+ /// <summary>Gets the condition type implementing <see cref="ICondition" /> that must hold on the system, or <see langword="null" /> if always available.</summary>
Type? ConditionType { get; }
+ /// <summary>Gets or sets the cached result of evaluating <see cref="ConditionType" />.</summary>
ConditionResult ConditionResult { get; set; }
+ /// <summary>
+ /// Applies the optimization to the system.
+ /// </summary>
/// <param name="progress">A progress reporter for UI updates.</param>
- /// <param name="context">The context providing logger, system snapshot, and services.</param>
+ /// <param name="context">The execution context providing logger, system snapshot, and services.</param>
/// <returns>The result of the apply operation.</returns>
Task<ApplyResult> ApplyAsync(
IProgress<ProcessingProgress> progress,
diff --git a/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs b/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
index 65d2466..1dade50 100644
--- a/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
+++ b/optimizerDuck/Domain/Abstractions/IOptimizationCategory.cs
@@ -8,12 +8,12 @@ namespace optimizerDuck.Domain.Abstractions;
/// </summary>
public interface IOptimizationCategory
{
- /// <summary>
- /// The localized display name of the category.
- /// </summary>
+ /// <summary>Gets the localized display name of the category.</summary>
public string Name { get; }
+ /// <summary>Gets the display order index used to sort categories.</summary>
public OptimizationCategoryOrder Order { get; init; }
+ /// <summary>Gets the collection of optimizations contained in this category.</summary>
public ObservableCollection<IOptimization> Optimizations { get; init; }
}
diff --git a/optimizerDuck/Domain/Abstractions/IRevertStep.cs b/optimizerDuck/Domain/Abstractions/IRevertStep.cs
index 72056b3..75c8a58 100644
--- a/optimizerDuck/Domain/Abstractions/IRevertStep.cs
+++ b/optimizerDuck/Domain/Abstractions/IRevertStep.cs
@@ -10,20 +10,16 @@ namespace optimizerDuck.Domain.Abstractions;
/// </summary>
public interface IRevertStep
{
- /// <summary>
- /// The type identifier for this revert step (e.g., "Registry", "Service", "Shell").
- /// </summary>
- public string Type { get; }
+ /// <summary>Gets the type identifier for this revert step.</summary>
+ string Type { get; }
- /// <summary>
- /// A localized description of what this revert step does.
- /// </summary>
- public string Description { get; }
+ /// <summary>Gets the localized description of what this revert step does.</summary>
+ string Description { get; }
/// <summary>
/// Executes this revert step with its full execution context.
/// </summary>
- /// <param name="context">Shell, power service, and logger for this revert.</param>
+ /// <param name="context">The execution context carrying shell, power plan, and logging services.</param>
/// <param name="logger">The logger to record provider and shell operations.</param>
/// <returns>
/// <see langword="true" /> if the revert succeeded; otherwise <see langword="false" />.
diff --git a/optimizerDuck/Domain/Abstractions/IWindow.cs b/optimizerDuck/Domain/Abstractions/IWindow.cs
index 9b6e6af..06a3ef0 100644
--- a/optimizerDuck/Domain/Abstractions/IWindow.cs
+++ b/optimizerDuck/Domain/Abstractions/IWindow.cs
@@ -12,5 +12,6 @@ public interface IWindow
/// </summary>
event RoutedEventHandler Loaded;
+ /// <summary>Opens the window and returns without waiting for the window to close.</summary>
void Show();
}
diff --git a/optimizerDuck/Domain/Abstractions/RevertContext.cs b/optimizerDuck/Domain/Abstractions/RevertContext.cs
index b02724d..8d2bcf0 100644
--- a/optimizerDuck/Domain/Abstractions/RevertContext.cs
+++ b/optimizerDuck/Domain/Abstractions/RevertContext.cs
@@ -9,9 +9,12 @@ namespace optimizerDuck.Domain.Abstractions;
/// </summary>
public sealed class RevertContext
{
+ /// <summary>Gets the shell execution service used to run shell-based compensation commands.</summary>
public required ShellService Shell { get; init; }
+ /// <summary>Gets the power plan service used to inspect and restore power schemes.</summary>
public required PowerPlanService PowerPlans { get; init; }
+ /// <summary>Gets the logger for recording provider diagnostic details during revert execution.</summary>
public required ILogger Logger { get; init; }
}
diff --git a/optimizerDuck/Domain/Conditions/ConditionBase.cs b/optimizerDuck/Domain/Conditions/ConditionBase.cs
index 64c75bd..b5facac 100644
--- a/optimizerDuck/Domain/Conditions/ConditionBase.cs
+++ b/optimizerDuck/Domain/Conditions/ConditionBase.cs
@@ -10,7 +10,12 @@ public abstract class ConditionBase : ICondition
/// <inheritdoc />
public abstract ConditionResult Evaluate(SystemInfo snapshot);
- /// <summary>Reads the major OS build number (e.g. 22631) from the snapshot.</summary>
+ /// <summary>
+ /// Reads the major OS build number from the system snapshot.
+ /// </summary>
+ /// <param name="snapshot">The system snapshot to read the build number from.</param>
+ /// <param name="build">When this method returns, contains the OS build number if present; otherwise, 0.</param>
+ /// <returns><see langword="true" /> if the build number was present; otherwise, <see langword="false" />.</returns>
protected static bool TryGetOsBuild(SystemInfo snapshot, out int build)
{
build = snapshot.Windows.BuildNumber ?? 0;
diff --git a/optimizerDuck/Domain/Conditions/ConditionResult.cs b/optimizerDuck/Domain/Conditions/ConditionResult.cs
index 3e4f33f..17adf3a 100644
--- a/optimizerDuck/Domain/Conditions/ConditionResult.cs
+++ b/optimizerDuck/Domain/Conditions/ConditionResult.cs
@@ -13,10 +13,7 @@ namespace optimizerDuck.Domain.Conditions;
/// </remarks>
public sealed class ConditionResult
{
- /// <summary>
- /// Creates a condition result with the given state and optional localized
- /// title/description providers.
- /// </summary>
+ /// <summary>Initializes a new instance of the <see cref="ConditionResult" /> class.</summary>
/// <param name="state">The outcome state of the check.</param>
/// <param name="titleProvider">
/// Provider for the condition title, or <see langword="null" />.
@@ -62,10 +59,7 @@ public sealed class ConditionResult
/// <summary>Gets the condition explanation provider, or <see langword="null" />.</summary>
public Func<string>? DescriptionProvider { get; }
- /// <summary>
- /// Gets whether this result should block the item by default. Only
- /// <see cref="ConditionState.Unsupported" /> blocks.
- /// </summary>
+ /// <summary>Gets a value that indicates whether this result blocks the item by default. Only <see cref="ConditionState.Unsupported" /> blocks.</summary>
public bool IsBlocking => State is ConditionState.Unsupported;
/// <summary>Gets the localized title for this result, or <see langword="null" />.</summary>
diff --git a/optimizerDuck/Domain/Conditions/ConditionValidation.cs b/optimizerDuck/Domain/Conditions/ConditionValidation.cs
index 1d02925..28701cf 100644
--- a/optimizerDuck/Domain/Conditions/ConditionValidation.cs
+++ b/optimizerDuck/Domain/Conditions/ConditionValidation.cs
@@ -15,8 +15,7 @@ public static class ConditionValidation
/// </param>
/// <param name="ownerName">The owning item's display name, used in the error message.</param>
/// <exception cref="InvalidOperationException">
- /// Thrown when the type does not implement <see cref="ICondition" /> or has no
- /// parameterless constructor.
+ /// The type does not implement <see cref="ICondition" />, is abstract, or has no public parameterless constructor.
/// </exception>
public static void Validate(Type? conditionType, string ownerName)
{
diff --git a/optimizerDuck/Domain/Conditions/ICondition.cs b/optimizerDuck/Domain/Conditions/ICondition.cs
index 84c6e93..d9c2b8a 100644
--- a/optimizerDuck/Domain/Conditions/ICondition.cs
+++ b/optimizerDuck/Domain/Conditions/ICondition.cs
@@ -9,5 +9,10 @@ namespace optimizerDuck.Domain.Conditions;
/// </summary>
public interface ICondition
{
+ /// <summary>
+ /// Evaluates whether the condition is met on the current system.
+ /// </summary>
+ /// <param name="snapshot">The system hardware and OS snapshot to evaluate against.</param>
+ /// <returns>A <see cref="ConditionResult" /> representing the outcome of the evaluation.</returns>
ConditionResult Evaluate(SystemInfo snapshot);
}
diff --git a/optimizerDuck/Domain/Customize/Categories/Desktop.cs b/optimizerDuck/Domain/Customize/Categories/Desktop.cs
index 83ea34a..028e708 100644
--- a/optimizerDuck/Domain/Customize/Categories/Desktop.cs
+++ b/optimizerDuck/Domain/Customize/Categories/Desktop.cs
@@ -187,8 +187,6 @@ public class Desktop : LocalizedObject, ICustomizeCategory
{
var value = RegistryService.Read<string>(new RegistryItem(Path, "29"));
- // value doesn't exist = default Windows behavior
- // shortcut arrow is visible
if (string.IsNullOrWhiteSpace(value))
return Task.FromResult(true);
@@ -204,13 +202,10 @@ public class Desktop : LocalizedObject, ICustomizeCategory
OpResult result;
if (isOn)
{
- // restore default Windows behavior by deleting the value
result = RegistryService.DeleteValue(call, new RegistryItem(Path, "29"));
}
else
{
- // extract the blank icon to the app resources folder, then point the
- // registry value at it
var outputPath = System.IO.Path.Combine(
Shared.AssetsDirectory,
nameof(Desktop),
@@ -218,8 +213,6 @@ public class Desktop : LocalizedObject, ICustomizeCategory
);
EmbeddedResourceHelper.TryExtract("Icons.blank.ico", outputPath);
- // point the registry value at the blank icon, which hides the
- // shortcut arrow overlay
result = RegistryService.Write(call, new RegistryItem(Path, "29", outputPath));
}
diff --git a/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs b/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
index 005641c..e9b3ba9 100644
--- a/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
+++ b/optimizerDuck/Domain/Customize/Models/BaseCustomizeSetting.cs
@@ -30,16 +30,25 @@ public abstract partial class BaseCustomizeSetting : LocalizedObject, ICustomize
$"{GetType().Name} is missing [CustomizeSetting] attribute"
);
+ /// <summary>Gets the type of the category class that owns this setting.</summary>
public Type? OwnerType { get; internal set; }
+ /// <summary>Gets the owner category key.</summary>
+ /// <exception cref="InvalidOperationException"><see cref="OwnerType" /> has not been assigned.</exception>
public string OwnerKey =>
OwnerType?.Name
?? throw new InvalidOperationException($"{GetType().Name} has no owner assigned");
+ /// <inheritdoc />
public string FeatureKey => GetType().Name;
+
+ /// <inheritdoc />
public SymbolRegular Icon => Meta.Icon;
+ /// <inheritdoc />
public string Name => Loc.Instance[$"Customize.{OwnerKey}.{FeatureKey}.Name"];
+
+ /// <inheritdoc />
public string Description => Loc.Instance[$"Customize.{OwnerKey}.{FeatureKey}.Description"];
/// <summary>English name for log (always English, not translated).</summary>
@@ -55,6 +64,7 @@ public abstract partial class BaseCustomizeSetting : LocalizedObject, ICustomize
/// </summary>
public Type? ConditionType => Meta.Condition;
+ /// <inheritdoc />
public string Section
{
get
@@ -66,6 +76,7 @@ public abstract partial class BaseCustomizeSetting : LocalizedObject, ICustomize
}
}
+ /// <inheritdoc />
public virtual CustomizeControlType ControlType => CustomizeControlType.Toggle;
/// <summary>
@@ -504,10 +515,7 @@ public abstract partial class BaseCustomizeSetting : LocalizedObject, ICustomize
var db = Convert.ToDecimal(b);
return da == db;
}
- catch
- {
- // fall through to string comparison
- }
+ catch { }
}
var strA = a.ToString();
diff --git a/optimizerDuck/Domain/Customize/Models/CustomizeRecommendationResult.cs b/optimizerDuck/Domain/Customize/Models/CustomizeRecommendationResult.cs
index af519e2..42acc7a 100644
--- a/optimizerDuck/Domain/Customize/Models/CustomizeRecommendationResult.cs
+++ b/optimizerDuck/Domain/Customize/Models/CustomizeRecommendationResult.cs
@@ -1,5 +1,10 @@
namespace optimizerDuck.Domain.Customize.Models;
+/// <summary>
+/// Represents the recommendation state and explanation for a customization setting.
+/// </summary>
+/// <param name="State">The recommendation state for this setting.</param>
+/// <param name="ReasonTranslationKey">The localization key describing the rationale for the recommendation.</param>
public sealed record CustomizeRecommendationResult(
RecommendationState State,
string ReasonTranslationKey
diff --git a/optimizerDuck/Domain/Customize/Models/CustomizeRefreshScope.cs b/optimizerDuck/Domain/Customize/Models/CustomizeRefreshScope.cs
index 2f7983b..7ad37d0 100644
--- a/optimizerDuck/Domain/Customize/Models/CustomizeRefreshScope.cs
+++ b/optimizerDuck/Domain/Customize/Models/CustomizeRefreshScope.cs
@@ -1,5 +1,6 @@
namespace optimizerDuck.Domain.Customize.Models;
+/// <summary>Specifies the shell notification and refresh mechanisms invoked after applying a customization setting.</summary>
[Flags]
public enum CustomizeRefreshScope
{
diff --git a/optimizerDuck/Domain/Customize/Models/RegistryToggle.cs b/optimizerDuck/Domain/Customize/Models/RegistryToggle.cs
index 44f0c4a..e184961 100644
--- a/optimizerDuck/Domain/Customize/Models/RegistryToggle.cs
+++ b/optimizerDuck/Domain/Customize/Models/RegistryToggle.cs
@@ -84,7 +84,6 @@ public class RegistryToggle
{
var targetValues = isOn ? OnValues : OffValues;
- // First value in the list is the primary value to write
if (targetValues is { Count: > 0 } && targetValues[0] is { } firstValue)
return RegistryService.Write(call, new RegistryItem(Path, Name, firstValue, ValueKind));
@@ -132,7 +131,6 @@ public class RegistryToggle
var typeA = a.GetType();
var typeB = b.GetType();
- // If both are integers, compare as long
if (
(
typeA == typeof(int)
@@ -167,10 +165,7 @@ public class RegistryToggle
var db = Convert.ToDecimal(b);
return da == db;
}
- catch
- {
- // If conversion fails, fall back to string comparison
- }
+ catch { }
}
var strA = a.ToString();
diff --git a/optimizerDuck/Domain/Customize/Models/SettingOption.cs b/optimizerDuck/Domain/Customize/Models/SettingOption.cs
index b43f8b0..309b7cb 100644
--- a/optimizerDuck/Domain/Customize/Models/SettingOption.cs
+++ b/optimizerDuck/Domain/Customize/Models/SettingOption.cs
@@ -1,5 +1,11 @@
namespace optimizerDuck.Domain.Customize.Models;
+/// <summary>
+/// Represents a selectable option for a dropdown customization setting.
+/// </summary>
+/// <param name="DisplayName">The localized label displayed in the UI.</param>
+/// <param name="Value">The value identifier for this option.</param>
+/// <param name="Bindings">The registry bindings written when this option is selected.</param>
public sealed record SettingOption(
string DisplayName,
object Value,
@@ -7,8 +13,7 @@ public sealed record SettingOption(
)
{
/// <summary>
- /// The first binding in the list, or <see langword="null" />. Used by the base class for
- /// single-key auto-read/write.
+ /// Gets the primary registry binding used for single-key auto-read and write operations, or <see langword="null" />.
/// </summary>
public RegistryBinding? PrimaryBinding => Bindings is { Count: > 0 } ? Bindings[0] : null;
}
diff --git a/optimizerDuck/Domain/Execution/OperationSubject.cs b/optimizerDuck/Domain/Execution/OperationSubject.cs
index 1a52f86..7c4b2d4 100644
--- a/optimizerDuck/Domain/Execution/OperationSubject.cs
+++ b/optimizerDuck/Domain/Execution/OperationSubject.cs
@@ -6,7 +6,7 @@ namespace optimizerDuck.Domain.Execution;
/// <param name="LogName">The English name written to the log.</param>
public sealed record OperationSubject(Guid Id, string Key, string LogName);
-/// <summary>Whether a run persists the compensation of the steps it records.</summary>
+/// <summary>Specifies whether a run persists the compensation of the steps it records.</summary>
public enum RevertPersistence
{
/// <summary>The compensation of every step carrying one is written as revert data.</summary>
diff --git a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
index 0d3371e..453aff2 100644
--- a/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
+++ b/optimizerDuck/Domain/Optimizations/Categories/Performance.cs
@@ -161,7 +161,6 @@ public class Performance : LocalizedObject, IOptimizationCategory
const string systemProfileKey =
@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile";
- // Parent SystemProfile settings
RegistryService.Write(
context,
new RegistryItem(systemProfileKey, "NoLazyMode", 1),
@@ -180,7 +179,6 @@ public class Performance : LocalizedObject, IOptimizationCategory
) // minimum possible value (Values below 10 and above 100 are clamped to 20.)
);
- // Games task scheduling
RegistryService.Write(
context,
new RegistryItem($@"{systemProfileKey}\Tasks\Games", "Priority", 2),
diff --git a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
index ad2a1ce..81b88d1 100644
--- a/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/BaseOptimization.cs
@@ -44,9 +44,8 @@ public abstract partial class BaseOptimization : LocalizedObject, IOptimization
/// </summary>
public Type? OwnerType { get; internal set; }
- /// <exception cref="InvalidOperationException">
- /// Thrown when <see cref="OwnerType" /> has not been assigned.
- /// </exception>
+ /// <summary>Gets the owner category key.</summary>
+ /// <exception cref="InvalidOperationException"><see cref="OwnerType" /> has not been assigned.</exception>
public string OwnerKey =>
OwnerType?.Name
?? throw new InvalidOperationException($"{GetType().Name} has no owner assigned");
@@ -60,6 +59,7 @@ public abstract partial class BaseOptimization : LocalizedObject, IOptimization
/// </summary>
public Guid Id => Guid.Parse(Meta.Id);
+ /// <summary>Gets the risk level associated with this optimization.</summary>
public OptimizationRisk Risk => Meta.Risk;
/// <summary>Gets the unique key used for localization and identification.</summary>
@@ -182,9 +182,7 @@ public abstract partial class BaseOptimization : LocalizedObject, IOptimization
private bool _isConditionHidden;
/// <summary>
- /// Gets whether this optimization should be presented in the unsupported state.
- /// The block only applies on first open when the item is <em>not</em> applied;
- /// once applied (or hidden by the user) the normal card is shown.
+ /// Gets a value that indicates whether this optimization should be presented in the unsupported state.
/// </summary>
public bool IsConditionBlocked =>
ConditionResult.IsBlocking && !State.IsApplied && !IsConditionHidden;
diff --git a/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs b/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
index 1050c71..b844bc6 100644
--- a/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/OptimizationContext.cs
@@ -13,6 +13,7 @@ namespace optimizerDuck.Domain.Optimizations.Models;
/// </summary>
public class OptimizationContext : OpCall
{
+ /// <summary>Gets the system snapshot containing hardware, OS, and driver details.</summary>
public required SystemInfo Snapshot { get; init; }
/// <summary>
diff --git a/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs b/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
index e7efc5c..77d60a7 100644
--- a/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
+++ b/optimizerDuck/Domain/Optimizations/Models/OptimizationResult.cs
@@ -1,16 +1,22 @@
-using optimizerDuck.Domain.Execution;
+using optimizerDuck.Domain.Execution;
using optimizerDuck.Domain.UI;
namespace optimizerDuck.Domain.Optimizations.Models;
+/// <summary>
+/// Represents the outcome of executing an optimization.
+/// </summary>
public record OptimizationResult
{
- /// <summary>Overall outcome: Success, PartialSuccess, or Failed.</summary>
+ /// <summary>Gets the overall outcome status of the optimization.</summary>
public OptimizationSuccessResult Status { get; init; }
+ /// <summary>Gets the user-facing message describing the result.</summary>
public string Message { get; init; } = string.Empty;
+ /// <summary>Gets the exception that caused the optimization to fail, if any.</summary>
public Exception? Exception { get; init; }
+ /// <summary>Gets the list of individual steps that failed during execution.</summary>
public List<Change> FailedSteps { get; init; } = [];
}
diff --git a/optimizerDuck/Services/Customize/CustomizationExecutor.cs b/optimizerDuck/Services/Customize/CustomizationExecutor.cs
index 20cdcae..ea75bb3 100644
--- a/optimizerDuck/Services/Customize/CustomizationExecutor.cs
+++ b/optimizerDuck/Services/Customize/CustomizationExecutor.cs
@@ -28,6 +28,10 @@ public sealed class CustomizationExecutor(ILogger<CustomizationExecutor>? logger
/// <summary>
/// Applies a value once the debounce elapses, one queued apply at a time.
/// </summary>
+ /// <param name="value">The setting value to apply.</param>
+ /// <param name="applyAction">The asynchronous action that executes the apply.</param>
+ /// <param name="debounceMs">The debounce duration in milliseconds. The default is 400.</param>
+ /// <returns>A <see cref="Task" /> representing the asynchronous operation.</returns>
public async Task ApplyWithDebounceAsync(
object? value,
Func<object?, Task> applyAction,
diff --git a/optimizerDuck/Services/System/RegistryWatcher.cs b/optimizerDuck/Services/System/RegistryWatcher.cs
index 8a32364..95d0b13 100644
--- a/optimizerDuck/Services/System/RegistryWatcher.cs
+++ b/optimizerDuck/Services/System/RegistryWatcher.cs
@@ -7,10 +7,7 @@ namespace optimizerDuck.Services.System;
/// <summary>Monitors Windows registry keys for changes using RegNotifyChangeKeyValue.</summary>
public interface IRegistryWatcher : IDisposable
{
- /// <summary>
- /// Raised when a watched registry key or its values change.
- /// The event argument is the registry path that changed.
- /// </summary>
+ /// <summary>Occurs when a watched registry key or its values change.</summary>
event EventHandler<string>? RegistryKeyChanged;
/// <summary>
diff --git a/optimizerDuck/Services/System/UpdaterService.cs b/optimizerDuck/Services/System/UpdaterService.cs
index 3303e1f..341f0db 100644
--- a/optimizerDuck/Services/System/UpdaterService.cs
+++ b/optimizerDuck/Services/System/UpdaterService.cs
@@ -141,7 +141,6 @@ public class UpdaterService : IDisposable
}
}
-// Helper classes for deserializing GitHub API response
/// <summary>
/// Represents a GitHub release fetched from the API. Used internally for deserialization.
/// </summary>