2004-09-11 Sebastien Pouliot <sebastien@ximian.com>
[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 //
7 // Copyright (C) Tim Coleman, 2004
8 // (c) 2004 Novell, Inc. (http://www.novell.com)
9 //
10
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31
32 #if NET_2_0 && XML_DEP
33
34 using System;
35 using System.Configuration;
36
37 namespace System.Net.Configuration 
38 {
39         public sealed class ProxyElement : ConfigurationElement
40         {
41                 #region Fields
42
43                 ConfigurationPropertyCollection properties;
44                 static ConfigurationProperty bypassOnLocal = new ConfigurationProperty ("BypassOnLocal", typeof (BypassOnLocalValues), BypassOnLocalValues.Default);
45                 static ConfigurationProperty proxyAddress = new ConfigurationProperty ("ProxyAddress", typeof (string), null);
46                 static ConfigurationProperty scriptDownloadInterval = new ConfigurationProperty ("ScriptDownloadInterval", typeof (TimeSpan), TimeSpan.MinValue);
47                 static ConfigurationProperty scriptDownloadTimeout = new ConfigurationProperty ("ScriptDownloadTimeout", typeof (TimeSpan), TimeSpan.MinValue);
48                 static ConfigurationProperty useDefaultCredentials = new ConfigurationProperty ("UseDefaultCredentials", typeof (bool), false);
49                 static ConfigurationProperty useDefaultCredentialsForScriptDownload = new ConfigurationProperty ("UseDefaultCredentialsForScriptDownload", typeof (bool), false);
50                 static ConfigurationProperty useSystemDefault = new ConfigurationProperty ("UseSystemDefault", typeof (bool), true);
51
52                 #endregion // Fields
53
54                 #region Constructors
55
56                 [MonoTODO]
57                 public ProxyElement ()
58                 {
59                         properties = new ConfigurationPropertyCollection ();
60                         properties.Add (bypassOnLocal);
61                         properties.Add (proxyAddress);
62                         properties.Add (scriptDownloadInterval);
63                         properties.Add (scriptDownloadTimeout);
64                         properties.Add (useDefaultCredentials);
65                         properties.Add (useDefaultCredentialsForScriptDownload);
66                         properties.Add (useSystemDefault);
67                 }
68
69                 #endregion // Constructors
70
71                 #region Properties
72
73                 public BypassOnLocalValues BypassOnLocal {
74                         get { return (BypassOnLocalValues) base [bypassOnLocal]; }
75                         set { base [bypassOnLocal] = value; }
76                 }
77
78                 protected internal override ConfigurationPropertyCollection Properties {
79                         get { return properties; }
80                 }
81
82                 public string ProxyAddress {
83                         get { return (string) base [proxyAddress]; }
84                         set { base [proxyAddress] = value; }
85                 }
86
87                 public TimeSpan ScriptDownloadInterval {
88                         get { return (TimeSpan) base [scriptDownloadInterval]; }
89                         set { base [scriptDownloadInterval] = value; }
90                 }
91
92                 public TimeSpan ScriptDownloadTimeout {
93                         get { return (TimeSpan) base [scriptDownloadTimeout]; }
94                         set { base [scriptDownloadTimeout] = value; }
95                 }
96
97                 public bool UseDefaultCredentials {
98                         get { return (bool) base [useDefaultCredentials]; }
99                         set { base [useDefaultCredentials] = value; }
100                 }
101
102                 public bool UseDefaultCredentialsForScriptDownload {
103                         get { return (bool) base [useDefaultCredentialsForScriptDownload]; }
104                         set { base [useDefaultCredentialsForScriptDownload] = value; }
105                 }
106
107                 public bool UseSystemDefault {
108                         get { return (bool) base [useSystemDefault]; }
109                         set { base [useSystemDefault] = value; }
110                 }
111
112                 #endregion // Properties
113
114                 public enum BypassOnLocalValues
115                 {
116                         Default = -1,
117                         True = 1,
118                         False = 0
119                 }
120         }
121 }
122
123 #endif