namespace System.Runtime.Remoting.Messaging
{
+ [System.Runtime.InteropServices.ComVisible (true)]
public class ReturnMessage : IMethodReturnMessage, IMethodMessage, IMessage, IInternalMessage
{
object[] _outArgs;
object[] _args;
- int _outArgsCount;
LogicalCallContext _callCtx;
object _returnValue;
string _uri;
Identity _targetIdentity;
ArgInfo _inArgInfo;
- public ReturnMessage (object returnValue, object [] outArgs,
- int outArgCount, LogicalCallContext callCtx,
- IMethodCallMessage request)
+ public ReturnMessage (object ret, object [] outArgs,
+ int outArgsCount, LogicalCallContext callCtx,
+ IMethodCallMessage mcm)
{
// outArgCount tells how many values of outArgs are valid
- _returnValue = returnValue;
+ _returnValue = ret;
_args = outArgs;
- _outArgsCount = outArgCount;
_callCtx = callCtx;
- if (request != null) {
- _uri = request.Uri;
- _methodBase = request.MethodBase;
+ if (mcm != null) {
+ _uri = mcm.Uri;
+ _methodBase = mcm.MethodBase;
}
- if (_args == null) _args = new object [outArgCount];
+ if (_args == null) _args = new object [outArgsCount];
}
- public ReturnMessage (Exception exc, IMethodCallMessage request)
+ public ReturnMessage (Exception e, IMethodCallMessage mcm)
{
- _exception = exc;
+ _exception = e;
- if (request != null)
- _methodBase = request.MethodBase;
+ if (mcm != null) {
+ _methodBase = mcm.MethodBase;
+ _callCtx = mcm.LogicalCallContext;
+ }
_args = new object[0]; // .NET does this
}
public LogicalCallContext LogicalCallContext {
get {
if (_callCtx == null)
- return LogicalCallContext.Empty;
- else
- return _callCtx;
+ _callCtx = new LogicalCallContext ();
+ return _callCtx;
}
}
}
}
- public object GetArg (int arg_num)
+ string IInternalMessage.Uri {
+ get { return Uri; }
+ set { Uri = value; }
+ }
+
+ public object GetArg (int argNum)
{
- return _args [arg_num];
+ return _args [argNum];
}
- public string GetArgName (int arg_num)
+ public string GetArgName (int index)
{
- return _methodBase.GetParameters()[arg_num].Name;
+ return _methodBase.GetParameters()[index].Name;
}
public Exception Exception {
}
}
- public object GetOutArg (int arg_num)
+ public object GetOutArg (int argNum)
{
if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
- return _args[_inArgInfo.GetInOutArgIndex (arg_num)];
+ return _args[_inArgInfo.GetInOutArgIndex (argNum)];
}
- public string GetOutArgName (int arg_num)
+ public string GetOutArgName (int index)
{
if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
- return _inArgInfo.GetInOutArgName(arg_num);
+ return _inArgInfo.GetInOutArgName (index);
}
Identity IInternalMessage.TargetIdentity
set { _targetIdentity = value; }
}
- public override string ToString ()
+ bool IInternalMessage.HasProperties ()
{
- string s = TypeName.Split(',')[0] + "." + MethodName + " (";
- if (_exception != null)
- {
- s += "Exception)\n" + _exception;
- }
- else
- {
- for (int n=0; n<OutArgs.Length; n++)
- {
- if (n>0) s+= ", ";
- if (OutArgs[n] != null) s += OutArgs[n].GetType().Name + " ";
- s += GetOutArgName (n);
- if (OutArgs[n] != null) s += " = {" + OutArgs[n] + "}";
- else s+=" = {null}";
- }
- s += ")";
- }
- return s;
+ return _properties != null;
+ }
+
+ internal bool HasProperties ()
+ {
+ return _properties != null;
}
}
}