Exemple #1
0
        internal void Set(string key, object value)
        {
            SearchResults results = tryFind(key);

            set(results, value);
        }
Exemple #2
0
 private SearchResults tryFind(string name)
 {
     SearchResults results = new SearchResults();
     results.Members = name.Split('.');
     results.MemberIndex = 0;
     if (results.Member == "this")
     {
         results.Found = true;
         results.Lookup = toLookup(_source);
         results.Value = _source;
     }
     else
     {
         tryFindFirst(results);
     }
     for (int index = 1; results.Found && index < results.Members.Length; ++index)
     {
         results.Lookup = toLookup(results.Value);
         results.MemberIndex = index;
         object value;
         results.Found = results.Lookup.TryGetValue(results.Member, out value);
         results.Value = value;
     }
     return results;
 }
Exemple #3
0
 private void tryFindFirst(SearchResults results)
 {
     results.Lookup = toLookup(_source);
     object value;
     if (results.Lookup.TryGetValue(results.Member, out value))
     {
         results.Found = true;
         results.Value = value;
         return;
     }
     if (_parent == null)
     {
         results.Found = false;
         results.Value = null;
         return;
     }
     _parent.tryFindFirst(results);
 }
Exemple #4
0
 private void set(SearchResults results, object value)
 {
     // handle setting value in child scope
     while (results.MemberIndex < results.Members.Length - 1)
     {
         Dictionary<string, object> context = new Dictionary<string, object>();
         results.Value = context;
         results.Lookup[results.Member] = results.Value;
         results.Lookup = context;
         ++results.MemberIndex;
     }
     results.Lookup[results.Member] = value;
 }