| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // System.Net.GlobalProxySelection
- //
- // Author:
- // Lawrence Pit ([email protected])
- //
- using System;
- using System.Collections;
- using System.IO;
- using System.Runtime.Serialization;
- namespace System.Net
- {
- public class GlobalProxySelection
- {
- private static IWebProxy proxy;
-
- // Static Initializer
-
- static GlobalProxySelection ()
- {
- proxy = GetEmptyWebProxy ();
-
- // TODO: create proxy object based on information from
- // the global or application configuration file.
- }
-
- // Constructors
-
- public GlobalProxySelection() { }
-
- // Properties
-
- public static IWebProxy Select {
- get { return proxy; }
- set {
- proxy = (value == null) ? GetEmptyWebProxy () : value;
- }
- }
-
- // Methods
-
- public static IWebProxy GetEmptyWebProxy()
- {
- // must return a new one each time, as the credentials
- // can be set
- return new EmptyWebProxy ();
- }
-
- // Internal Classes
-
- internal class EmptyWebProxy : IWebProxy {
- private ICredentials credentials = null;
-
- internal EmptyWebProxy () { }
-
- public ICredentials Credentials {
- get { return credentials; }
- set { credentials = value; }
- }
- public Uri GetProxy (Uri destination)
- {
- return destination;
- }
- public bool IsBypassed (Uri host)
- {
- return true; // pass directly to host
- }
- }
- }
- }
|