public IP2PAddress ReadPeerAddress() { ETransporLayerType layerType = P2PTransportLayer.Instance.GetLayerType(); IP2PAddress result; if (layerType != ETransporLayerType.UNet) { if (layerType != ETransporLayerType.Steam) { throw new NotImplementedException(); } result = new P2PAddressSteam { m_SteamID = new CSteamID(this.ReadUInt64()) }; } else { result = new P2PAddressUnet { m_IP = this.ReadString(), m_Port = this.ReadInt32() }; } return(result); }
public void GetConnectionInfo(int connection_id, out IP2PAddress address, out byte error) { CSteamID connectionSteamId = this.GetConnectionSteamId(connection_id); address = new P2PAddressSteam { m_SteamID = connectionSteamId }; error = ((connectionSteamId == CSteamID.Nil) ? 2 : 0); }
public void Write(IP2PAddress addr) { ETransporLayerType layerType = P2PTransportLayer.Instance.GetLayerType(); if (layerType == ETransporLayerType.UNet) { P2PAddressUnet p2PAddressUnet = addr as P2PAddressUnet; this.Write(p2PAddressUnet.m_IP); this.Write(p2PAddressUnet.m_Port); return; } if (layerType != ETransporLayerType.Steam) { throw new NotImplementedException(); } P2PAddressSteam p2PAddressSteam = addr as P2PAddressSteam; this.Write(p2PAddressSteam.m_SteamID.m_SteamID); }
public bool Equals(IP2PAddress other) { P2PAddressSteam p2PAddressSteam = other as P2PAddressSteam; return(p2PAddressSteam != null && this.m_SteamID == p2PAddressSteam.m_SteamID); }