Barotrauma Client Doc
SteamP2PAddress.cs
1 #nullable enable
2 
3 namespace Barotrauma.Networking
4 {
5  sealed class SteamP2PAddress : Address
6  {
7  public readonly SteamId SteamId;
8 
10 
11  public override bool IsLocalHost => false;
12 
13  public SteamP2PAddress(SteamId steamId)
14  {
15  SteamId = steamId;
16  }
17 
18  public new static Option<SteamP2PAddress> Parse(string endpointStr)
19  => SteamId.Parse(endpointStr).Select(steamId => new SteamP2PAddress(steamId));
20 
21  public override bool Equals(object? obj)
22  => obj switch
23  {
24  SteamP2PAddress otherAddress => this == otherAddress,
25  _ => false
26  };
27 
28  public override int GetHashCode()
29  => SteamId.GetHashCode();
30 
31  public static bool operator ==(SteamP2PAddress a, SteamP2PAddress b)
32  => a.SteamId == b.SteamId;
33 
34  public static bool operator !=(SteamP2PAddress a, SteamP2PAddress b)
35  => !(a == b);
36  }
37 }
static new Option< SteamId > Parse(string str)
Definition: SteamId.cs:79
override string StringRepresentation
Definition: SteamId.cs:10
static bool operator!=(SteamP2PAddress a, SteamP2PAddress b)
static bool operator==(SteamP2PAddress a, SteamP2PAddress b)
static new Option< SteamP2PAddress > Parse(string endpointStr)
override bool Equals(object? obj)