예제 #1
0
        private static PatternConfig LoadPatternConfig(XmlNode patternNode, FilesingConfig filesingConfig)
        {
            Regex regex = null;
            List <IgnoreConfig>  ignoreConfigs  = new List <IgnoreConfig>();
            List <RequireConfig> requireConfigs = new List <RequireConfig>();

            foreach (XmlNode childNode in patternNode.ChildNodes)
            {
                if (childNode.Name.EqualsIgnoreCase(regexNode))
                {
                    // Patterns will always default to ignoring case.
                    regex = CreateRegexFromXmlNode(childNode, true);
                }
                else if (childNode.Name.EqualsIgnoreCase(ignoreListNode))
                {
                    IgnoreConfig ignoreConfig = LoadIgnoreConfig(childNode, filesingConfig);
                    ignoreConfigs.Add(ignoreConfig);
                }
                else if (childNode.Name.EqualsIgnoreCase(requirementsListNode))
                {
                    RequireConfig requireConfig = LoadRequireConfig(childNode, filesingConfig);
                    requireConfigs.Add(requireConfig);
                }
            }

            return(new PatternConfig(regex, ignoreConfigs, requireConfigs));
        }
예제 #2
0
        private static RequireConfig LoadRequireConfig(XmlNode requireNode, FilesingConfig filesingConfig)
        {
            RequireConfig config = new RequireConfig();

            foreach (XmlNode childNode in requireNode.ChildNodes)
            {
                // Parse specific file to require
                if (childNode.Name.EqualsIgnoreCase(requireFileNode))
                {
                    config.AddRequiredFile(
                        Path.Combine(filesingConfig.SearchDirectoryLocation, childNode.InnerText)
                        );
                }
                // Parse specific dir to require.
                else if (childNode.Name.EqualsIgnoreCase(requireDirNode))
                {
                    config.AddRequiredDir(
                        Path.Combine(filesingConfig.SearchDirectoryLocation, childNode.InnerText)
                        );
                }
            }

            return(config);
        }