Find() 개인적인 메소드

Attempts to find the value associated with the key with given name.
A key with the given name could not be found.
private Find ( string name ) : object
name string The name of the key.
리턴 object
예제 #1
0
        void IGenerator.GetText(Scope scope, TextWriter writer, Scope context)
        {
            object value = _isVariable ? context.Find(_key, _shouldHtmlEscape) : scope.Find(_key, _shouldHtmlEscape);

            if (_shouldHtmlEscape)
            {
                writer.Write(_format, System.Net.WebUtility.HtmlEncode(value as string));
            }
            else
            {
                writer.Write(_format, value);
            }
        }
예제 #2
0
        void IGenerator.GetText(Scope scope, TextWriter writer, Scope context)
        {
            object value       = _isVariable ? context.Find(_key) : scope.Find(_key);
            var    formattable = value as IFormattable;

            if (formattable != null)
            {
                writer.Write(formattable.ToString(null, System.Threading.Thread.CurrentThread.CurrentCulture));
            }
            else
            {
                writer.Write(value);
            }
        }
예제 #3
0
        void IGenerator.GetText(TextWriter writer, Scope scope, Scope context, Action <Substitution> postProcessor)
        {
            object       value        = _isVariable ? context.Find(_key, _isExtension) : scope.Find(_key, _isExtension);
            string       result       = String.Format(writer.FormatProvider, _format, value);
            Substitution substitution = new Substitution()
            {
                Key         = _key,
                Substitute  = result,
                IsExtension = _isExtension
            };

            postProcessor(substitution);
            writer.Write(substitution.Substitute);
        }
 /// <summary>
 /// Substitutes the key placeholders with their respective values.
 /// </summary>
 /// <param name="keyScope">The key/value pairs in the current lexical scope.</param>
 /// <param name="contextScope">The key/value pairs in current context.</param>
 /// <returns>A dictionary associating the parameter name to the associated value.</returns>
 public Dictionary<string, object> GetArguments(Scope keyScope, Scope contextScope)
 {
     Dictionary<string, object> arguments = new Dictionary<string,object>();
     foreach (KeyValuePair<TagParameter, string> pair in _argumentLookup)
     {
         object value;
         if (pair.Value == null)
         {
             value = pair.Key.DefaultValue;
         }
         else if (pair.Value.StartsWith("@"))
         {
             value = contextScope.Find(pair.Value.Substring(1));
         }
         else
         {
             value = keyScope.Find(pair.Value);
         }
         arguments.Add(pair.Key.Name, value);
     }
     return arguments;
 }
예제 #5
0
        /// <summary>
        /// Substitutes the key placeholders with their respective values.
        /// </summary>
        /// <param name="keyScope">The key/value pairs in the current lexical scope.</param>
        /// <param name="contextScope">The key/value pairs in current context.</param>
        /// <returns>A dictionary associating the parameter name to the associated value.</returns>
        public Dictionary <string, object> GetArguments(Scope keyScope, Scope contextScope)
        {
            Dictionary <string, object> arguments = new Dictionary <string, object>();

            foreach (KeyValuePair <TagParameter, string> pair in _argumentLookup)
            {
                object value;
                if (pair.Value == null)
                {
                    value = pair.Key.DefaultValue;
                }
                else if (pair.Value.StartsWith("@"))
                {
                    value = contextScope.Find(pair.Value.Substring(1));
                }
                else
                {
                    value = keyScope.Find(pair.Value);
                }
                arguments.Add(pair.Key.Name, value);
            }
            return(arguments);
        }
예제 #6
0
 public object GetValue(Scope keyScope, Scope contextScope)
 {
     return(keyScope.Find(name));
 }
예제 #7
0
 public object GetValue(Scope keyScope, Scope contextScope)
 {
     return contextScope.Find(name);
 }
        void IGenerator.GetText(Scope scope, TextWriter writer, Scope context)
        {
            object value = _isVariable ? context.Find(_key) : scope.Find(_key);

            writer.Write(_format, value);
        }
예제 #9
0
 void IGenerator.GetText(Scope scope, TextWriter writer, Scope context)
 {
     object value = _isVariable ? context.Find(_key) : scope.Find(_key);
     writer.Write(_format, value);
 }