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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="FtpCachePolicyElement.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.Configuration;
  19.     using System.Net.Cache;
  20.     using System.Xml;
  21.     using System.Security.Permissions;
  22.    
  23.     public sealed class FtpCachePolicyElement : ConfigurationElement
  24.     {
  25.         public FtpCachePolicyElement()
  26.         {
  27.             this.properties.Add(this.policyLevel);
  28.         }
  29.        
  30.         protected override ConfigurationPropertyCollection Properties {
  31.             get { return this.properties; }
  32.         }
  33.        
  34.         [ConfigurationProperty(ConfigurationStrings.PolicyLevel, DefaultValue = RequestCacheLevel.Default)]
  35.         public RequestCacheLevel PolicyLevel {
  36.             get { return (RequestCacheLevel)this[this.policyLevel]; }
  37.             set { this[this.policyLevel] = value; }
  38.         }
  39.        
  40.        
  41.         protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
  42.         {
  43.             wasReadFromConfig = true;
  44.             base.DeserializeElement(reader, serializeCollectionKey);
  45.         }
  46.        
  47.         protected override void Reset(ConfigurationElement parentElement)
  48.         {
  49.             if (parentElement != null) {
  50.                 FtpCachePolicyElement http = (FtpCachePolicyElement)parentElement;
  51.                 this.wasReadFromConfig = http.wasReadFromConfig;
  52.             }
  53.             base.Reset(parentElement);
  54.         }
  55.        
  56.         internal bool WasReadFromConfig {
  57.             get { return this.wasReadFromConfig; }
  58.         }
  59.        
  60.         bool wasReadFromConfig = false;
  61.         ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
  62.        
  63.         readonly ConfigurationProperty policyLevel = new ConfigurationProperty(ConfigurationStrings.PolicyLevel, typeof(RequestCacheLevel), RequestCacheLevel.Default, ConfigurationPropertyOptions.None);
  64.        
  65.     }
  66.    
  67. }

Developer Fusion