The Labs \ Source Viewer \ SSCLI \ System.Net.Configuration \ BypassOnLocalValues

  1. //------------------------------------------------------------------------------
  2. // <copyright file="ProxyElement.cs" company="Microsoft Corporation">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Net.Configuration
  16. {
  17.     using System;
  18.     using System.Xml;
  19.     using System.Configuration;
  20.     using System.Reflection;
  21.     using System.ComponentModel;
  22.     using System.Security.Permissions;
  23.    
  24.     public sealed class ProxyElement : ConfigurationElement
  25.     {
  26.         public enum BypassOnLocalValues
  27.         {
  28.             Unspecified = -1,
  29.             False = 0,
  30.             True = 1
  31.         }
  32.        
  33.         public enum UseSystemDefaultValues
  34.         {
  35.             Unspecified = -1,
  36.             False = 0,
  37.             True = 1
  38.         }
  39.        
  40.         public enum AutoDetectValues
  41.         {
  42.             Unspecified = -1,
  43.             False = 0,
  44.             True = 1
  45.         }
  46.        
  47.         public ProxyElement()
  48.         {
  49.             this.properties.Add(this.autoDetect);
  50.             this.properties.Add(this.scriptLocation);
  51.             this.properties.Add(this.bypassonlocal);
  52.             this.properties.Add(this.proxyaddress);
  53.             this.properties.Add(this.usesystemdefault);
  54.         }
  55.        
  56.         protected override ConfigurationPropertyCollection Properties {
  57.             get { return this.properties; }
  58.         }
  59.        
  60.         [ConfigurationProperty(ConfigurationStrings.AutoDetect, DefaultValue = AutoDetectValues.Unspecified)]
  61.         public AutoDetectValues AutoDetect {
  62.             get { return (AutoDetectValues)this[this.autoDetect]; }
  63.             set { this[this.autoDetect] = value; }
  64.         }
  65.        
  66.         [ConfigurationProperty(ConfigurationStrings.ScriptLocation)]
  67.         public Uri ScriptLocation {
  68.             get { return (Uri)this[this.scriptLocation]; }
  69.             set { this[this.scriptLocation] = value; }
  70.         }
  71.        
  72.         [ConfigurationProperty(ConfigurationStrings.BypassOnLocal, DefaultValue = (BypassOnLocalValues)BypassOnLocalValues.Unspecified)]
  73.         public BypassOnLocalValues BypassOnLocal {
  74.             get { return (BypassOnLocalValues)this[this.bypassonlocal]; }
  75.             set { this[this.bypassonlocal] = value; }
  76.         }
  77.        
  78.         [ConfigurationProperty(ConfigurationStrings.ProxyAddress)]
  79.         public Uri ProxyAddress {
  80.             get { return (Uri)this[this.proxyaddress]; }
  81.             set { this[this.proxyaddress] = value; }
  82.         }
  83.        
  84.         [ConfigurationProperty(ConfigurationStrings.UseSystemDefault, DefaultValue = (UseSystemDefaultValues)UseSystemDefaultValues.Unspecified)]
  85.         public UseSystemDefaultValues UseSystemDefault {
  86.             get { return (UseSystemDefaultValues)this[this.usesystemdefault]; }
  87.             set { this[this.usesystemdefault] = value; }
  88.         }
  89.        
  90.         ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
  91.        
  92.         readonly ConfigurationProperty autoDetect = new ConfigurationProperty(ConfigurationStrings.AutoDetect, typeof(AutoDetectValues), AutoDetectValues.Unspecified, new EnumConverter(typeof(AutoDetectValues)), null, ConfigurationPropertyOptions.None);
  93.        
  94.         readonly ConfigurationProperty scriptLocation = new ConfigurationProperty(ConfigurationStrings.ScriptLocation, typeof(Uri), null, new UriTypeConverter(UriKind.Absolute), null, ConfigurationPropertyOptions.None);
  95.        
  96.         // Supply a type converter, even though it's a plain type converter, to get around ConfigurationProperty's internal
  97.         // Enum conversion routine. The internal one is case-sensitive, we want this to be case-insensitive.
  98.         readonly ConfigurationProperty bypassonlocal = new ConfigurationProperty(ConfigurationStrings.BypassOnLocal, typeof(BypassOnLocalValues), BypassOnLocalValues.Unspecified, new EnumConverter(typeof(BypassOnLocalValues)), null, ConfigurationPropertyOptions.None);
  99.        
  100.         readonly ConfigurationProperty proxyaddress = new ConfigurationProperty(ConfigurationStrings.ProxyAddress, typeof(Uri), null, new UriTypeConverter(UriKind.Absolute), null, ConfigurationPropertyOptions.None);
  101.        
  102.         readonly ConfigurationProperty usesystemdefault = new ConfigurationProperty(ConfigurationStrings.UseSystemDefault, typeof(UseSystemDefaultValues), UseSystemDefaultValues.Unspecified, new EnumConverter(typeof(UseSystemDefaultValues)), null, ConfigurationPropertyOptions.None);
  103.     }
  104. }

Developer Fusion