protected object MarshalArgument(object arg, ref ArrayList args)
        {
            if (arg == null)
            {
                return(null);
            }
            if (CADMessageBase.IsPossibleToIgnoreMarshal(arg))
            {
                return(arg);
            }
            MarshalByRefObject marshalByRefObject = arg as MarshalByRefObject;

            if (marshalByRefObject != null)
            {
                if (!RemotingServices.IsTransparentProxy(marshalByRefObject))
                {
                    ObjRef o = RemotingServices.Marshal(marshalByRefObject);
                    return(new CADObjRef(o, Thread.GetDomainID()));
                }
            }
            if (args == null)
            {
                args = new ArrayList();
            }
            args.Add(arg);
            return(new CADArgHolder(args.Count - 1));
        }
Beispiel #2
0
        internal MethodResponse(IMethodCallMessage msg, CADMethodReturnMessage retmsg)
        {
            _callMsg = msg;

            _methodBase = msg.MethodBase;
            //_typeName = msg.TypeName;
            _uri        = msg.Uri;
            _methodName = msg.MethodName;

            // Get unmarshalled arguments
            ArrayList args = retmsg.GetArguments();

            _exception   = retmsg.GetException(args);
            _returnValue = retmsg.GetReturnValue(args);
            _args        = retmsg.GetArgs(args);

            _callContext = retmsg.GetLogicalCallContext(args);
            if (_callContext == null)
            {
                _callContext = new LogicalCallContext();
            }

            if (retmsg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(Properties, retmsg.PropertiesCount, args);
            }
        }
Beispiel #3
0
        internal CADMethodCallMessage(IMethodCallMessage callMsg)
        {
            this._uri         = callMsg.Uri;
            this.MethodHandle = callMsg.MethodBase.MethodHandle;
            this.FullTypeName = callMsg.MethodBase.DeclaringType.AssemblyQualifiedName;
            ArrayList arrayList = null;

            this._propertyCount = CADMessageBase.MarshalProperties(callMsg.Properties, ref arrayList);
            this._args          = base.MarshalArguments(callMsg.Args, ref arrayList);
            base.SaveLogicalCallContext(callMsg, ref arrayList);
            if (arrayList != null)
            {
                MemoryStream memoryStream = CADSerializer.SerializeObject(arrayList.ToArray());
                this._serializedArgs = memoryStream.GetBuffer();
            }
        }
Beispiel #4
0
        internal MethodCall(CADMethodCallMessage msg)
        {
            this._uri = string.Copy(msg.Uri);
            ArrayList arguments = msg.GetArguments();

            this._args        = msg.GetArgs(arguments);
            this._callContext = msg.GetLogicalCallContext(arguments);
            if (this._callContext == null)
            {
                this._callContext = new LogicalCallContext();
            }
            this._methodBase = msg.GetMethod();
            this.Init();
            if (msg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(this.Properties, msg.PropertiesCount, arguments);
            }
        }
Beispiel #5
0
        internal MethodResponse(IMethodCallMessage msg, CADMethodReturnMessage retmsg)
        {
            this._callMsg    = msg;
            this._methodBase = msg.MethodBase;
            this._uri        = msg.Uri;
            this._methodName = msg.MethodName;
            ArrayList arguments = retmsg.GetArguments();

            this._exception   = retmsg.GetException(arguments);
            this._returnValue = retmsg.GetReturnValue(arguments);
            this._args        = retmsg.GetArgs(arguments);
            this._callContext = retmsg.GetLogicalCallContext(arguments);
            if (this._callContext == null)
            {
                this._callContext = new LogicalCallContext();
            }
            if (retmsg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(this.Properties, retmsg.PropertiesCount, arguments);
            }
        }
Beispiel #6
0
        internal MethodCall(CADMethodCallMessage msg)
        {
            _uri = string.Copy(msg.Uri);

            // Get unmarshalled arguments
            ArrayList args = msg.GetArguments();

            _args        = msg.GetArgs(args);
            _callContext = msg.GetLogicalCallContext(args);
            if (_callContext == null)
            {
                _callContext = new LogicalCallContext();
            }

            _methodBase = msg.GetMethod();

            Init();

            if (msg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(Properties, msg.PropertiesCount, args);
            }
        }
        internal CADMethodReturnMessage(IMethodReturnMessage retMsg)
        {
            ArrayList arrayList = null;

            this._propertyCount = CADMessageBase.MarshalProperties(retMsg.Properties, ref arrayList);
            this._returnValue   = base.MarshalArgument(retMsg.ReturnValue, ref arrayList);
            this._args          = base.MarshalArguments(retMsg.Args, ref arrayList);
            if (retMsg.Exception != null)
            {
                if (arrayList == null)
                {
                    arrayList = new ArrayList();
                }
                this._exception = new CADArgHolder(arrayList.Count);
                arrayList.Add(retMsg.Exception);
            }
            base.SaveLogicalCallContext(retMsg, ref arrayList);
            if (arrayList != null)
            {
                MemoryStream memoryStream = CADSerializer.SerializeObject(arrayList.ToArray());
                this._serializedArgs = memoryStream.GetBuffer();
            }
        }