Exemple #1
0
        private void ReadDirectives(MixedContentFile file)
        {
            // Initialize directives:
            this.directives = new Dictionary<string, IList<NameValueCollection>>();

            // Collect directives:
            foreach (ContentPart part in file.FindPartsOfType(TemplatePartTypes.Declaration))
            {
                foreach (Match match in directiveParser.Matches(part.Content))
                {
                    string name = match.Groups["elementName"].Value;
                    NameValueCollection attributes = new NameValueCollection();
                    for (int i = 0; i < match.Groups["name"].Captures.Count; i++)
                    {
                        attributes[match.Groups["name"].Captures[i].Value]
                            = match.Groups["value"].Captures[i].Value;
                    }
                    if (this.directives.ContainsKey(name) == false)
                        this.directives[name] = new List<NameValueCollection>();
                    this.directives[name].Add(attributes);
                }
            }
        }