Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
docs: state the rule in comments instead of dressing it up
fatDuckb628871fd0eb
diff --git a/optimizerDuck.Test/Services/SystemInfoTests.cs b/optimizerDuck.Test/Services/SystemInfoTests.csindex 37d2ea7..f5b85c9 100644--- a/optimizerDuck.Test/Services/SystemInfoTests.cs+++ b/optimizerDuck.Test/Services/SystemInfoTests.cs@@ -182,7 +182,7 @@ public class SystemInfoTests[Theory][InlineData(GpuVendor.Nvidia, "32.0.15.8195", "581.95")]- // Intel's Windows version already is its public driver name.+ // Intel's Windows version is already its public driver name.[InlineData(GpuVendor.Intel, "31.0.101.5333", null)][InlineData(GpuVendor.Unknown, "1.0", null)][InlineData(GpuVendor.Nvidia, null, null)]diff --git a/optimizerDuck.Test/UI/Dialogs/ProcessingDialogTests.cs b/optimizerDuck.Test/UI/Dialogs/ProcessingDialogTests.csindex ae296ee..4fecb47 100644--- a/optimizerDuck.Test/UI/Dialogs/ProcessingDialogTests.cs+++ b/optimizerDuck.Test/UI/Dialogs/ProcessingDialogTests.cs@@ -47,8 +47,7 @@ public class ProcessingDialogTests[InlineData(15, 10)]public void MapProgress_ValueReachingTotal_ClearsTheBar(int value, int total){- // A run that reached its total is over: painting the bar full there left it on the- // taskbar after the dialog closed, with nothing left to clear it.+ // A run that reached its total is over, so the bar clears instead of staying full.var result = ProcessingDialog.MapProgress(false, value, total);Assert.Equal(TaskBarProgressState.None, result.State);diff --git a/optimizerDuck/Services/System/SystemInfo.cs b/optimizerDuck/Services/System/SystemInfo.csindex 3c4b54e..c2d7977 100644--- a/optimizerDuck/Services/System/SystemInfo.cs+++ b/optimizerDuck/Services/System/SystemInfo.cs@@ -164,12 +164,12 @@ public sealed record GpuInfopublic GpuVendor Vendor { get; init; } = GpuVendor.Unknown;public int? VramMB { get; init; }- /// <summary>Windows driver version as the OS reports it, e.g. NVIDIA <c>32.0.15.8195</c>.</summary>+ /// <summary>Driver version exactly as Windows reports it, e.g. NVIDIA <c>32.0.15.8195</c>.</summary>public string? DriverVersion { get; init; }/// <summary>- /// Vendor-facing version when it differs from <see cref="DriverVersion" />: NVIDIA's public- /// number (<c>581.95</c>) or AMD's own packaging version. Null when not derivable/absent.+ /// The version the vendor's own tool shows: NVIDIA's public number (<c>581.95</c>) or AMD's+ /// packaging version (<c>23.19.25.01</c>). Null when it cannot be read./// </summary>public string? DriverDisplayVersion { get; init; }@@ -177,7 +177,7 @@ public sealed record GpuInfopublic string? DeviceId { get; init; }public string? PnpDeviceId { get; init; }- /// <summary>What the UI shows: vendor-facing version, else the raw Windows one.</summary>+ /// <summary><see cref="DriverDisplayVersion" /> when known, else the Windows one.</summary>public string? DriverDisplay => DriverDisplayVersion ?? DriverVersion;public bool IsNvidia => Vendor == GpuVendor.Nvidia;diff --git a/optimizerDuck/Services/System/SystemInfoService.cs b/optimizerDuck/Services/System/SystemInfoService.csindex ae9d32c..9aa0f89 100644--- a/optimizerDuck/Services/System/SystemInfoService.cs+++ b/optimizerDuck/Services/System/SystemInfoService.cs@@ -1196,7 +1196,7 @@ internal static class DxgiHelperinternal static class GpuProvider{- /// <summary>Win32_VideoController.AdapterRAM is a 32-bit byte count: at/above this it is clamped garbage.</summary>+ /// <summary>Win32_VideoController.AdapterRAM is 32-bit, so a value from here up is truncated.</summary>private const long TruncatedAdapterRamBytes = 4_294_901_760; // 0xFFFF0000/// <summary>Physical GPUs ordered by DXGI index; empty when nothing usable found.</summary>@@ -1278,8 +1278,8 @@ internal static class GpuProvidercontinue;var dedicatedMB = (int)((long)desc.DedicatedVideoMemory / (1024 * 1024));var sharedMB = (int)((long)desc.SharedSystemMemory / (1024 * 1024));- // iGPUs without a carve-out report 0 dedicated; the shared pool is then the- // only honest number left (same split Task Manager shows).+ // iGPUs without a carve-out report 0 dedicated, so report the shared pool+ // that Task Manager labels shared GPU memory.var memoryMB = dedicatedMB > 0 ? dedicatedMB : sharedMB;var vendor = DetectVendorById(desc.VendorId);var match = FindWmiMatch(name, desc.VendorId, desc.DeviceId, wmiLookup);@@ -1326,7 +1326,6 @@ internal static class GpuProviderif (string.IsNullOrWhiteSpace(name) || IsVirtualAdapter(name!))continue;var adapterRam = WmiHelper.GetLong(c, "AdapterRAM") ?? 0;- // AdapterRAM is 32-bit, so anything at/above 4 GB is truncated garbage.var vramMB = adapterRam is > 0 and < TruncatedAdapterRamBytes? (int)(adapterRam / (1024 * 1024)): (int?)null;@@ -1386,8 +1385,8 @@ internal static class GpuProvider));}- // Stale/phantom rows (driver leftovers, disabled devices) keep a nonzero- // ConfigManagerErrorCode: match those only after every working row.+ // Rows with a nonzero ConfigManagerErrorCode are stale or disabled, so they+ // sort last and only match when no working row does.return list.OrderByDescending(static e => e.ConfigErrorCode is null or 0).ToList();}@@ -1441,8 +1440,8 @@ internal static class GpuProvider}/// <summary>- /// Name fallback, either direction: WMI appends suffixes DXGI omits- /// ("NVIDIA GeForce GTX 1650 with Max-Q Design") and DXGI caps its description at 128 chars.+ /// Name fallback, both directions, because WMI appends suffixes DXGI drops+ /// ("NVIDIA GeForce GTX 1650 with Max-Q Design") and DXGI truncates at 128 chars./// </summary>internal static bool NamesMatch(string dxgiName, string? wmiName){@@ -1454,9 +1453,9 @@ internal static class GpuProvider}/// <summary>- /// Vendor-facing driver version. The raw Windows string only matches the vendor's own- /// public name for Intel; NVIDIA derives it and AMD publishes a separate one.- /// Null = show <see cref="GpuInfo.DriverVersion" /> as-is.+ /// Vendor-facing driver version. NVIDIA's is derived from the Windows string, AMD's comes from+ /// its own registry key, and Intel's Windows string already is the public name. Null when the+ /// vendor version is unavailable./// </summary>internal static string? BrandDriverVersion(GpuVendor vendor, string? windowsVersion){@@ -1471,9 +1470,9 @@ internal static class GpuProvider}/// <summary>- /// NVIDIA's public version is the last five digits of the Windows version:- /// <c>32.0.15.8195 → 581.95</c>, <c>27.21.14.5671 → 456.71</c>. Null when the string- /// is not a 4-part numeric driver version.+ /// NVIDIA's public version is the last five digits of the Windows one, so <c>32.0.15.8195</c>+ /// is <c>581.95</c> and <c>27.21.14.5671</c> is <c>456.71</c>. Null unless the input is a+ /// 4-part numeric version./// </summary>internal static string? MapNvidiaDriverVersion(string windowsVersion){@@ -1491,8 +1490,8 @@ internal static class GpuProvider}/// <summary>- /// AMD keeps its own version (Software → Driver Version, e.g. <c>23.19.25.01</c>) beside the- /// OS driver string. Null when Radeon Software is absent, so the raw version shows instead.+ /// The version Radeon Software labels "Driver Version" (<c>23.19.25.01</c> on the test box),+ /// which AMD keeps beside the OS driver string. Null when Radeon Software is not installed./// </summary>internal static string? AmdDriverVersion(){diff --git a/optimizerDuck/UI/Behaviors/SmoothScrollBehavior.cs b/optimizerDuck/UI/Behaviors/SmoothScrollBehavior.csindex 6813275..8b64569 100644--- a/optimizerDuck/UI/Behaviors/SmoothScrollBehavior.cs+++ b/optimizerDuck/UI/Behaviors/SmoothScrollBehavior.cs@@ -403,7 +403,7 @@ public static class SmoothScrollBehaviorreturn false;}- // e.OriginalSource may be a ContentElement (Run, Span, ...); VisualTreeHelper rejects those.+ // e.OriginalSource can be a ContentElement (Run, Span), which VisualTreeHelper.GetParent rejects.private static DependencyObject? GetParent(DependencyObject element) =>element switch{diff --git a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.csindex 0f6b692..de9c897 100644--- a/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs+++ b/optimizerDuck/UI/Dialogs/ProcessingDialog.xaml.cs@@ -14,7 +14,7 @@ public partial class ProcessingDialog : UserControlprivate Window? _trackedWindow;private ContentDialog? _hostDialog;- /// <summary>Set once the run is over, so a late report cannot put the bar back.</summary>+ /// <summary>True once the run is over, so a late report cannot put the bar back.</summary>private bool _detached;public ProcessingDialog()@@ -27,8 +27,8 @@ public partial class ProcessingDialog : UserControlprivate void OnLoaded(object sender, RoutedEventArgs e){- // Hiding a ContentDialog does not reliably unload its content, so the dialog's own- // Closed event (the run is over) is the dependable place to drop the taskbar bar.+ // Hiding a ContentDialog does not reliably unload its content, so drop the bar when the+ // host dialog closes rather than waiting for Unloaded._detached = false;_hostDialog = FindHostDialog(this);if (_hostDialog is not null)@@ -47,7 +47,7 @@ public partial class ProcessingDialog : UserControlDetach();}- /// <summary>Ends the run: clears the bar and ignores every later progress report.</summary>+ /// <summary>Clears the bar and stops listening for progress reports.</summary>private void Detach(){_detached = true;@@ -73,9 +73,8 @@ public partial class ProcessingDialog : UserControl}/// <summary>- /// Maps dialog progress to a taskbar indicator state. A finished run (value reaching the- /// total) maps to <see cref="TaskBarProgressState.None" />, so the bar cannot outlive the- /// operation even when the dialog's own close never reaches this control.+ /// Maps dialog progress to a taskbar indicator state. A run that reached its total maps to+ /// <see cref="TaskBarProgressState.None" />, so a finished bar cannot stay behind./// </summary>internal static (TaskBarProgressState State, int Current, int Total) MapProgress(bool isIndeterminate,@@ -118,8 +117,8 @@ public partial class ProcessingDialog : UserControlprivate void ApplyToTaskbar(){- // The window handle stays cached after the dialog is gone: without this, a report that- // lands after the run finished turns the bar back on with nothing left to clear it.+ // The window handle stays cached after the dialog is gone, so a report landing once the+ // run finished would turn the bar back on with nothing left to clear it.if (_detached || !IsLoaded)return;@@ -147,8 +146,6 @@ public partial class ProcessingDialog : UserControlviewModel.Total);- // A finished operation reports value == total and maps to None here, so the bar cannot- // outlive the run even if the dialog's own close never reaches us.if (state == TaskBarProgressState.Normal)_ = TaskBarProgress.SetValue(handle, state, current, total);else