Inheritance: RemotingCachedData
 internal MethodResponse(IMethodCallMessage msg, object handlerObject, BinaryMethodReturnMessage smuggledMrm)
 {
     if (msg != null)
     {
         this.MI = msg.MethodBase;
         this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
         this.methodName = msg.MethodName;
         this.uri = msg.Uri;
         this.typeName = msg.TypeName;
         if (this._methodCache.IsOverloaded())
         {
             this.methodSignature = (Type[]) msg.MethodSignature;
         }
         this.argCount = this._methodCache.Parameters.Length;
     }
     this.retVal = smuggledMrm.ReturnValue;
     this.outArgs = smuggledMrm.Args;
     this.fault = smuggledMrm.Exception;
     this.callContext = smuggledMrm.LogicalCallContext;
     if (smuggledMrm.HasProperties)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties);
     }
     this.fSoap = false;
 }
 internal static object[] ExpandAsyncEndArgsToSyncArgs(RemotingMethodCachedData syncMethod, object[] asyncEndArgs)
 {
     object[] objArray = new object[syncMethod.Parameters.Length];
     int[] outRefArgMap = syncMethod.OutRefArgMap;
     for (int i = 0; i < outRefArgMap.Length; i++)
     {
         objArray[outRefArgMap[i]] = asyncEndArgs[i];
     }
     return objArray;
 }
 internal ArgMapper(MethodBase mb, bool fOut)
 {
     this._methodCachedData = InternalRemotingServices.GetReflectionCachedData(mb);
     if (fOut)
     {
         this._map = this._methodCachedData.MarshalResponseArgMap;
     }
     else
     {
         this._map = this._methodCachedData.MarshalRequestArgMap;
     }
 }
 internal ArgMapper(IMethodMessage mm, bool fOut)
 {
     this._mm = mm;
     MethodBase methodBase = this._mm.MethodBase;
     this._methodCachedData = InternalRemotingServices.GetReflectionCachedData(methodBase);
     if (fOut)
     {
         this._map = this._methodCachedData.MarshalResponseArgMap;
     }
     else
     {
         this._map = this._methodCachedData.MarshalRequestArgMap;
     }
 }
 public MethodResponse(Header[] h1, IMethodCallMessage mcm)
 {
     if (mcm == null)
     {
         throw new ArgumentNullException("mcm");
     }
     Message message = mcm as Message;
     if (message != null)
     {
         this.MI = message.GetMethodBase();
     }
     else
     {
         this.MI = mcm.MethodBase;
     }
     if (this.MI == null)
     {
         throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), new object[] { mcm.MethodName, mcm.TypeName }));
     }
     this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
     this.argCount = this._methodCache.Parameters.Length;
     this.fSoap = true;
     this.FillHeaders(h1);
 }
 private void PopulateOutArguments(RemotingMethodCachedData methodCache)
 {
     ParameterInfo[] parameters = methodCache.Parameters;
     foreach (int num in methodCache.OutOnlyArgMap)
     {
         Type elementType = parameters[num].ParameterType.GetElementType();
         if (elementType.IsValueType)
         {
             this.args[num] = Activator.CreateInstance(elementType, true);
         }
     }
 }
 internal MethodResponse(IMethodCallMessage msg, SmuggledMethodReturnMessage smuggledMrm, ArrayList deserializedArgs)
 {
     this.MI = msg.MethodBase;
     this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
     this.methodName = msg.MethodName;
     this.uri = msg.Uri;
     this.typeName = msg.TypeName;
     if (this._methodCache.IsOverloaded())
     {
         this.methodSignature = (Type[]) msg.MethodSignature;
     }
     this.retVal = smuggledMrm.GetReturnValue(deserializedArgs);
     this.outArgs = smuggledMrm.GetArgs(deserializedArgs);
     this.fault = smuggledMrm.GetException(deserializedArgs);
     this.callContext = smuggledMrm.GetCallContext(deserializedArgs);
     if (smuggledMrm.MessagePropertyCount > 0)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties, deserializedArgs);
     }
     this.argCount = this._methodCache.Parameters.Length;
     this.fSoap = false;
 }
Ejemplo n.º 8
0
        } // ExpandAsyncBeginArgsToSyncArgs

        internal static Object[] ExpandAsyncEndArgsToSyncArgs(RemotingMethodCachedData syncMethod,
                                                              Object[] asyncEndArgs)
        {
            // This is when we have a list of args associated with EndFoo(), and
            //   we want to size it to a list of args associated with Foo();

            Object[] args = new Object[syncMethod.Parameters.Length];

            int[] outRefArgMap = syncMethod.OutRefArgMap;
            
            for (int co = 0; co < outRefArgMap.Length; co++)
            {
                args[outRefArgMap[co]] = asyncEndArgs[co];
            }

            return args;            
        } // ExpandAsyncEndArgsToSyncArgs
