mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-23 23:20:05 +01:00
Introduce a new `MccsCapabilitiesParser` to replace the regex-based `VcpCapabilitiesParser` for parsing MCCS capabilities strings. The new parser uses a grammar-based recursive descent approach, improving performance, extensibility, and error handling. Key changes: - Implement `MccsCapabilitiesParser` with `ref struct` for zero heap allocation and efficient parsing using `ReadOnlySpan<char>`. - Add sub-parsers for `vcp()` and `vcpname()` segments. - Accumulate errors in `ParseError` list and return partial results. - Replace all references to `VcpCapabilitiesParser` with the new parser in `DdcCiNative.cs` and `MonitorManager.cs`. - Enhance `VcpCapabilities` model with `MccsVersion` property. - Add comprehensive unit tests in `MccsCapabilitiesParserTests.cs` to validate real-world examples and edge cases. - Remove legacy `VcpCapabilitiesParser` and associated code. Additional improvements: - Optimize parsing for both space-separated and concatenated hex formats. - Improve logging for parsing progress and error diagnostics. - Adjust application initialization to prevent race conditions.