Exemplo n.º 1
0
        /// <summary>  renders the value of the string literal
        /// If the properties allow, and the string literal contains a $ or a #
        /// the literal is rendered against the context
        /// Otherwise, the stringlit is returned.
        /// </summary>
        public override Object Value(IInternalContextAdapter context)
        {
            string result = image;

            if (IsDictionaryString(result))
            {
                return(InterpolateDictionaryString(result, context));
            }
            else
            {
                if (interpolate)
                {
                    try
                    {
                        TextWriter writer = new StringWriter();
                        nodeTree.Render(context, writer);

                        /*
                         * and return the result as a String
                         */

                        String ret = writer.ToString();

                        /*
                         *  remove the space from the end (dreaded <MORE> kludge)
                         */

                        result = ret.Substring(0, (ret.Length - 1) - (0));
                    }
                    catch (System.Exception e)
                    {
                        runtimeServices.Error(string.Format("Error in interpolating string literal : {0}", e));
                        result = image;
                    }
                }

                return(result);
            }
        }