private object EvaluateInPlace(string content, IInternalContextAdapter context)
        {
            try
            {
                SimpleNode inlineNode = runtimeServices.Parse(new StringReader(content), context.CurrentTemplateName, false);

                inlineNode.Init(context, runtimeServices);

                return(Evaluate(inlineNode, context));
            }
            catch (Exception)
            {
                throw new ArgumentException(string.Format("Problem evaluating dictionary entry with content {0}", content));
            }
        }
Exemplo n.º 2
0
        /* Override this method if you want to customize how the node dumps
         * out its children. */

        public void Dump(String prefix)
        {
            Console.Out.WriteLine(ToString(prefix));
            if (children != null)
            {
                for (int i = 0; i < children.Length; ++i)
                {
                    SimpleNode n = (SimpleNode)children[i];
                    if (n != null)
                    {
                        n.Dump(string.Format("{0} ", prefix));
                    }
                }
            }
        }
        /// <summary>
        /// Evaluate the node.
        /// </summary>
        public override Object Value(IInternalContextAdapter context)
        {
            int size = ChildrenCount;

            IDictionary objectMap = new Hashtable();

            for (int i = 0; i < size; i += 2)
            {
                SimpleNode keyNode   = (SimpleNode)GetChild(i);
                SimpleNode valueNode = (SimpleNode)GetChild(i + 1);

                Object key   = (keyNode == null ? null : keyNode.Value(context));
                Object value = (valueNode == null ? null : valueNode.Value(context));

                objectMap.Add(key, value);
            }

            return(objectMap);
        }