Files
PulsarK-main/Pulsar.Common/Video/Resolution.cs
T
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

51 lines
1.2 KiB
C#

using MessagePack;
using System;
namespace Pulsar.Common.Video
{
[MessagePackObject]
public class Resolution : IEquatable<Resolution>
{
[Key(1)]
public int Width { get; set; }
[Key(2)]
public int Height { get; set; }
public bool Equals(Resolution other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Width == other.Width && Height == other.Height;
}
public static bool operator ==(Resolution r1, Resolution r2)
{
if (ReferenceEquals(r1, null))
return ReferenceEquals(r2, null);
return r1.Equals(r2);
}
public static bool operator !=(Resolution r1, Resolution r2)
{
return !(r1 == r2);
}
public override bool Equals(object obj)
{
return Equals(obj as Resolution);
}
public override int GetHashCode()
{
return Width ^ Height;
}
public override string ToString()
{
return $"{Width}x{Height}";
}
}
}