Ejemplo n.º 1
0
        public override void WriteConfig(Configuration cfg, XmlWriter writer, ConfigurationSaveMode mode)
        {
            if (Name != null)
            {
                writer.WriteStartElement("sectionGroup");
                writer.WriteAttributeString("name", Name);
                if (TypeName != null && TypeName != "" && TypeName != "System.Configuration.ConfigurationSectionGroup")
                {
                    writer.WriteAttributeString("type", TypeName);
                }
            }
            else
            {
                writer.WriteStartElement("configSections");
            }

            foreach (ConfigInfoCollection col in new object[] { Sections, Groups })
            {
                foreach (string key in col)
                {
                    ConfigInfo cinfo = col [key];
                    if (cinfo.HasConfigContent(cfg))
                    {
                        cinfo.WriteConfig(cfg, writer, mode);
                    }
                }
            }

            writer.WriteEndElement();
        }
Ejemplo n.º 2
0
 public override bool HasConfigContent(Configuration cfg)
 {
     if (StreamName == cfg.FileName)
     {
         return(true);
     }
     foreach (ConfigInfoCollection col in new object[] { Sections, Groups })
     {
         foreach (string key in col)
         {
             ConfigInfo cinfo = col [key];
             if (cinfo.HasConfigContent(cfg))
             {
                 return(true);
             }
         }
     }
     return(false);
 }