Exemple #1
0
        public void AddExtension(Selector selector, Extend extends, Env env)
        {
            foreach (var extending in extends.Exact)
            {
                Extender match = null;
                if ((match = _extensions.OfType <ExactExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null)
                {
                    match = new ExactExtender(extending, extends);
                    _extensions.Add(match);
                }

                match.AddExtension(selector, env);
            }

            foreach (var extending in extends.Partial)
            {
                Extender match = null;
                if ((match = _extensions.OfType <PartialExtender>().FirstOrDefault(e => e.BaseSelector.ToString().Trim() == extending.ToString().Trim())) == null)
                {
                    match = new PartialExtender(extending, extends);
                    _extensions.Add(match);
                }

                match.AddExtension(selector, env);
            }

            if (Parent != null)
            {
                Parent.AddExtension(selector, extends, env);
            }
        }
Exemple #2
0
        public void AddExtension(Selector selector, IEnumerable <Selector> extends)
        {
            Extender match = null;

            foreach (var extending in extends)
            {
                if ((match = _extensions.FirstOrDefault(e => e.BaseSelector.Match(extending))) == null)
                {
                    match = new Extender(extending);
                    _extensions.Add(match);
                }

                match.AddExtension(selector);
            }
        }