Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IPPacketInformation.cs
Go to the documentation of this file.
2
3namespace System.Net.Sockets;
4
5public struct IPPacketInformation
6{
7 private readonly IPAddress _address;
8
9 private readonly int _networkInterface;
10
12
14
15 internal IPPacketInformation(IPAddress address, int networkInterface)
16 {
17 _address = address;
18 _networkInterface = networkInterface;
19 }
20
21 public static bool operator ==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
22 {
23 if (packetInformation1._networkInterface == packetInformation2._networkInterface)
24 {
25 if (packetInformation1._address != null || packetInformation2._address != null)
26 {
27 if (packetInformation1._address != null)
28 {
29 return packetInformation1._address.Equals(packetInformation2._address);
30 }
31 return false;
32 }
33 return true;
34 }
35 return false;
36 }
37
38 public static bool operator !=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
39 {
40 return !(packetInformation1 == packetInformation2);
41 }
42
43 public override bool Equals([NotNullWhen(true)] object? comparand)
44 {
45 if (comparand is IPPacketInformation iPPacketInformation)
46 {
47 return this == iPPacketInformation;
48 }
49 return false;
50 }
51
52 public override int GetHashCode()
53 {
54 return _networkInterface.GetHashCode() * -1521134295 + ((_address != null) ? _address.GetHashCode() : 0);
55 }
56}
override int GetHashCode()
Definition IPAddress.cs:496
override bool Equals([NotNullWhen(true)] object? comparand)
Definition IPAddress.cs:468
override bool Equals([NotNullWhen(true)] object? comparand)
static bool operator!=(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
static bool operator==(IPPacketInformation packetInformation1, IPPacketInformation packetInformation2)
IPPacketInformation(IPAddress address, int networkInterface)