Merge pull request #4935 from lambdageek/dev-handles-may
[mono.git] / mcs / class / System / System.Net.Configuration / ProxyElement.cs
1 //
2 // System.Net.Configuration.ProxyElement.cs
3 //
4 // Authors:
5 //      Tim Coleman (tim@timcoleman.com)
6 //      Chris Toshok (toshok@ximian.com)
7 //
8 // Copyright (C) Tim Coleman, 2004
9 // (C) 2004,2005 Novell, Inc. (http://www.novell.com)
10 //
11
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 // 
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 // 
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 //
32
33 #if CONFIGURATION_DEP
34
35 using System;
36 using System.Configuration;
37
38 namespace System.Net.Configuration 
39 {
40         public sealed class ProxyElement : ConfigurationElement
41         {
42                 #region Fields
43
44                 static ConfigurationPropertyCollection properties;
45                 static ConfigurationProperty autoDetectProp;
46                 static ConfigurationProperty bypassOnLocalProp;
47                 static ConfigurationProperty proxyAddressProp;
48                 static ConfigurationProperty scriptLocationProp;
49                 static ConfigurationProperty useSystemDefaultProp;
50
51                 #endregion // Fields
52
53                 #region Constructors
54
55                 static ProxyElement ()
56                 {
57                         autoDetectProp = new ConfigurationProperty ("autoDetect", typeof (AutoDetectValues), AutoDetectValues.Unspecified);
58                         bypassOnLocalProp = new ConfigurationProperty ("bypassonlocal", typeof (BypassOnLocalValues), BypassOnLocalValues.Unspecified);
59                         proxyAddressProp = new ConfigurationProperty ("proxyaddress", typeof (Uri), null);
60                         scriptLocationProp = new ConfigurationProperty ("scriptLocation", typeof (Uri), null);
61                         useSystemDefaultProp = new ConfigurationProperty ("usesystemdefault", typeof (UseSystemDefaultValues), UseSystemDefaultValues.Unspecified);
62
63                         properties = new ConfigurationPropertyCollection ();
64                                                                     
65                         properties.Add (autoDetectProp);
66                         properties.Add (bypassOnLocalProp);
67                         properties.Add (proxyAddressProp);
68                         properties.Add (scriptLocationProp);
69                         properties.Add (useSystemDefaultProp);
70                 }
71
72                 public ProxyElement ()
73                 {
74                 }
75
76                 #endregion // Constructors
77
78                 #region Properties
79
80                 [ConfigurationProperty ("autoDetect", DefaultValue = "Unspecified")]
81                 public AutoDetectValues AutoDetect {
82                         get { return (AutoDetectValues) base [autoDetectProp]; }
83                         set { base [autoDetectProp] = value; }
84                 }
85
86                 [ConfigurationProperty ("bypassonlocal", DefaultValue = "Unspecified")]
87                 public BypassOnLocalValues BypassOnLocal {
88                         get { return (BypassOnLocalValues) base [bypassOnLocalProp]; }
89                         set { base [bypassOnLocalProp] = value; }
90                 }
91
92                 [ConfigurationProperty ("proxyaddress")]
93                 public Uri ProxyAddress {
94                         get { return (Uri) base [proxyAddressProp]; }
95                         set { base [proxyAddressProp] = value; }
96                 }
97
98                 [ConfigurationProperty ("scriptLocation")]
99                 public Uri ScriptLocation {
100                         get { return (Uri) base [scriptLocationProp]; }
101                         set { base [scriptLocationProp] = value; }
102                 }
103
104                 [ConfigurationProperty ("usesystemdefault", DefaultValue = "Unspecified")]
105                 public UseSystemDefaultValues UseSystemDefault {
106                         get { return (UseSystemDefaultValues) base [useSystemDefaultProp]; }
107                         set { base [useSystemDefaultProp] = value; }
108                 }
109
110                 protected override ConfigurationPropertyCollection Properties {
111                         get { return properties; }
112                 }
113
114                 #endregion // Properties
115
116                 public enum BypassOnLocalValues
117                 {
118                         Unspecified = -1,
119                         True = 1,
120                         False = 0
121                 }
122
123                 public enum UseSystemDefaultValues
124                 {
125                         Unspecified = -1,
126                         True = 1,
127                         False = 0
128                 }
129
130                 public enum AutoDetectValues
131                 {
132                         Unspecified = -1,
133                         True = 1,
134                         False = 0
135                 }
136         }
137 }
138
139 #endif