Fix all StyleCop (SA) code style issues in PowerDisplay module

This commit resolves all 120+ StyleCop analyzer violations in the PowerDisplay module:

- SA1413: Add trailing commas in multi-line initializers (19 instances)
- SA1516: Add blank lines between elements (multiple instances)
- SA1518: Add newline at end of files (multiple instances)
- SA1211: Fix using alias directive ordering (3 instances)
- SA1513: Add blank line after closing brace (multiple instances)
- SA1505: Remove blank line after opening brace
- SA1028: Remove trailing whitespace (multiple instances)
- SA1307: Add SuppressMessage for native structure fields
- SA1025: Remove multiple whitespace characters
- SA1507: Remove multiple consecutive blank lines

All changes are formatting-only and do not affect functionality.
Build now completes successfully with zero StyleCop errors.
This commit is contained in:
Yu Leng
2025-10-20 15:00:22 +08:00
parent 0b93cce441
commit 2fd16dd04d
9 changed files with 18 additions and 18 deletions

View File

@@ -82,7 +82,7 @@ namespace PowerDisplay.Core.Utils
< 3500 => "Warm",
< 5500 => "Neutral",
< 7500 => "Cool",
_ => "Very Cool"
_ => "Very Cool",
};
}
}

View File

@@ -184,7 +184,7 @@ namespace PowerDisplay.Helpers
Brightness = entry.Brightness,
ColorTemperature = entry.ColorTemperature,
Contrast = entry.Contrast,
Volume = entry.Volume
Volume = entry.Volume,
};
}
}
@@ -215,7 +215,7 @@ namespace PowerDisplay.Helpers
// Build state file
var stateFile = new MonitorStateFile
{
LastUpdated = DateTime.Now
LastUpdated = DateTime.Now,
};
var now = DateTime.Now;
@@ -233,7 +233,7 @@ namespace PowerDisplay.Helpers
ColorTemperature = state.ColorTemperature,
Contrast = state.Contrast,
Volume = state.Volume,
LastUpdated = now
LastUpdated = now,
};
}
}

View File

@@ -151,7 +151,7 @@ namespace PowerDisplay.Helpers
{
CbSize = (uint)sizeof(NOTIFYICONDATA),
HWnd = _messageWindowHandle,
UID = 1
UID = 1,
};
Shell_NotifyIcon(NimDelete, ref tempData);

View File

@@ -374,7 +374,7 @@ namespace PowerDisplay.Native.DDC
FriendlyName = friendlyName ?? string.Empty,
HardwareId = hardwareId ?? string.Empty,
AdapterId = path.TargetInfo.AdapterId,
TargetId = path.TargetInfo.Id
TargetId = path.TargetInfo.Id,
};
}
}

View File

@@ -185,7 +185,7 @@ namespace PowerDisplay.Native.DDC
Capabilities = MonitorCapabilities.Brightness | MonitorCapabilities.DdcCi,
ConnectionType = "External",
CommunicationMethod = "DDC/CI",
Manufacturer = ExtractManufacturer(name)
Manufacturer = ExtractManufacturer(name),
};
// Check contrast support

View File

@@ -218,7 +218,7 @@ namespace PowerDisplay.Native.WMI
ConnectionType = "Internal",
CommunicationMethod = "WMI",
Manufacturer = "Internal",
SupportsColorTemperature = false // Internal monitors don't support DDC/CI color temperature
SupportsColorTemperature = false, // Internal monitors don't support DDC/CI color temperature
};
monitors.Add(monitor);

View File

@@ -225,7 +225,7 @@ namespace PowerDisplay
_messageReceiverThread = new Thread(MessageReceiverThreadProc)
{
IsBackground = true,
Name = "PowerDisplay IPC Receiver"
Name = "PowerDisplay IPC Receiver",
};
_messageReceiverThread.Start();
}
@@ -367,14 +367,14 @@ namespace PowerDisplay
{
Text = "PowerDisplay Startup Failed",
FontSize = 20,
FontWeight = Microsoft.UI.Text.FontWeights.SemiBold
FontWeight = Microsoft.UI.Text.FontWeights.SemiBold,
});
panel.Children.Add(new TextBlock
{
Text = $"Error: {ex.Message}",
FontSize = 14,
TextWrapping = TextWrapping.Wrap
TextWrapping = TextWrapping.Wrap,
});
panel.Children.Add(new TextBlock
@@ -383,14 +383,14 @@ namespace PowerDisplay
FontSize = 12,
TextWrapping = TextWrapping.Wrap,
Foreground = new SolidColorBrush(Microsoft.UI.Colors.Gray),
Margin = new Thickness(0, 10, 0, 0)
Margin = new Thickness(0, 10, 0, 0),
});
var closeButton = new Button
{
Content = "Close",
HorizontalAlignment = HorizontalAlignment.Right,
Margin = new Thickness(0, 10, 0, 0)
Margin = new Thickness(0, 10, 0, 0),
};
closeButton.Click += (_, _) => errorWindow.Close();
panel.Children.Add(closeButton);
@@ -400,7 +400,7 @@ namespace PowerDisplay
Content = panel,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
MaxHeight = 600,
MaxWidth = 800
MaxWidth = 800,
};
errorWindow.Activate();

View File

@@ -483,7 +483,7 @@ namespace PowerDisplay
Title = "Monitor Detection Test",
Content = "Starting monitor detection...",
CloseButtonText = "Close",
XamlRoot = this.Content.XamlRoot
XamlRoot = this.Content.XamlRoot,
};
_ = dlg.ShowAsync();

View File

@@ -333,7 +333,7 @@ public partial class MainViewModel : INotifyPropertyChanged, IDisposable
_settingsWatcher = new FileSystemWatcher(directory, fileName)
{
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime,
EnableRaisingEvents = true
EnableRaisingEvents = true,
};
_settingsWatcher.Changed += OnSettingsFileChanged;
@@ -688,7 +688,7 @@ public partial class MainViewModel : INotifyPropertyChanged, IDisposable
CommunicationMethod = GetCommunicationMethodString(vm.Type),
MonitorType = vm.Type.ToString(),
CurrentBrightness = vm.Brightness,
ColorTemperature = vm.ColorTemperature
ColorTemperature = vm.ColorTemperature,
};
monitorsData.Add(monitorData);
@@ -718,7 +718,7 @@ public partial class MainViewModel : INotifyPropertyChanged, IDisposable
{
MonitorType.External => "DDC/CI",
MonitorType.Internal => "WMI",
_ => "Unknown"
_ => "Unknown",
};
}