Files

51 lines
1.2 KiB
C#
Raw Permalink Normal View History

2026-08-27 10:57:58 -06:00
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}";
}
}
}