using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
///
/// UnAttachedDisplayHandle is a one-to-one map to the GDI handle of an unattached display.
///
[StructLayout(LayoutKind.Sequential)]
public struct UnAttachedDisplayHandle : IHandle, IEquatable
{
internal readonly IntPtr _MemoryAddress;
///
public bool Equals(UnAttachedDisplayHandle other)
{
return _MemoryAddress.Equals(other._MemoryAddress);
}
///
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is UnAttachedDisplayHandle && Equals((UnAttachedDisplayHandle) obj);
}
///
public override int GetHashCode()
{
return _MemoryAddress.GetHashCode();
}
///
public override string ToString()
{
return $"UnAttachedDisplayHandle #{MemoryAddress.ToInt64()}";
}
///
/// Checks for equality between two objects of same type
///
/// The first object
/// The second object
/// true, if both objects are equal, otherwise false
public static bool operator ==(UnAttachedDisplayHandle left, UnAttachedDisplayHandle right)
{
return left.Equals(right);
}
///
/// Checks for inequality between two objects of same type
///
/// The first object
/// The second object
/// true, if both objects are not equal, otherwise false
public static bool operator !=(UnAttachedDisplayHandle left, UnAttachedDisplayHandle right)
{
return !left.Equals(right);
}
///
public IntPtr MemoryAddress
{
get => _MemoryAddress;
}
///
public bool IsNull
{
get => _MemoryAddress == IntPtr.Zero;
}
}
}