Exemplo n.º 1
0
        public MemberRename(object instance, string original, string newName)
        {
            Instance = instance;
              oldMember = RuntimeHost.Binder.BindToMember(instance, original, true);
              if (oldMember == null)
            throw new ScriptIdNotFoundException(original);

              this.newName = newName;
              this.original = original;
        }
Exemplo n.º 2
0
        public override IMemberBind GetMember(string name, params object[] arguments)
        {
            IMemberBind bind = RuntimeHost.Binder.BindToMember(instance, name, true);

            if (bind != null)
            {
                return(bind);
            }

            return(base.GetMember(name, arguments));
        }
Exemplo n.º 3
0
 public void AssignTo(object target)
 {
     foreach (string field in Fields)
     {
         IMemberBind bind = RuntimeHost.Binder.BindToMember(target, field, false);
         if (bind != null)
         {
             bind.SetValue(fields[field]);
         }
         //RuntimeHost.Binder.Set(field, target, fields[field], false);
     }
 }
Exemplo n.º 4
0
        public MemberRename(object instance, string original, string newName)
        {
            Instance  = instance;
            oldMember = RuntimeHost.Binder.BindToMember(instance, original, true);
            if (oldMember == null)
            {
                throw new ScriptIdNotFoundException(original);
            }

            this.newName  = newName;
            this.original = original;
        }
Exemplo n.º 5
0
        private static object GetMemberValue(object obj, string memberInfo)
        {
            IMemberBind bind = RuntimeHost.Binder.BindToMember(obj, memberInfo, true);

            if (bind == null)
            {
                throw new ScriptIdNotFoundException(memberInfo);
            }

            return(bind.GetValue());

            //return RuntimeHost.Binder.Get(memberInfo, obj);
        }
Exemplo n.º 6
0
        private void SetMember(IScriptContext context, object obj, object value)
        {
            IMemberBind bind = RuntimeHost.Binder.BindToMember(obj, Identifier, true);

            if (bind == null)
            {
                throw new ScriptIdNotFoundException(Identifier);
            }

            bind.SetValue(value);
            context.Result = value;

            //Context.Result = RuntimeHost.Binder.Set(Identifier, obj, value);
        }