Esempio n. 1
0
        private SmuggledMethodCallMessage(IMethodCallMessage mcm)
        {
            this._uri        = mcm.Uri;
            this._methodName = mcm.MethodName;
            this._typeName   = mcm.TypeName;
            ArrayList        argsToSerialize = (ArrayList)null;
            IInternalMessage internalMessage = mcm as IInternalMessage;

            if (internalMessage == null || internalMessage.HasProperties())
            {
                this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage((IMethodMessage)mcm, ref argsToSerialize);
            }
            if (mcm.MethodBase.IsGenericMethod)
            {
                Type[] genericArguments = mcm.MethodBase.GetGenericArguments();
                if (genericArguments != null && genericArguments.Length != 0)
                {
                    if (argsToSerialize == null)
                    {
                        argsToSerialize = new ArrayList();
                    }
                    this._instantiation = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                    argsToSerialize.Add((object)genericArguments);
                }
            }
            if (RemotingServices.IsMethodOverloaded((IMethodMessage)mcm))
            {
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._methodSignature = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add(mcm.MethodSignature);
            }
            LogicalCallContext logicalCallContext = mcm.LogicalCallContext;

            if (logicalCallContext == null)
            {
                this._callContext = (object)null;
            }
            else if (logicalCallContext.HasInfo)
            {
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._callContext = (object)new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add((object)logicalCallContext);
            }
            else
            {
                this._callContext = (object)logicalCallContext.RemotingData.LogicalCallID;
            }
            this._args = MessageSmuggler.FixupArgs(mcm.Args, ref argsToSerialize);
            if (argsToSerialize == null)
            {
                return;
            }
            this._serializedArgs = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize).GetBuffer();
        }
 private SmuggledMethodCallMessage(IMethodCallMessage mcm)
 {
     this._uri = mcm.Uri;
     this._methodName = mcm.MethodName;
     this._typeName = mcm.TypeName;
     ArrayList argsToSerialize = null;
     IInternalMessage message = mcm as IInternalMessage;
     if ((message == null) || message.HasProperties())
     {
         this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage(mcm, ref argsToSerialize);
     }
     if (mcm.MethodBase.IsGenericMethod)
     {
         Type[] genericArguments = mcm.MethodBase.GetGenericArguments();
         if ((genericArguments != null) && (genericArguments.Length > 0))
         {
             if (argsToSerialize == null)
             {
                 argsToSerialize = new ArrayList();
             }
             this._instantiation = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
             argsToSerialize.Add(genericArguments);
         }
     }
     if (RemotingServices.IsMethodOverloaded(mcm))
     {
         if (argsToSerialize == null)
         {
             argsToSerialize = new ArrayList();
         }
         this._methodSignature = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
         argsToSerialize.Add(mcm.MethodSignature);
     }
     LogicalCallContext logicalCallContext = mcm.LogicalCallContext;
     if (logicalCallContext == null)
     {
         this._callContext = null;
     }
     else if (logicalCallContext.HasInfo)
     {
         if (argsToSerialize == null)
         {
             argsToSerialize = new ArrayList();
         }
         this._callContext = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
         argsToSerialize.Add(logicalCallContext);
     }
     else
     {
         this._callContext = logicalCallContext.RemotingData.LogicalCallID;
     }
     this._args = MessageSmuggler.FixupArgs(mcm.Args, ref argsToSerialize);
     if (argsToSerialize != null)
     {
         this._serializedArgs = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize).GetBuffer();
     }
 }
Esempio n. 3
0
 protected static object UndoFixupArg(object arg, ArrayList deserializedArgs)
 {
     SmuggledObjRef smuggledObjRef = arg as SmuggledObjRef;
       if (smuggledObjRef != null)
     return smuggledObjRef.ObjRef.GetRealObjectHelper();
       MessageSmuggler.SerializedArg serializedArg = arg as MessageSmuggler.SerializedArg;
       if (serializedArg != null)
     return deserializedArgs[serializedArg.Index];
       return arg;
 }
Esempio n. 4
0
        private SmuggledMethodReturnMessage(IMethodReturnMessage mrm)
        {
            ArrayList     argsToSerialize = (ArrayList)null;
            ReturnMessage returnMessage   = mrm as ReturnMessage;

            if (returnMessage == null || returnMessage.HasProperties())
            {
                this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage((IMethodMessage)mrm, ref argsToSerialize);
            }
            Exception exception = mrm.Exception;

            if (exception != null)
            {
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._exception = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add((object)exception);
            }
            LogicalCallContext logicalCallContext = mrm.LogicalCallContext;

            if (logicalCallContext == null)
            {
                this._callContext = (object)null;
            }
            else if (logicalCallContext.HasInfo)
            {
                if (logicalCallContext.Principal != null)
                {
                    logicalCallContext.Principal = (IPrincipal)null;
                }
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._callContext = (object)new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add((object)logicalCallContext);
            }
            else
            {
                this._callContext = (object)logicalCallContext.RemotingData.LogicalCallID;
            }
            this._returnValue = MessageSmuggler.FixupArg(mrm.ReturnValue, ref argsToSerialize);
            this._args        = MessageSmuggler.FixupArgs(mrm.Args, ref argsToSerialize);
            if (argsToSerialize == null)
            {
                return;
            }
            this._serializedArgs = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize).GetBuffer();
        }