/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/ShortcutGuide/ShortcutGuide.Ui/Models/ShortcutDescription.cs
63 строки
2 KB
Noraa Junker
[Shortcut Guide V2] Fixes (#48043)
24 май 2026, 13:08
Не верифицирован
24 май 2026, 13:08
fed9e81
Код
Авторство
О чём код?
// 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; using System.Linq; using System.Text.Json.Serialization; namespace ShortcutGuide.Models { public class ShortcutDescription(bool ctrl, bool shift, bool alt, bool win, string[] keys) { public ShortcutDescription() : this(false, false, false, false, []) { } [JsonPropertyName(nameof(Ctrl))] public bool Ctrl { get; set; } = ctrl; [JsonPropertyName(nameof(Shift))] public bool Shift { get; set; } = shift; [JsonPropertyName(nameof(Alt))] public bool Alt { get; set; } = alt; [JsonPropertyName(nameof(Win))] public bool Win { get; set; } = win; [JsonPropertyName(nameof(Keys))] public string[] Keys { get; set; } = keys; public override bool Equals(object? obj) { return obj is ShortcutDescription other && this.Ctrl == other.Ctrl && this.Shift == other.Shift && this.Alt == other.Alt && this.Win == other.Win && this.Keys.SequenceEqual(other.Keys); } public override int GetHashCode() { var hash = HashCode.Combine(Ctrl, Shift, Alt, Win); foreach (var key in Keys) { hash = HashCode.Combine(hash, key); } return hash; } public static bool operator ==(ShortcutDescription? left, ShortcutDescription? right) { return (left is null && right is null) || (left is not null && right is not null && left.Equals(right)); } public static bool operator !=(ShortcutDescription? left, ShortcutDescription? right) { return !(left == right); } } }