Ejemplo n.º 9
0
        // access attribute cached on the reflection object
        internal static RemotingMethodCachedData GetReflectionCachedData(MethodBase mi) 
        { 
            RemotingMethodCachedData cache = null;
 
            RuntimeMethodInfo rmi = null;
            RuntimeConstructorInfo rci = null;

            if ((rmi = mi as RuntimeMethodInfo) != null) 
            {
                cache = (RemotingMethodCachedData)rmi.RemotingCache[CacheObjType.RemotingData]; 
                if (cache == null) 
                    rmi.RemotingCache[CacheObjType.RemotingData] = cache = new RemotingMethodCachedData(rmi);
            } 
            else if ((rci = mi as RuntimeConstructorInfo) != null)
            {
                cache = (RemotingMethodCachedData)rci.RemotingCache[CacheObjType.RemotingData];
                if (cache == null) 
                    rci.RemotingCache[CacheObjType.RemotingData] = cache = new RemotingMethodCachedData(rci);
            } 
            else 
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject"));
 
            return cache;
        }// GetCachedRemotingAttribute
Ejemplo n.º 10
0
        internal MethodResponse(IMethodCallMessage msg,
                                Object handlerObject,
                                BinaryMethodReturnMessage smuggledMrm)
        {

            if (msg != null)
            {
                MI = (MethodBase)msg.MethodBase;
                _methodCache = InternalRemotingServices.GetReflectionCachedData(MI);
            
                methodName = msg.MethodName;
                uri = msg.Uri;
                typeName = msg.TypeName;

                if (_methodCache.IsOverloaded())
                    methodSignature = (Type[])msg.MethodSignature;

                argCount = _methodCache.Parameters.Length;

            }
           
            retVal = smuggledMrm.ReturnValue;
            outArgs = smuggledMrm.Args;
            fault = smuggledMrm.Exception;

            callContext = smuggledMrm.LogicalCallContext;

            if (smuggledMrm.HasProperties)
                smuggledMrm.PopulateMessageProperties(Properties);           
            
            fSoap = false;
        }
Ejemplo n.º 11
0
        internal MethodResponse(IMethodCallMessage msg,
                                SmuggledMethodReturnMessage smuggledMrm,
                                ArrayList deserializedArgs)
        {
            MI = (MethodBase)msg.MethodBase;
            _methodCache = InternalRemotingServices.GetReflectionCachedData(MI);
            
            methodName = msg.MethodName;
            uri = msg.Uri;
            typeName = msg.TypeName;

            if (_methodCache.IsOverloaded())
                methodSignature = (Type[])msg.MethodSignature;
           
            retVal = smuggledMrm.GetReturnValue(deserializedArgs);
            outArgs = smuggledMrm.GetArgs(deserializedArgs);
            fault = smuggledMrm.GetException(deserializedArgs);

            callContext = smuggledMrm.GetCallContext(deserializedArgs);

            if (smuggledMrm.MessagePropertyCount > 0)
                smuggledMrm.PopulateMessageProperties(Properties, deserializedArgs);           
            
            argCount = _methodCache.Parameters.Length;
            fSoap = false;
        }
Ejemplo n.º 12
0
        // Constructor -- this constructor is called only in the SOAP Scenario


        /// <include file='doc\Message.uex' path='docs/doc[@for="MethodResponse.MethodResponse"]/*' />
	/// <internalonly/>
        public MethodResponse(Header[] h1, IMethodCallMessage mcm)
        {
            if (mcm == null)
                throw new ArgumentNullException("mcm");

            Message msg = mcm as Message;
            if (null != msg)
            {
                MI = (MethodBase)msg.GetMethodBase();
            }
            else
            {
                MI = (MethodBase)mcm.MethodBase;
            }
            if (MI == null)
            {
                throw new RemotingException(
                    String.Format(
                        Environment.GetResourceString(
                            "Remoting_Message_MethodMissing"),
                        mcm.MethodName,
                        mcm.TypeName));
            }
            
            _methodCache = InternalRemotingServices.GetReflectionCachedData(MI);
            
            argCount = _methodCache.Parameters.Length;
            fSoap = true;
            FillHeaders(h1);
        }
