Пример #1
0
 public MethodMarshalContext(MethodInfo og, int slot, MethodBuilder dest, ParameterMarshalContext ret,
                             ParameterMarshalContext[] parameters,
                             Action <MethodBuilder, ParameterMarshalContext, ParameterMarshalContext[], ILGenerator> emitNativeCall)
 {
     _emitNativeCall = emitNativeCall;
     Slot            = slot;
     PreviousMethod  = og;
     Method          = dest;
     ReturnParameter = ret;
     Parameters      = parameters;
 }
Пример #2
0
        private                        ParameterMarshalContext[] CreateParameters(Type[] types, CustomAttributeBuilder[][] attributes,
                                                                                  Type[][] requiredModifiers, Type[][] optionalModifiers,
                                                                                  CustomAttributeData[][] originalAttributes, ParameterAttributes[] ogAttrs)
        {
            var ret = new ParameterMarshalContext[types.Length];

            for (var i = 0; i < types.Length; i++)
            {
                ret[i] = new ParameterMarshalContext(types[i], attributes[i], originalAttributes[i],
                                                     requiredModifiers[i], optionalModifiers[i], ogAttrs[i]);
            }

            return(ret);
        }
Пример #3
0
 public void EmitNativeCall(ParameterMarshalContext returnCtx, ParameterMarshalContext[] parameterCtx,
                            ILGenerator il) =>
 _emitNativeCall(Method, returnCtx, parameterCtx, il);
Пример #4
0
 public static UnmanagedType?GetUnmanagedType(this ParameterMarshalContext info) =>
 info.OriginalAttributes.Select(x => x.CreateAttribute() as MarshalAsAttribute)
 .FirstOrDefault(x => !(x is null))?.Value;