mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Refactored namespaces to improve modularity, including moving `PowerDisplay.Native` to `PowerDisplay.Common.Drivers`. Introduced the `IMonitorData` interface for better abstraction of monitor hardware data. Replaced `ColorTemperature` with `ColorTemperatureVcp` for precise VCP-based color temperature control, adding utilities for Kelvin conversion. Enhanced monitor state management with a new `MonitorStateFile` for JSON persistence and updated `MonitorStateManager` for debounced saves. Added `MonitorMatchingHelper` for consistent monitor identification and `ProfileHelper` for profile management operations. Refactored P/Invoke declarations into helper classes, updated UI bindings for `ColorTemperatureVcp`, and improved logging for better runtime visibility. Removed redundant code, added new utility classes (`MonitorValueConverter`, `MonitorMatchingHelper`), and ensured backward compatibility. These changes improve code organization, maintainability, and extensibility while aligning with hardware-level control standards.
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
using PowerDisplay.Common.Models;
|
|
|
|
namespace PowerDisplay.Common.Serialization
|
|
{
|
|
/// <summary>
|
|
/// JSON serialization context for PowerDisplay Profile types.
|
|
/// Provides source-generated serialization for Native AOT compatibility.
|
|
/// </summary>
|
|
[JsonSourceGenerationOptions(
|
|
WriteIndented = false,
|
|
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
|
IncludeFields = true)]
|
|
|
|
// Profile Types
|
|
[JsonSerializable(typeof(ProfileMonitorSetting))]
|
|
[JsonSerializable(typeof(List<ProfileMonitorSetting>))]
|
|
[JsonSerializable(typeof(PowerDisplayProfile))]
|
|
[JsonSerializable(typeof(List<PowerDisplayProfile>))]
|
|
[JsonSerializable(typeof(PowerDisplayProfiles))]
|
|
[JsonSerializable(typeof(ProfileOperation))]
|
|
[JsonSerializable(typeof(List<ProfileOperation>))]
|
|
[JsonSerializable(typeof(ColorTemperatureOperation))]
|
|
[JsonSerializable(typeof(List<ColorTemperatureOperation>))]
|
|
|
|
// Monitor State Types
|
|
[JsonSerializable(typeof(MonitorStateEntry))]
|
|
[JsonSerializable(typeof(MonitorStateFile))]
|
|
[JsonSerializable(typeof(Dictionary<string, MonitorStateEntry>))]
|
|
public partial class ProfileSerializationContext : JsonSerializerContext
|
|
{
|
|
}
|
|
}
|