Example #1
0
        public static object LateCall(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, bool IgnoreReturn)
        {
            if (Arguments == null)
            {
                Arguments = Symbols.NoArguments;
            }
            if (ArgumentNames == null)
            {
                ArgumentNames = Symbols.NoArgumentNames;
            }
            if (TypeArguments == null)
            {
                TypeArguments = Symbols.NoTypeArguments;
            }
            Symbols.Container BaseReference = Type == null ? new Symbols.Container(Instance) : new Symbols.Container(Type);
            if (BaseReference.IsCOMObject)
            {
                return(LateBinding.InternalLateCall(Instance, Type, MemberName, Arguments, ArgumentNames, CopyBack, IgnoreReturn));
            }
            BindingFlags InvocationFlags = BindingFlags.InvokeMethod | BindingFlags.GetProperty;

            if (IgnoreReturn)
            {
                InvocationFlags |= BindingFlags.IgnoreReturn;
            }
            OverloadResolution.ResolutionFailure Failure = OverloadResolution.ResolutionFailure.None;
            return(NewLateBinding.CallMethod(BaseReference, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack, InvocationFlags, true, ref Failure));
        }
Example #2
0
 internal static object InternalLateIndexGet(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container BaseReference = new Symbols.Container(Instance);
     if (BaseReference.IsCOMObject)
     {
         return(LateBinding.LateIndexGet(Instance, Arguments, ArgumentNames));
     }
     if (!BaseReference.IsArray)
     {
         return(NewLateBinding.CallMethod(BaseReference, "", Arguments, ArgumentNames, Symbols.NoTypeArguments, (bool[])null, BindingFlags.InvokeMethod | BindingFlags.GetProperty, ReportErrors, ref Failure));
     }
     if (ArgumentNames.Length <= 0)
     {
         return(BaseReference.GetArrayValue(Arguments));
     }
     Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
     if (ReportErrors)
     {
         throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
     }
     return((object)null);
 }