2 // System.Configuration.SectionInformation.cs
5 // Duncan Mak (duncan@ximian.com)
6 // Lluis Sanchez Gual (lluis@novell.com)
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
30 using System.Collections;
33 namespace System.Configuration
35 public sealed class SectionInformation
37 ConfigurationSection parent;
39 ConfigurationAllowDefinition allow_definition = ConfigurationAllowDefinition.Everywhere;
40 ConfigurationAllowExeDefinition allow_exe_definition = ConfigurationAllowExeDefinition.MachineToApplication;
41 bool allow_location, allow_override;
42 bool inherit_on_child_apps;
43 bool restart_on_external_changes;
44 bool require_permission;
46 string config_source = String.Empty;
48 string name, type_name;
51 ProtectedConfigurationProvider protection_provider;
54 [MonoTODO ("default value for require_permission")]
55 internal SectionInformation ()
57 allow_definition = ConfigurationAllowDefinition.Everywhere;
58 allow_location = true;
59 allow_override = true;
60 inherit_on_child_apps = true;
61 restart_on_external_changes = true;
64 internal string ConfigFilePath {
69 public ConfigurationAllowDefinition AllowDefinition {
70 get { return allow_definition; }
71 set { allow_definition = value; }
74 public ConfigurationAllowExeDefinition AllowExeDefinition {
75 get { return allow_exe_definition; }
76 set { allow_exe_definition = value; }
79 public bool AllowLocation {
80 get { return allow_location; }
81 set { allow_location = value; }
84 public bool AllowOverride {
85 get { return allow_override; }
86 set { allow_override = value; }
89 public string ConfigSource {
90 get { return config_source; }
95 config_source = value;
99 public bool ForceSave {
100 get { return force_update; }
101 set { force_update = value; }
104 public bool InheritInChildApplications {
105 get { return inherit_on_child_apps; }
106 set { inherit_on_child_apps = value; }
110 public bool IsDeclarationRequired {
111 get { throw new NotImplementedException (); }
115 public bool IsDeclared {
116 get { return false; }
120 public bool IsLocked {
121 get { return false; }
124 public bool IsProtected {
125 get { return protection_provider != null; }
132 public ProtectedConfigurationProvider ProtectionProvider {
133 get { return protection_provider; }
137 public bool RequirePermission {
138 get { return require_permission; }
139 set { require_permission = value; }
143 public bool RestartOnExternalChanges {
144 get { return restart_on_external_changes; }
145 set { restart_on_external_changes = value; }
149 public string SectionName {
154 get { return type_name; }
156 if (value == null || value.Length == 0)
157 throw new ArgumentException ("Value cannot be null or empty.");
163 public ConfigurationSection GetParentSection ()
168 internal void SetParentSection (ConfigurationSection parent)
170 this.parent = parent;
173 public string GetRawXml ()
178 public void ProtectSection (string protectionProvider)
180 protection_provider = ProtectedConfiguration.GetProvider (protectionProvider, true);
184 public void ForceDeclaration (bool force)
188 public void ForceDeclaration ()
190 ForceDeclaration (true);
194 public void RevertToParent ()
196 throw new NotImplementedException ();
199 public void UnprotectSection ()
201 protection_provider = null;
204 public void SetRawXml (string rawXml)
210 internal void SetName (string name)