private SmuggledMethodCallMessage(IMethodCallMessage mcm) { this._uri = mcm.Uri; this._methodName = mcm.MethodName; this._typeName = mcm.TypeName; ArrayList arrayList = null; IInternalMessage internalMessage = mcm as IInternalMessage; if (internalMessage == null || internalMessage.HasProperties()) { this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage(mcm, ref arrayList); } if (mcm.MethodBase.IsGenericMethod) { Type[] genericArguments = mcm.MethodBase.GetGenericArguments(); if (genericArguments != null && genericArguments.Length != 0) { if (arrayList == null) { arrayList = new ArrayList(); } this._instantiation = new MessageSmuggler.SerializedArg(arrayList.Count); arrayList.Add(genericArguments); } } if (RemotingServices.IsMethodOverloaded(mcm)) { if (arrayList == null) { arrayList = new ArrayList(); } this._methodSignature = new MessageSmuggler.SerializedArg(arrayList.Count); arrayList.Add(mcm.MethodSignature); } LogicalCallContext logicalCallContext = mcm.LogicalCallContext; if (logicalCallContext == null) { this._callContext = null; } else if (logicalCallContext.HasInfo) { if (arrayList == null) { arrayList = new ArrayList(); } this._callContext = new MessageSmuggler.SerializedArg(arrayList.Count); arrayList.Add(logicalCallContext); } else { this._callContext = logicalCallContext.RemotingData.LogicalCallID; } this._args = MessageSmuggler.FixupArgs(mcm.Args, ref arrayList); if (arrayList != null) { MemoryStream memoryStream = CrossAppDomainSerializer.SerializeMessageParts(arrayList); this._serializedArgs = memoryStream.GetBuffer(); } }
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(); }