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 SmuggledMethodCallMessage(IMethodCallMessage mcm) { _uri = mcm.Uri; _methodName = mcm.MethodName; _typeName = mcm.TypeName; ArrayList argsToSerialize = null; IInternalMessage iim = mcm as IInternalMessage; // user properties (everything but special entries) if ((iim == null) || iim.HasProperties()) { _propertyCount = StoreUserPropertiesForMethodMessage(mcm, ref argsToSerialize); } // handle method signature if (RemotingServices.IsMethodOverloaded(mcm)) { if (argsToSerialize == null) { argsToSerialize = new ArrayList(); } _methodSignature = new SerializedArg(argsToSerialize.Count); argsToSerialize.Add(mcm.MethodSignature); } // handle call context LogicalCallContext lcc = mcm.LogicalCallContext; if (lcc == null) { _callContext = null; } else if (lcc.HasInfo) { if (argsToSerialize == null) { argsToSerialize = new ArrayList(); } _callContext = new SerializedArg(argsToSerialize.Count); argsToSerialize.Add(lcc); } else { // just smuggle the call id string _callContext = lcc.RemotingData.LogicalCallID; } _args = FixupArgs(mcm.Args, ref argsToSerialize); if (argsToSerialize != null) { //MemoryStream argStm = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize, out _serializerSmuggledArgs); MemoryStream argStm = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize); _serializedArgs = argStm.GetBuffer(); } } // SmuggledMethodCallMessage
[System.Security.SecurityCritical] // auto-generated private SmuggledMethodReturnMessage(IMethodReturnMessage mrm) { ArrayList argsToSerialize = null; ReturnMessage retMsg = mrm as ReturnMessage; // user properties (everything but special entries) if ((retMsg == null) || retMsg.HasProperties()) _propertyCount = StoreUserPropertiesForMethodMessage(mrm, ref argsToSerialize); // handle exception Exception excep = mrm.Exception; if (excep != null) { if (argsToSerialize == null) argsToSerialize = new ArrayList(); _exception = new SerializedArg(argsToSerialize.Count); argsToSerialize.Add(excep); } // handle call context LogicalCallContext lcc = mrm.LogicalCallContext; if (lcc == null) { _callContext = null; } else if (lcc.HasInfo) { if (lcc.Principal != null) lcc.Principal = null; if (argsToSerialize == null) argsToSerialize = new ArrayList(); _callContext = new SerializedArg(argsToSerialize.Count); argsToSerialize.Add(lcc); } else { // just smuggle the call id string _callContext = lcc.RemotingData.LogicalCallID; } _returnValue = FixupArg(mrm.ReturnValue, ref argsToSerialize); _args = FixupArgs(mrm.Args, ref argsToSerialize); if (argsToSerialize != null) { MemoryStream argStm = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize); //MemoryStream argStm = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize, out _serializerSmuggledArgs); _serializedArgs = argStm.GetBuffer(); } } // SmuggledMethodReturnMessage
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(); }