mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-02-17 13:04:12 +01:00
Order resolutions
This commit is contained in:
parent
e5fd135b30
commit
b94719adb0
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.VisualBasic.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
|
@ -200,7 +201,7 @@ namespace PowerControl.Helpers
|
|||
UpdateMonitors();
|
||||
}
|
||||
|
||||
public struct DisplayResolution
|
||||
public struct DisplayResolution : IComparable<DisplayResolution>
|
||||
{
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
|
|
@ -218,6 +219,13 @@ namespace PowerControl.Helpers
|
|||
|
||||
public override readonly int GetHashCode() => HashCode.Combine(Width, Height);
|
||||
|
||||
public int CompareTo(DisplayResolution other)
|
||||
{
|
||||
var index = Width.CompareTo(other.Width);
|
||||
if (index == 0) index = Height.CompareTo(other.Height);
|
||||
return index;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0}x{1}", Width, Height);
|
||||
|
|
@ -254,7 +262,7 @@ namespace PowerControl.Helpers
|
|||
{
|
||||
return FindAllDisplaySettings()
|
||||
.Select((dm) => new DisplayResolution(dm.dmPelsWidth, dm.dmPelsHeight))
|
||||
.ToHashSet()
|
||||
.ToImmutableSortedSet()
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue