Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/SharedSource/Networking/Primitives/Endpoint/Endpoint.cs
Juan Pablo Arce 1fd2a51bbb Unstable v0.19.5.0
2022-09-14 12:48:12 -03:00

43 lines
1.0 KiB
C#

#nullable enable
namespace Barotrauma.Networking
{
abstract class Endpoint
{
public abstract string StringRepresentation { get; }
public abstract LocalizedString ServerTypeString { get; }
public readonly Address Address;
public Endpoint(Address address)
{
Address = address;
}
public abstract override bool Equals(object? obj);
public abstract override int GetHashCode();
public override string ToString() => StringRepresentation;
public static Option<Endpoint> Parse(string str)
=> ReflectionUtils.ParseDerived<Endpoint, string>(str);
public static bool operator ==(Endpoint? a, Endpoint? b)
{
if (a is null)
{
return b is null;
}
else
{
return a.Equals(b);
}
}
public static bool operator !=(Endpoint? a, Endpoint? b)
=> !(a == b);
}
}