Ejemplo n.º 13
0
 void PopulateOutArguments(RemotingMethodCachedData methodCache)
 {
     ParameterInfo[] parameterInfos = methodCache.Parameters;
     // We need to have a dummy object in the array for out parameters
     //   that have value types.
     foreach (int outArg in methodCache.OutOnlyArgMap)
     {
         Type type = parameterInfos[outArg].ParameterType.GetElementType();
         if (type.IsValueType)
             args[outArg] = Activator.CreateInstance(type, true);
     }
 }
 internal static RemotingMethodCachedData GetReflectionCachedData(MethodBase mi)
 {
     RemotingMethodCachedData data = null;
     RuntimeMethodInfo ri = null;
     RuntimeConstructorInfo info2 = null;
     ri = mi as RuntimeMethodInfo;
     if (ri != null)
     {
         data = (RemotingMethodCachedData) ri.RemotingCache[CacheObjType.RemotingData];
         if (data == null)
         {
             ri.RemotingCache[CacheObjType.RemotingData] = data = new RemotingMethodCachedData(ri);
         }
         return data;
     }
     info2 = mi as RuntimeConstructorInfo;
     if (info2 == null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject"));
     }
     data = (RemotingMethodCachedData) info2.RemotingCache[CacheObjType.RemotingData];
     if (data == null)
     {
         info2.RemotingCache[CacheObjType.RemotingData] = data = new RemotingMethodCachedData(info2);
     }
     return data;
 }
 // access attribute cached on the reflection object
 internal static RemotingMethodCachedData GetReflectionCachedData(MethodBase mi)
 {
     RemotingMethodCachedData cache = null;
     cache = (RemotingMethodCachedData)mi.Cache[CacheObjType.RemotingData];
     if (cache == null)
     {
         cache = new RemotingMethodCachedData(mi);
         mi.Cache[CacheObjType.RemotingData] = cache;
     }
     return cache;
 }// GetCachedRemotingAttribute
        }// GetCachedRemotingAttribute
        
        internal static RemotingCachedData GetReflectionCachedData(MemberInfo mi)
        {
            RemotingCachedData cache = null;
            cache = (RemotingCachedData)mi.Cache[CacheObjType.RemotingData];
            if (cache == null)
            {
                if (mi is MethodBase)
                    cache = new RemotingMethodCachedData(mi);
                else
                    if (mi is Type)
                        cache = new RemotingTypeCachedData(mi);
                    else
                        cache = new RemotingCachedData(mi);

                mi.Cache[CacheObjType.RemotingData] = cache;
            }
            return cache;
        }// GetCachedRemotingAttribute
Ejemplo n.º 17
0
        internal ArgMapper(IMethodMessage mm, bool fOut)
        {
            _mm = mm;
            MethodBase mb = (MethodBase)_mm.MethodBase;
            _methodCachedData = 
                InternalRemotingServices.GetReflectionCachedData(mb);

            if (fOut)
                _map = _methodCachedData.MarshalResponseArgMap;
            else
                _map = _methodCachedData.MarshalRequestArgMap;
        } // ArgMapper
Ejemplo n.º 18
0
        // copies references of non-byref [In, Out] args from the input args to
        //   the output args array. 
        internal void CopyNonByrefOutArgsFromOriginalArgs(RemotingMethodCachedData methodCache,
                                                         Object[] args,
                                                         ref Object[] marshalResponseArgs)
        { 
            int[] map = methodCache.NonRefOutArgMap;
            if (map.Length > 0) 
            { 
                if (marshalResponseArgs == null)
                    marshalResponseArgs = new Object[methodCache.Parameters.Length]; 

                foreach (int pos in map)
                {
                    marshalResponseArgs[pos] = args[pos]; 
                }
            } 
        } 
Ejemplo n.º 19
0
        } // GetParameterMaps
        

        // 
        // Helper methods for expanding and contracting argument lists
        //   when translating from async methods to sync methods and back.
        //

        internal static Object[] ExpandAsyncBeginArgsToSyncArgs(RemotingMethodCachedData syncMethod,
                                                                Object[] asyncBeginArgs)
        {
            // This is when we have a list of args associated with BeginFoo(), and
            //   we want a list of args we can use to invoke Foo().

            ParameterInfo[] parameters = syncMethod.Parameters;
            int syncParamCount = parameters.Length;
            int[] inRefArgMap = syncMethod.InRefArgMap;            
            
            Object[] args = new Object[syncParamCount];
            
            for (int co = 0; co < inRefArgMap.Length; co++)
            {
                args[inRefArgMap[co]] = asyncBeginArgs[co];
            }

            // We also are required to create an instance for any primitive parameters
            //   that are only out parameters (PrivateProcessMessage requires it).
            foreach (int outArg in syncMethod.OutOnlyArgMap)
            {
                Type type = parameters[outArg].ParameterType.GetElementType();
                if (type.IsValueType)
                    args[outArg] = Activator.CreateInstance(type, true);
            }

            return args;                  
        } // ExpandAsyncBeginArgsToSyncArgs