Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CredentialHostKey.cs
Go to the documentation of this file.
4
5namespace System.Net;
6
7internal readonly struct CredentialHostKey : IEquatable<CredentialHostKey>
8{
9 public readonly string Host;
10
11 public readonly string AuthenticationType;
12
13 public readonly int Port;
14
15 internal CredentialHostKey(string host, int port, string authenticationType)
16 {
17 Host = host;
18 Port = port;
19 AuthenticationType = authenticationType;
20 }
21
22 public override int GetHashCode()
23 {
24 return StringComparer.OrdinalIgnoreCase.GetHashCode(AuthenticationType) ^ StringComparer.OrdinalIgnoreCase.GetHashCode(Host) ^ Port.GetHashCode();
25 }
26
28 {
29 bool flag = string.Equals(AuthenticationType, other.AuthenticationType, StringComparison.OrdinalIgnoreCase) && string.Equals(Host, other.Host, StringComparison.OrdinalIgnoreCase) && Port == other.Port;
30 if (NetEventSource.Log.IsEnabled())
31 {
32 NetEventSource.Info(this, $"Equals({this},{other}) returns {flag}", "Equals");
33 }
34 return flag;
35 }
36
37 public override bool Equals([NotNullWhen(true)] object obj)
38 {
40 {
42 }
43 return false;
44 }
45
46 public override string ToString()
47 {
49 DefaultInterpolatedStringHandler handler = new DefaultInterpolatedStringHandler(2, 3, invariantCulture);
50 handler.AppendFormatted(Host);
51 handler.AppendLiteral(":");
52 handler.AppendFormatted(Port);
53 handler.AppendLiteral(":");
55 return string.Create(invariantCulture, ref handler);
56 }
57}
static CultureInfo InvariantCulture
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static StringComparer OrdinalIgnoreCase
override bool Equals([NotNullWhen(true)] object obj)
bool Equals(CredentialHostKey other)
CredentialHostKey(string host, int port, string authenticationType)