Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetCredential() [1/2]

NetworkCredential? System.Net.CredentialCache.GetCredential ( string host,
int port,
string authenticationType )
inline

Implements System.Net.ICredentialsByHost.

Definition at line 313 of file CredentialCache.cs.

314 {
315 if (host == null)
316 {
317 throw new ArgumentNullException("host");
318 }
319 if (authenticationType == null)
320 {
321 throw new ArgumentNullException("authenticationType");
322 }
323 if (host.Length == 0)
324 {
325 throw new ArgumentException(System.SR.Format(System.SR.net_emptystringcall, "host"), "host");
326 }
327 if (port < 0)
328 {
329 throw new ArgumentOutOfRangeException("port");
330 }
331 if (_cacheForHosts == null)
332 {
333 if (NetEventSource.Log.IsEnabled())
334 {
335 NetEventSource.Info(this, "CredentialCache::GetCredential short-circuiting because the dictionary is null.", "GetCredential");
336 }
337 return null;
338 }
339 CredentialHostKey key = new CredentialHostKey(host, port, authenticationType);
340 NetworkCredential value = null;
342 if (NetEventSource.Log.IsEnabled())
343 {
344 NetEventSource.Info(this, FormattableStringFactory.Create("Returning {0}", (value == null) ? "null" : ("(" + value.UserName + ":" + value.Domain + ")")), "GetCredential");
345 }
346 return value;
347 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
Dictionary< CredentialHostKey, NetworkCredential > _cacheForHosts
static FormattableString Create(string format, params object?[] arguments)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_emptystringcall
Definition SR.cs:14
Definition SR.cs:7

References System.Net.CredentialCache._cacheForHosts, System.Runtime.CompilerServices.FormattableStringFactory.Create(), System.SR.Format(), System.Net.NetEventSource.Info(), System.key, System.Net.NetEventSource.Log, System.SR.net_emptystringcall, System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.