/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/powerdisplay/PowerDisplay.Lib/Models/KnownGoodVcpFeature.cs
40 строк
1 KB
moooyo
PowerDisplay: Fall back to persisted VCP values when a monitor read fails (#49445)
03 авг 2026, 12:10
Не верифицирован
03 авг 2026, 12:10
ba2e89c
Код
Авторство
О чём код?
// 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.Text.Json.Serialization; namespace PowerDisplay.Common.Models { public sealed class KnownGoodVcpFeature { [JsonPropertyName("code")] public byte Code { get; set; } [JsonPropertyName("current")] public int Current { get; set; } [JsonPropertyName("maximum")] public int Maximum { get; set; } public KnownGoodVcpFeature Clone() => new() { Code = Code, Current = Current, Maximum = Maximum, }; /// <summary> /// Builds an observation from a device-native value. The inverse of /// <see cref="ToVcpFeatureValue"/>, so the two stay in step. /// </summary> public static KnownGoodVcpFeature From(byte code, VcpFeatureValue value) => new() { Code = code, Current = value.Current, Maximum = value.Maximum, }; public VcpFeatureValue ToVcpFeatureValue() => new(Current, 0, Maximum); } }