Exemplo n.º 1
0
        /// <summary>
        /// Expands the value.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="definition">The definition.</param>
        /// <returns></returns>
        public string ExpandedValue(TagContext context, string definition)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (definition == null)
            {
                return(Include);
            }

            return(TagExpander.KeyOrPropertyRegex.Replace(definition, delegate(Match match)
            {
                Group g;

                if (null != (g = match.Groups[TagExpander.RegexGroupKey]) && g.Success)
                {
                    Group gg = match.Groups[TagExpander.RegexGroupItemPrefix];

                    if (gg != null && gg.Success)
                    {
                        throw new NotImplementedException();
                    }

                    if (Keys.Contains(g.Value))
                    {
                        return Keys[g.Value].ExpandedValue();
                    }
                    else
                    {
                        return "";
                    }
                }
                else if (null != (g = match.Groups[TagExpander.RegexGroupProperty]))
                {
                    if (context.Properties.Contains(g.Value))
                    {
                        return context.Properties[g.Value].ExpandedValue();
                    }
                    else
                    {
                        return "";
                    }
                }
                else
                {
                    return "";
                }
            }));
        }
Exemplo n.º 2
0
        internal TagBatchInstance(TagContext context, TagBatchDefinition definition)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }

            _definition = definition;
            _context    = context;
            _values     = new object[definition.ItemCount];
        }