public override void CallAsFunction(int methodNumber, IValue[] arguments, out IValue retValue)
        {
            var method = _methods[methodNumber];

            if (!(method.IsFunction ?? true))
            {
                throw RuntimeException.UseProcAsAFunction();
            }

            var dispId = method.DispatchId;

            try
            {
                try
                {
                    var result = DispatchUtility.Invoke(Instance, dispId, MarshalArguments(arguments));
                    retValue = CreateIValue(result);
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    throw e.InnerException ?? e;
                }
            }
            catch (System.MissingMemberException)
            {
                throw RuntimeException.MethodNotFoundException(method.Name);
            }
        }
        public override IValue GetPropValue(int propNum)
        {
            var prop = _props[propNum];

            var dispId = prop.DispatchId;

            try
            {
                try
                {
                    var result = DispatchUtility.Invoke(Instance, dispId, null);
                    return(CreateIValue(result));
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    throw e.InnerException ?? e;
                }
            }
            catch (System.MissingMemberException)
            {
                throw RuntimeException.PropNotFoundException(prop.Name);
            }
            catch (System.MemberAccessException)
            {
                throw RuntimeException.PropIsNotReadableException(prop.Name);
            }
        }
Пример #3
0
 public override void CallAsProcedure(int methodNumber, IValue[] arguments)
 {
     try
     {
         try
         {
             DispatchUtility.Invoke(_instance, methodNumber, MarshalArguments(arguments));
         }
         catch (System.Reflection.TargetInvocationException e)
         {
             throw e.InnerException;
         }
     }
     catch (System.MissingMemberException)
     {
         throw RuntimeException.MethodNotFoundException("dispid[" + methodNumber.ToString() + "]");
     }
 }
Пример #4
0
 public override void CallAsFunction(int methodNumber, IValue[] arguments, out IValue retValue)
 {
     try
     {
         try
         {
             var result = DispatchUtility.Invoke(_instance, methodNumber, MarshalArguments(arguments));
             retValue = CreateIValue(result);
         }
         catch (System.Reflection.TargetInvocationException e)
         {
             throw e.InnerException;
         }
     }
     catch (System.MissingMemberException)
     {
         throw RuntimeException.MethodNotFoundException("dispid[" + methodNumber.ToString() + "]");
     }
 }
        public override void CallAsProcedure(int methodNumber, IValue[] arguments)
        {
            var method = _methods[methodNumber];

            var dispId = method.DispatchId;

            try
            {
                try
                {
                    DispatchUtility.Invoke(Instance, dispId, MarshalArguments(arguments));
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    throw e.InnerException ?? e;
                }
            }
            catch (System.MissingMemberException)
            {
                throw RuntimeException.MethodNotFoundException(method.Name);
            }
        }
Пример #6
0
 public override IValue GetPropValue(int propNum)
 {
     try
     {
         try
         {
             var result = DispatchUtility.Invoke(_instance, propNum, null);
             return(CreateIValue(result));
         }
         catch (System.Reflection.TargetInvocationException e)
         {
             throw e.InnerException;
         }
     }
     catch (System.MissingMemberException)
     {
         throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]");
     }
     catch (System.MemberAccessException)
     {
         throw RuntimeException.PropIsNotReadableException("dispid[" + propNum.ToString() + "]");
     }
 }