(bool isSpecCompliant)
| 440 | } |
| 441 | |
| 442 | private Dictionary<string, object?>? AsDictionary(bool isSpecCompliant) |
| 443 | { |
| 444 | Dictionary<string, object?>? serializedDictionary = null; |
| 445 | if (this.proxyKind != ProxyKind.Unspecified) |
| 446 | { |
| 447 | serializedDictionary = new Dictionary<string, object?>(); |
| 448 | if (this.proxyKind == ProxyKind.ProxyAutoConfigure) |
| 449 | { |
| 450 | serializedDictionary["proxyType"] = "pac"; |
| 451 | if (!string.IsNullOrEmpty(this.proxyAutoConfigUrl)) |
| 452 | { |
| 453 | serializedDictionary["proxyAutoconfigUrl"] = this.proxyAutoConfigUrl; |
| 454 | } |
| 455 | } |
| 456 | else |
| 457 | { |
| 458 | serializedDictionary["proxyType"] = this.proxyKind.ToString().ToLowerInvariant(); |
| 459 | } |
| 460 | |
| 461 | if (!string.IsNullOrEmpty(this.httpProxyLocation)) |
| 462 | { |
| 463 | serializedDictionary["httpProxy"] = this.httpProxyLocation; |
| 464 | } |
| 465 | |
| 466 | if (!string.IsNullOrEmpty(this.sslProxyLocation)) |
| 467 | { |
| 468 | serializedDictionary["sslProxy"] = this.sslProxyLocation; |
| 469 | } |
| 470 | |
| 471 | if (!string.IsNullOrEmpty(this.socksProxyLocation)) |
| 472 | { |
| 473 | if (!this.socksVersion.HasValue) |
| 474 | { |
| 475 | throw new InvalidOperationException("Must have a version value set (usually 4 or 5) when specifying a SOCKS proxy"); |
| 476 | } |
| 477 | |
| 478 | string socksAuth = string.Empty; |
| 479 | if (!string.IsNullOrEmpty(this.socksUserName) && !string.IsNullOrEmpty(this.socksPassword)) |
| 480 | { |
| 481 | // TODO: this is probably inaccurate as to how this is supposed |
| 482 | // to look. |
| 483 | socksAuth = this.socksUserName + ":" + this.socksPassword + "@"; |
| 484 | } |
| 485 | |
| 486 | serializedDictionary["socksProxy"] = socksAuth + this.socksProxyLocation; |
| 487 | serializedDictionary["socksVersion"] = this.socksVersion.Value; |
| 488 | } |
| 489 | |
| 490 | if (this.noProxyAddresses.Count > 0) |
| 491 | { |
| 492 | serializedDictionary["noProxy"] = this.GetNoProxyAddressList(isSpecCompliant); |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | return serializedDictionary; |
| 497 | } |
| 498 | |
| 499 | private object? GetNoProxyAddressList(bool isSpecCompliant) |
no test coverage detected