示例#1
0
        /// <summary>
        /// Loads the settings from the document.
        /// </summary>
        private void LoadSettingsDocument()
        {
            // Reinitialize the settings collections.
            this.globalSettings.Clear();
            this.parserSettings.Clear();
            this.analyzerSettings.Clear();

            if (this.contents != null)
            {
                // Check the version number of the file.
                XmlAttribute versionAttribute = this.contents.DocumentElement.Attributes["Version"];
                string       version          = versionAttribute == null ? string.Empty : versionAttribute.Value;
                if (string.Equals(version, "5.0", StringComparison.Ordinal))
                {
                    V50Settings.Load(this.contents, this);
                }
                else if (string.Equals(version, "4.3", StringComparison.Ordinal))
                {
                    V43Settings.Load(this.contents, this);
                }
                else if (string.Equals(version, "4.2", StringComparison.Ordinal))
                {
                    V42Settings.Load(this.contents, this);
                }
                else if (string.Equals(version, "4.1", StringComparison.Ordinal))
                {
                    V41Settings.Load(this.contents, this);
                }
                else
                {
                    V40Settings.Load(this.contents, this);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Loads files specified in file lists.
        /// </summary>
        /// <param name="documentRoot">The root node of the settings document.</param>
        /// <param name="settings">Stores the settings.</param>
        private static void LoadFileLists(XmlNode documentRoot, Settings settings)
        {
            Param.AssertNotNull(documentRoot, "documentRoot");
            Param.AssertNotNull(settings, "settings");

            XmlNodeList fileListNodes = documentRoot.SelectNodes("SourceFileList");

            foreach (XmlNode fileListNode in fileListNodes)
            {
                XmlNodeList fileNodes = fileListNode.SelectNodes("SourceFile");
                if (fileNodes.Count > 0)
                {
                    Settings settingsForFileList = new Settings(settings.Core);

                    XmlNode settingsNode = fileListNode.SelectSingleNode("Settings");
                    if (settingsNode != null)
                    {
                        V50Settings.Load(settingsNode, settingsForFileList);
                    }

                    SourceFileListSettings sourceFileListSettings = new SourceFileListSettings(settingsForFileList);

                    foreach (XmlNode fileNode in fileNodes)
                    {
                        if (!string.IsNullOrEmpty(fileNode.InnerText))
                        {
                            sourceFileListSettings.AddFile(fileNode.InnerText);
                        }
                    }

                    settings.AddSourceFileList(sourceFileListSettings);
                }
            }
        }