Copy from 72246 to trunk
[mono.git] / mcs / class / System.Configuration / System.Configuration / SectionInfo.cs
index 63ede7f880a477a7384cb00b9cbe2f385914ca65..cb3a2a1c9f8185572885481ac2520932c4cb1d8c 100644 (file)
@@ -38,7 +38,8 @@ namespace System.Configuration
        internal class SectionInfo: ConfigInfo
        {
                bool allowLocation = true;
-               bool? requirePermission = true;
+               bool requirePermission = true;
+               bool restartOnExternalChanges;
                ConfigurationAllowDefinition allowDefinition = ConfigurationAllowDefinition.Everywhere;
                ConfigurationAllowExeDefinition allowExeDefinition = ConfigurationAllowExeDefinition.MachineToApplication;
 
@@ -54,6 +55,7 @@ namespace System.Configuration
                        this.allowDefinition = info.AllowDefinition;
                        this.allowExeDefinition = info.AllowExeDefinition;
                        this.requirePermission = info.RequirePermission;
+                       this.restartOnExternalChanges = info.RestartOnExternalChanges;
                }
                
                public override object CreateInstance ()
@@ -64,8 +66,8 @@ namespace System.Configuration
                                sec.SectionInformation.AllowLocation = allowLocation;
                                sec.SectionInformation.AllowDefinition = allowDefinition;
                                sec.SectionInformation.AllowExeDefinition = allowExeDefinition;
-                               if (requirePermission != null)
-                                       sec.SectionInformation.RequirePermission = requirePermission.Value;
+                               sec.SectionInformation.RequirePermission = requirePermission;
+                               sec.SectionInformation.RestartOnExternalChanges = restartOnExternalChanges;
                                sec.SectionInformation.SetName (Name);
                        }
                        return ob;
@@ -134,6 +136,14 @@ namespace System.Configuration
                                                requirePermission = reqPermValue;
                                                break;
 
+                                       case "restartOnExternalChanges":
+                                               string restart = reader.Value;
+                                               bool restartValue = (restart == "true");
+                                               if (!restartValue && restart != "false")
+                                                       ThrowException ("Invalid attribute value", reader);
+                                               restartOnExternalChanges = restartValue;
+                                               break;
+
                                        default:
                                                ThrowException (String.Format ("Unrecognized attribute: {0}", reader.Name), reader);
                                                break;
@@ -158,8 +168,8 @@ namespace System.Configuration
                                writer.WriteAttributeString ("allowDefinition", allowDefinition.ToString ());
                        if (allowExeDefinition != ConfigurationAllowExeDefinition.MachineToApplication)
                                writer.WriteAttributeString ("allowExeDefinition", allowExeDefinition.ToString ());
-                       if (requirePermission != null)
-                               writer.WriteAttributeString ("requirePermission", requirePermission.Value ? "true" : "false");
+                       if (!requirePermission)
+                               writer.WriteAttributeString ("requirePermission", "false");
                        writer.WriteEndElement ();
                }
                
@@ -208,6 +218,9 @@ namespace System.Configuration
                                tr.Close ();*/
                        }
                }
+               
+               internal override void Merge (ConfigInfo data)
+               {}
        }
 }