2
0

ProxyElement.cs 4.2 KB

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