Exemple #1
0
        /// <summary>
        /// Loads configuration.
        /// </summary>
        public void Load()
        {
            _Sections.Clear();

            if (!File.Exists(_Path))
            {
                return;
            }

            XmlDocument lXml = new XmlDocument();

            lXml.Load(_Path);

            foreach (XmlElement lXmlSection in lXml.DocumentElement.ChildNodes)
            {
                switch (lXmlSection.Attributes["type"].Value)
                {
                case "controller":
                    ConfigurationController lSectionController = new ConfigurationController(this, lXmlSection);
                    _Sections.Add(lSectionController);
                    break;

                case "layout":
                    ConfigurationLayout lSectionLayout = new ConfigurationLayout(this, lXmlSection);
                    _Sections.Add(lSectionLayout);
                    break;

                case "plugininstance":
                case "custom":
                default:
                    throw new Exception("Unknown configuration section type " + lXmlSection.Attributes["type"].Value + ".");
                }
            }
        }
        /// <summary>
        /// Loads configuration.
        /// </summary>
        public void Load()
        {
            _Sections.Clear();

              if (!File.Exists(_Path)) { return; }

              XmlDocument lXml = new XmlDocument();
              lXml.Load(_Path);

              foreach (XmlElement lXmlSection in lXml.DocumentElement.ChildNodes)
              {
            switch (lXmlSection.Attributes["type"].Value)
            {
              case "controller":
            ConfigurationController lSectionController = new ConfigurationController(this, lXmlSection);
            _Sections.Add(lSectionController);
            break;

              case "layout":
            ConfigurationLayout lSectionLayout = new ConfigurationLayout(this, lXmlSection);
            _Sections.Add(lSectionLayout);
            break;

              case "plugininstance":
              case "custom":
              default:
            throw new Exception("Unknown configuration section type " + lXmlSection.Attributes["type"].Value + ".");
            }
              }
        }