[corlib] Serialization from reference sources
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Messaging / MethodCall.cs
index ad25859963ff7981cc0414c8465984995a5c573a..9bb668a55ddc851551bc75f26e922b9591fa24fa 100644 (file)
@@ -34,6 +34,7 @@ using System;
 using System.Collections;
 using System.Reflection;
 using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
 
 namespace System.Runtime.Remoting.Messaging {
 
@@ -118,6 +119,40 @@ namespace System.Runtime.Remoting.Messaging {
                        ResolveMethod();
                }
 
+        internal MethodCall (Object handlerObject, BinaryMethodCallMessage smuggledMsg)
+        {
+            if (handlerObject != null)
+            {
+                _uri = handlerObject as String;
+                if (_uri == null)
+                {
+                    // This must be the tranparent proxy
+                    MarshalByRefObject mbr = handlerObject as MarshalByRefObject;
+                    if (mbr != null)
+                    {
+                       throw new NotImplementedException ("MarshalByRefObject.GetIdentity");
+/*
+                        bool fServer;
+                        srvID = MarshalByRefObject.GetIdentity(mbr, out fServer) as ServerIdentity; 
+                        uri = srvID.URI;
+*/
+                    }
+                }
+            }
+
+            _typeName = smuggledMsg.TypeName;
+            _methodName = smuggledMsg.MethodName;
+            _methodSignature = (Type[])smuggledMsg.MethodSignature;
+            _args = smuggledMsg.Args;
+            _genericArguments = smuggledMsg.InstantiationArgs;
+            _callContext = smuggledMsg.LogicalCallContext;
+
+            ResolveMethod();
+
+            if (smuggledMsg.HasProperties)
+                smuggledMsg.PopulateMessageProperties(Properties);
+        }
+
                internal MethodCall ()
                {
                }
@@ -386,6 +421,11 @@ namespace System.Runtime.Remoting.Messaging {
                        set { _targetIdentity = value; }
                }
 
+               bool IInternalMessage.HasProperties()
+               {
+                       return (ExternalProperties != null) || (InternalProperties != null);
+               }
+
                Type[] GenericArguments {
                        get {
                                if (_genericArguments != null)