namespace Brutal.RakNetApi; public partial struct RakNetGUID : IEquatable { /// /// A special RakNetGUID used in the API. /// /// /// UNASSIGNED_RAKNET_GUID is often means for concepts like "MY GUID" or "ANY GUID" /// public static readonly RakNetGUID UNASSIGNED_RAKNET_GUID = new() { G = ulong.MaxValue, SystemIndex = ushort.MaxValue, }; /// /// Converts the current instance to its string representation. /// /// A string representation of the instance. Returns "UNASSIGNED_RAKNET_GUID" if the instance is equal to , otherwise returns the value of the G field as a string. public override string ToString() { return this == UNASSIGNED_RAKNET_GUID ? "UNASSIGNED_RAKNET_GUID" : $"{G}"; } /// /// Defines an equality operator for comparing two instances of . /// /// The first instance to compare. /// The second instance to compare. /// True if the two instances are equal; otherwise, false. public static bool operator ==(RakNetGUID left, RakNetGUID right) => left.G == right.G; /// /// Defines an equality operator for comparing two instances of . /// /// The first instance to compare. /// The second instance to compare. /// True if the two instances are equal; otherwise, false. public static bool operator !=(RakNetGUID left, RakNetGUID right) => !(left == right); /// /// Determines whether the current instance is equal to another instance of . /// /// The instance to compare with the current instance. /// True if the current instance is equal to the specified instance; otherwise, false. public bool Equals(RakNetGUID other) { return G == other.G; } /// /// Determines whether the current instance is equal to a specified object. /// /// The object to compare with the current instance. /// True if the specified object is equal to the current instance; otherwise, false. public override bool Equals(object? obj) { return obj is RakNetGUID other && Equals(other); } /// /// Generates a hash code for the current instance of based on its field values. /// /// A hash code representing the current instance. public override int GetHashCode() { return G.GetHashCode(); } }