Exemple #1
0
        private void ParseConfiguration(XElement configElem, Configuration config, ConfigurationHolder holder)
        {
            handleImport(configElem, (XElement elem) => {
                ParseConfiguration(elem, config, holder);
            });

            foreach (XElement elem in configElem.Elements())
            {
                if (elem.Name.LocalName.ToLower() == "compile")
                {
                    var cfg           = config;
                    var patternAttrib = elem.Attribute("files");
                    if (patternAttrib != null)
                    {
                        string sourceRoot = holder.SourceRootRelative();
                        if (sourceRoot == null)
                        {
                            sourceRoot = m_currentWorkingDirectory;
                        }

                        string            pattern = Path.Combine(sourceRoot, (string)patternAttrib);
                        ConfigurationRule rule    = holder.FindOrCreateRule(pattern);
                        cfg = new Configuration(config.Name);
                        if (config.IsShared)
                        {
                            rule.SetSharedConfiguration(cfg);
                        }
                        else
                        {
                            rule.AddConfiguration(cfg);
                        }
                    }

                    ParseCompileOptions(elem, cfg);
                }
                else if (elem.Name.LocalName.ToLower() == "link")
                {
                    foreach (XElement linkElem in elem.Elements())
                    {
                        if (!config.AddLinkOption(linkElem.Name.LocalName, (string)linkElem.Value))
                        {
                            m_errors = true;
                        }
                    }
                }
                else if (!config.AddOption(elem.Name.LocalName, (string)elem.Value))
                {
                    m_errors = true;
                }
            }
        }
Exemple #2
0
        public ConfigurationRule FindOrCreateRule(string pattern)
        {
            foreach (ConfigurationRule config in ConfigurationRules)
            {
                if (config.WildcardPattern == pattern)
                {
                    return(config);
                }
            }

            ConfigurationRule rule = new ConfigurationRule(pattern);

            ConfigurationRules.Add(rule);
            return(rule);
        }