Exemple #1
0
 public void CopyObjects(InputContext target)
 {
     foreach (var kvp in Objects)
     {
         target.SetObject(kvp.Key, kvp.Value);
     }
 }
Exemple #2
0
 public bool SetObject(string name, InputObject obj, bool originator = true)
 {
     if (originator)
     {
         name = name.ToLower();
     }
     if (!Objects.TryGetValue(name, out InputObject var))
     {
         // if we don't find a var in our own scope, check further up the scope tree
         if (ParentScope != null && ParentScope.SetObject(name, obj, false))
         {
             return(true);
         }
         if (originator) // if it isn't found anywhere, define it
         {
             Objects[name] = obj;
         }
         return(false);
     }
     Objects[name] = obj;
     return(true);
 }