internal sealed override RuntimeParameterInfo[] GetRuntimeParametersAndReturn(RuntimeMethodInfo contextMethod) { return _genericMethodDefinition.GetRuntimeParametersAndReturn(this); }
internal String ComputeToString(RuntimeMethodInfo contextMethod) { return _common.ComputeToString(contextMethod, contextMethod.RuntimeGenericArgumentsOrParameters); }
internal sealed override RuntimeParameterInfo[] GetRuntimeParametersAndReturn(RuntimeMethodInfo contextMethod) { return _common.GetRuntimeParametersAndReturn(contextMethod, contextMethod.RuntimeGenericArgumentsOrParameters); }
internal sealed override RuntimeParameterInfo[] GetRuntimeParametersAndReturn(RuntimeMethodInfo contextMethod) { RuntimeParameterInfo[] runtimeParametersAndReturn = _lazyRuntimeParametersAndReturn; if (runtimeParametersAndReturn == null) { runtimeParametersAndReturn = new RuntimeParameterInfo[_runtimeParameterTypesAndReturn.Length]; for (int i = 0; i < runtimeParametersAndReturn.Length; i++) { runtimeParametersAndReturn[i] = RuntimeSyntheticParameterInfo.GetRuntimeSyntheticParameterInfo(this, i - 1, _runtimeParameterTypesAndReturn[i]); } _lazyRuntimeParametersAndReturn = runtimeParametersAndReturn; } return runtimeParametersAndReturn; }
internal sealed override RuntimeParameterInfo[] GetRuntimeParameters(RuntimeMethodInfo contextMethod, out RuntimeParameterInfo returnParameter) { RuntimeTypeInfo[] runtimeParameterTypes = _runtimeParameterTypes; RuntimeParameterInfo[] parameters = new RuntimeParameterInfo[runtimeParameterTypes.Length]; for (int i = 0; i < parameters.Length; i++) { parameters[i] = RuntimeSyntheticParameterInfo.GetRuntimeSyntheticParameterInfo(this, i, runtimeParameterTypes[i]); } returnParameter = RuntimeSyntheticParameterInfo.GetRuntimeSyntheticParameterInfo(this, -1, _returnType); return parameters; }
public static bool IsSoapActionValidForMethodBase(string soapAction, MethodBase mb) { if (mb == (MethodBase)null) { throw new ArgumentNullException("mb"); } if ((int)soapAction[0] == 34) { string str = soapAction; int index = str.Length - 1; if ((int)str[index] == 34) { soapAction = soapAction.Substring(1, soapAction.Length - 2); } } if (string.CompareOrdinal(((SoapMethodAttribute)InternalRemotingServices.GetCachedSoapAttribute((object)mb)).SoapAction, soapAction) == 0) { return(true); } string strA = (string)SoapServices._methodBaseToSoapAction[(object)mb]; if (strA != null && string.CompareOrdinal(strA, soapAction) == 0) { return(true); } string[] strArray = soapAction.Split('#'); if (strArray.Length != 2) { return(false); } bool assemblyIncluded; string soapActionNamespace = XmlNamespaceEncoder.GetTypeNameForSoapActionNamespace(strArray[0], out assemblyIncluded); if (soapActionNamespace == null) { return(false); } string str1 = strArray[1]; RuntimeMethodInfo runtimeMethodInfo = mb as RuntimeMethodInfo; RuntimeConstructorInfo runtimeConstructorInfo = mb as RuntimeConstructorInfo; RuntimeModule runtimeModule; if ((MethodInfo)runtimeMethodInfo != (MethodInfo)null) { runtimeModule = runtimeMethodInfo.GetRuntimeModule(); } else { if (!((ConstructorInfo)runtimeConstructorInfo != (ConstructorInfo)null)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject")); } runtimeModule = runtimeConstructorInfo.GetRuntimeModule(); } string str2 = mb.DeclaringType.FullName; if (assemblyIncluded) { str2 = str2 + ", " + runtimeModule.GetRuntimeAssembly().GetSimpleName(); } if (str2.Equals(soapActionNamespace)) { return(mb.Name.Equals(str1)); } return(false); }
internal VarArgMethod(RuntimeMethodInfo method, SignatureHelper signature) { m_method = method; m_signature = signature; }
internal abstract RuntimeParameterInfo[] GetRuntimeParameters(RuntimeMethodInfo contextMethod, out RuntimeParameterInfo returnParameter);
[System.Security.SecurityCritical] // auto-generated internal static Attribute GetCustomAttribute(RuntimeMethodInfo method) { if ((method.Attributes & MethodAttributes.PinvokeImpl) == 0) { return(null); } #if !MONO MetadataImport scope = ModuleHandle.GetMetadataImport(method.Module.ModuleHandle.GetRuntimeModule()); #endif string entryPoint, dllName = null; int token = method.MetadataToken; PInvokeAttributes flags = 0; #if MONO ((RuntimeMethodInfo)method).GetPInvoke(out flags, out entryPoint, out dllName); #else scope.GetPInvokeMap(token, out flags, out entryPoint, out dllName); #endif CharSet charSet = CharSet.None; switch (flags & PInvokeAttributes.CharSetMask) { case PInvokeAttributes.CharSetNotSpec: charSet = CharSet.None; break; case PInvokeAttributes.CharSetAnsi: charSet = CharSet.Ansi; break; case PInvokeAttributes.CharSetUnicode: charSet = CharSet.Unicode; break; case PInvokeAttributes.CharSetAuto: charSet = CharSet.Auto; break; // Invalid: default to CharSet.None default: break; } CallingConvention callingConvention = CallingConvention.Cdecl; switch (flags & PInvokeAttributes.CallConvMask) { case PInvokeAttributes.CallConvWinapi: callingConvention = CallingConvention.Winapi; break; case PInvokeAttributes.CallConvCdecl: callingConvention = CallingConvention.Cdecl; break; case PInvokeAttributes.CallConvStdcall: callingConvention = CallingConvention.StdCall; break; case PInvokeAttributes.CallConvThiscall: callingConvention = CallingConvention.ThisCall; break; case PInvokeAttributes.CallConvFastcall: callingConvention = CallingConvention.FastCall; break; // Invalid: default to CallingConvention.Cdecl default: break; } bool exactSpelling = (flags & PInvokeAttributes.NoMangle) != 0; bool setLastError = (flags & PInvokeAttributes.SupportsLastError) != 0; bool bestFitMapping = (flags & PInvokeAttributes.BestFitMask) == PInvokeAttributes.BestFitEnabled; bool throwOnUnmappableChar = (flags & PInvokeAttributes.ThrowOnUnmappableCharMask) == PInvokeAttributes.ThrowOnUnmappableCharEnabled; bool preserveSig = (method.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0; return(new DllImportAttribute( dllName, entryPoint, charSet, exactSpelling, setLastError, preserveSig, callingConvention, bestFitMapping, throwOnUnmappableChar)); }
internal static bool IsDefined(RuntimeMethodInfo method) { return((method.Attributes & MethodAttributes.PinvokeImpl) != 0); }
internal static bool IsDefined(RuntimeMethodInfo method) { return((method.GetMethodImplementationFlags() & MethodImplAttributes.PreserveSig) != 0); }
// // // Token resolution calls // // public override void Emit(OpCode opcode, MethodInfo meth) { if (meth == null) { throw new ArgumentNullException(nameof(meth)); } int stackchange = 0; int token = 0; DynamicMethod dynMeth = meth as DynamicMethod; if (dynMeth == null) { RuntimeMethodInfo rtMeth = meth as RuntimeMethodInfo; if (rtMeth == null) { throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(meth)); } RuntimeType declaringType = rtMeth.GetRuntimeType(); if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray)) { token = GetTokenFor(rtMeth, declaringType); } else { token = GetTokenFor(rtMeth); } } else { // rule out not allowed operations on DynamicMethods if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn)) { throw new ArgumentException(SR.Argument_InvalidOpCodeOnDynamicMethod); } token = GetTokenFor(dynMeth); } EnsureCapacity(7); InternalEmit(opcode); if (opcode.StackBehaviourPush == StackBehaviour.Varpush && meth.ReturnType != typeof(void)) { stackchange++; } if (opcode.StackBehaviourPop == StackBehaviour.Varpop) { stackchange -= meth.GetParametersNoCopy().Length; } // Pop the "this" parameter if the method is non-static, // and the instruction is not newobj/ldtoken/ldftn. if (!meth.IsStatic && !(opcode.Equals(OpCodes.Newobj) || opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn))) { stackchange--; } UpdateStackSize(opcode, stackchange); PutInteger4(token); }
/// <summary>确定与指定的 SOAPAction 值关联的方法的类型和方法名。</summary> /// <returns>如果类型和方法名成功恢复,则为 true;否则为 false。</returns> /// <param name="soapAction">为其请求类型和方法名的方法的 SOAPAction。</param> /// <param name="typeName">当此方法返回时,该参数包含保存了相关方法的类型名称的 <see cref="T:System.String" />。该参数未经初始化即被传递。</param> /// <param name="methodName">当此方法返回时,该参数包含保存了相关方法的方法名的 <see cref="T:System.String" />。该参数未经初始化即被传递。</param> /// <exception cref="T:System.Runtime.Remoting.RemotingException">SOAPAction 值不以引号开头和结尾。</exception> /// <exception cref="T:System.Security.SecurityException">直接调用方没有基础结构权限。</exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static bool GetTypeAndMethodNameFromSoapAction(string soapAction, out string typeName, out string methodName) { if ((int)soapAction[0] == 34) { string str = soapAction; int index = str.Length - 1; if ((int)str[index] == 34) { soapAction = soapAction.Substring(1, soapAction.Length - 2); } } ArrayList arrayList = (ArrayList)SoapServices._soapActionToMethodBase[(object)soapAction]; if (arrayList != null) { if (arrayList.Count > 1) { typeName = (string)null; methodName = (string)null; return(false); } MethodBase methodBase = (MethodBase)arrayList[0]; if (methodBase != (MethodBase)null) { RuntimeMethodInfo runtimeMethodInfo = methodBase as RuntimeMethodInfo; RuntimeConstructorInfo runtimeConstructorInfo = methodBase as RuntimeConstructorInfo; RuntimeModule runtimeModule; if ((MethodInfo)runtimeMethodInfo != (MethodInfo)null) { runtimeModule = runtimeMethodInfo.GetRuntimeModule(); } else { if (!((ConstructorInfo)runtimeConstructorInfo != (ConstructorInfo)null)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject")); } runtimeModule = runtimeConstructorInfo.GetRuntimeModule(); } typeName = methodBase.DeclaringType.FullName + ", " + runtimeModule.GetRuntimeAssembly().GetSimpleName(); methodName = methodBase.Name; return(true); } } string[] strArray = soapAction.Split('#'); if (strArray.Length == 2) { bool assemblyIncluded; typeName = XmlNamespaceEncoder.GetTypeNameForSoapActionNamespace(strArray[0], out assemblyIncluded); if (typeName == null) { methodName = (string)null; return(false); } methodName = strArray[1]; return(true); } typeName = (string)null; methodName = (string)null; return(false); }
internal override sealed RuntimeParameterInfo[] GetRuntimeParameters(RuntimeMethodInfo contextMethod, out RuntimeParameterInfo returnParameter) { return _common.GetRuntimeParameters(contextMethod, contextMethod.RuntimeGenericArgumentsOrParameters, out returnParameter); }
private int GetTokenFor(RuntimeMethodInfo rtMeth) { return(m_scope.GetTokenFor(rtMeth.MethodHandle)); }
// // The non-public version of MethodInfo.GetParameters() (does not array-copy.) // The first element is actually the ReturnParameter value. // internal abstract RuntimeParameterInfo[] GetRuntimeParametersAndReturn(RuntimeMethodInfo contextMethod);
private int GetTokenFor(RuntimeMethodInfo rtMeth, RuntimeType rtType) { return(m_scope.GetTokenFor(rtMeth.MethodHandle, rtType.TypeHandle)); }
internal sealed override RuntimeParameterInfo[] GetRuntimeParameters(RuntimeMethodInfo contextMethod, out RuntimeParameterInfo returnParameter) { return _genericMethodDefinition.GetRuntimeParameters(this, out returnParameter); }
private int GetTokenForVarArgMethod(RuntimeMethodInfo rtMeth, SignatureHelper sig) { VarArgMethod varArgMeth = new VarArgMethod(rtMeth, sig); return(m_scope.GetTokenFor(varArgMeth)); }
protected internal abstract String ComputeToString(RuntimeMethodInfo contextMethod);
internal static Delegate CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, Object firstArgument, DelegateBindingFlags flags, ref StackCrawlMark stackMark) { Debug.Assert((flags & DelegateBindingFlags.SkipSecurityChecks) == 0); return(UnsafeCreateDelegate(rtType, rtMethod, firstArgument, flags)); }