Inheritance: System.Reflection.MethodInfo
Esempio n. 1
0
        public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
        {
            MethodInfo getter = this.getter;
            JSObject   obj2   = obj as JSObject;

            if ((getter == null) && (obj2 != null))
            {
                getter = obj2.GetMethod("get_" + this.name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                JSWrappedMethod method = getter as JSWrappedMethod;
                if (method != null)
                {
                    getter = method.method;
                }
            }
            if (getter == null)
            {
                getter = this.GetGetMethod(false);
            }
            if (getter != null)
            {
                try
                {
                    return(getter.Invoke(obj, invokeAttr, binder, (index == null) ? new object[0] : index, culture));
                }
                catch (TargetInvocationException exception)
                {
                    throw exception.InnerException;
                }
            }
            return(Microsoft.JScript.Missing.Value);
        }
Esempio n. 2
0
        public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
        {
            MethodInfo setter = this.setter;
            JSObject   obj2   = obj as JSObject;

            if ((setter == null) && (obj2 != null))
            {
                setter = obj2.GetMethod("set_" + this.name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                JSWrappedMethod method = setter as JSWrappedMethod;
                if (method != null)
                {
                    setter = method.method;
                }
            }
            if (setter == null)
            {
                setter = this.GetSetMethod(false);
            }
            if (setter != null)
            {
                if ((index == null) || (index.Length == 0))
                {
                    setter.Invoke(obj, invokeAttr, binder, new object[] { value }, culture);
                }
                else
                {
                    int      length = index.Length;
                    object[] target = new object[length + 1];
                    ArrayObject.Copy(index, 0, target, 0, length);
                    target[length] = value;
                    setter.Invoke(obj, invokeAttr, binder, target, culture);
                }
            }
        }
 internal JSProperty(string name)
 {
     this.name = name;
     this.formal_parameters = null;
     this.getter = null;
     this.setter = null;
 }
Esempio n. 4
0
 internal JSProperty(string name)
 {
     this.name = name;
     this.formal_parameters = null;
     this.getter            = null;
     this.setter            = null;
 }
Esempio n. 5
0
        public override Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
        {
            MethodInfo getter = this.getter;
            JSObject   jsOb   = obj as JSObject;

            if (getter == null && jsOb != null)
            {
                getter = jsOb.GetMethod("get_" + this.name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                JSWrappedMethod wrm = getter as JSWrappedMethod;
                if (wrm != null)
                {
                    getter = wrm.method;
                }
            }
            if (getter == null)
            {
                getter = this.GetGetMethod(false);
            }
            if (getter != null)
            {
                return(getter.Invoke(obj, invokeAttr, binder, index == null ? new Object[0] : index, culture));
            }
            else
            {
                return(Missing.Value);
            }
        }
 public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
 {
     MethodInfo setter = this.setter;
     JSObject obj2 = obj as JSObject;
     if ((setter == null) && (obj2 != null))
     {
         setter = obj2.GetMethod("set_" + this.name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
         JSWrappedMethod method = setter as JSWrappedMethod;
         if (method != null)
         {
             setter = method.method;
         }
     }
     if (setter == null)
     {
         setter = this.GetSetMethod(false);
     }
     if (setter != null)
     {
         if ((index == null) || (index.Length == 0))
         {
             setter.Invoke(obj, invokeAttr, binder, new object[] { value }, culture);
         }
         else
         {
             int length = index.Length;
             object[] target = new object[length + 1];
             ArrayObject.Copy(index, 0, target, 0, length);
             target[length] = value;
             setter.Invoke(obj, invokeAttr, binder, target, culture);
         }
     }
 }
 public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
 {
     MethodInfo getter = this.getter;
     JSObject obj2 = obj as JSObject;
     if ((getter == null) && (obj2 != null))
     {
         getter = obj2.GetMethod("get_" + this.name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
         JSWrappedMethod method = getter as JSWrappedMethod;
         if (method != null)
         {
             getter = method.method;
         }
     }
     if (getter == null)
     {
         getter = this.GetGetMethod(false);
     }
     if (getter != null)
     {
         try
         {
             return getter.Invoke(obj, invokeAttr, binder, (index == null) ? new object[0] : index, culture);
         }
         catch (TargetInvocationException exception)
         {
             throw exception.InnerException;
         }
     }
     return Microsoft.JScript.Missing.Value;
 }
Esempio n. 8
0
 public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) {
   MethodInfo setter = this.setter;
   JSObject jsOb = obj as JSObject;
   if (setter == null && jsOb != null){
     setter = jsOb.GetMethod("set_"+this.name, BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
     JSWrappedMethod wrm = setter as JSWrappedMethod;
     if (wrm != null) setter = wrm.method;
   }
   if (setter == null)
     setter = this.GetSetMethod(false);
   if (setter != null){
     if (index == null || index.Length == 0)
       setter.Invoke(obj, invokeAttr, binder, new Object[]{value}, culture);
     else{
       int n = index.Length;
       Object[] args = new Object[n+1];
       ArrayObject.Copy(index, 0, args, 0, n); 
       args[n] = value;
       setter.Invoke(obj, invokeAttr, binder, args, culture);
     }
   }
 }
Esempio n. 9
0
 public override Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture){
   MethodInfo getter = this.getter;
   JSObject jsOb = obj as JSObject;
   if (getter == null && jsOb != null){
     getter = jsOb.GetMethod("get_"+this.name, BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
     JSWrappedMethod wrm = getter as JSWrappedMethod;
     if (wrm != null) getter = wrm.method;
   }
   if (getter == null)
     getter = this.GetGetMethod(false);
   if (getter != null)
     return getter.Invoke(obj, invokeAttr, binder, index == null ? new Object[0] : index, culture);
   else
     return Missing.Value;
 }