using System;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Runtime.Remoting.Messaging
{
/// Implements the interface to create a message that acts as a method response on a remote object.
// Token: 0x020003FA RID: 1018
[ComVisible(true)]
[CLSCompliant(false)]
[Serializable]
public class MethodResponse : ISerializable, IInternalMessage, IMessage, IMethodMessage, IMethodReturnMessage, ISerializationRootObject
{
/// Initializes a new instance of the class from an array of remoting headers and a request message.
/// An array of remoting headers that contains key/value pairs. This array is used to initialize fields for headers that belong to the namespace "http://schemas.microsoft.com/clr/soap/messageProperties".
/// A request message that acts as a method call on a remote object.
// Token: 0x060027A3 RID: 10147 RVA: 0x0008213C File Offset: 0x0008033C
public MethodResponse(Header[] h1, IMethodCallMessage mcm)
{
if (mcm != null)
{
this._methodName = mcm.MethodName;
this._uri = mcm.Uri;
this._typeName = mcm.TypeName;
this._methodBase = mcm.MethodBase;
this._methodSignature = (Type[])mcm.MethodSignature;
this._args = mcm.Args;
}
if (h1 != null)
{
foreach (Header header in h1)
{
this.InitMethodProperty(header.Name, header.Value);
}
}
}
// Token: 0x060027A4 RID: 10148 RVA: 0x000821D4 File Offset: 0x000803D4
internal MethodResponse(Exception e, IMethodCallMessage msg)
{
this._callMsg = msg;
if (msg != null)
{
this._uri = msg.Uri;
}
else
{
this._uri = string.Empty;
}
this._exception = e;
this._returnValue = null;
this._outArgs = new object[0];
}
// Token: 0x060027A5 RID: 10149 RVA: 0x0008222C File Offset: 0x0008042C
internal MethodResponse(object returnValue, object[] outArgs, LogicalCallContext callCtx, IMethodCallMessage msg)
{
this._callMsg = msg;
this._uri = msg.Uri;
this._exception = null;
this._returnValue = returnValue;
this._args = outArgs;
}
// Token: 0x060027A6 RID: 10150 RVA: 0x0008226C File Offset: 0x0008046C
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);
}
}
// Token: 0x060027A7 RID: 10151 RVA: 0x0008231C File Offset: 0x0008051C
internal MethodResponse(SerializationInfo info, StreamingContext context)
{
foreach (SerializationEntry serializationEntry in info)
{
this.InitMethodProperty(serializationEntry.Name, serializationEntry.Value);
}
}
// Token: 0x170007A1 RID: 1953
// (get) Token: 0x060027A8 RID: 10152 RVA: 0x00082364 File Offset: 0x00080564
// (set) Token: 0x060027A9 RID: 10153 RVA: 0x0008236C File Offset: 0x0008056C
string IInternalMessage.Uri
{
get
{
return this.Uri;
}
set
{
this.Uri = value;
}
}
// Token: 0x170007A2 RID: 1954
// (get) Token: 0x060027AA RID: 10154 RVA: 0x00082378 File Offset: 0x00080578
// (set) Token: 0x060027AB RID: 10155 RVA: 0x00082380 File Offset: 0x00080580
Identity IInternalMessage.TargetIdentity
{
get
{
return this._targetIdentity;
}
set
{
this._targetIdentity = value;
}
}
// Token: 0x060027AC RID: 10156 RVA: 0x0008238C File Offset: 0x0008058C
internal void InitMethodProperty(string key, object value)
{
switch (key)
{
case "__TypeName":
this._typeName = (string)value;
return;
case "__MethodName":
this._methodName = (string)value;
return;
case "__MethodSignature":
this._methodSignature = (Type[])value;
return;
case "__Uri":
this._uri = (string)value;
return;
case "__Return":
this._returnValue = value;
return;
case "__OutArgs":
this._args = (object[])value;
return;
case "__fault":
this._exception = (Exception)value;
return;
case "__CallContext":
this._callContext = (LogicalCallContext)value;
return;
}
this.Properties[key] = value;
}
/// Gets the number of arguments passed to the method.
/// A that represents the number of arguments passed to a method.
///
///
///
// Token: 0x170007A3 RID: 1955
// (get) Token: 0x060027AD RID: 10157 RVA: 0x000824EC File Offset: 0x000806EC
public int ArgCount
{
get
{
if (this._args == null)
{
return 0;
}
return this._args.Length;
}
}
/// Gets an array of arguments passed to the method.
/// An array of type that represents the arguments passed to a method.
///
///
///
// Token: 0x170007A4 RID: 1956
// (get) Token: 0x060027AE RID: 10158 RVA: 0x00082504 File Offset: 0x00080704
public object[] Args
{
get
{
return this._args;
}
}
/// Gets the exception thrown during the method call, or null if the method did not throw an exception.
/// The thrown during the method call, or null if the method did not throw an exception.
///
///
///
// Token: 0x170007A5 RID: 1957
// (get) Token: 0x060027AF RID: 10159 RVA: 0x0008250C File Offset: 0x0008070C
public Exception Exception
{
get
{
return this._exception;
}
}
/// Gets a value that indicates whether the method can accept a variable number of arguments.
/// true if the method can accept a variable number of arguments; otherwise, false.
///
///
///
// Token: 0x170007A6 RID: 1958
// (get) Token: 0x060027B0 RID: 10160 RVA: 0x00082514 File Offset: 0x00080714
public bool HasVarArgs
{
get
{
return (this.MethodBase.CallingConvention | CallingConventions.VarArgs) != (CallingConventions)0;
}
}
/// Gets the for the current method call.
/// The for the current method call.
///
///
///
// Token: 0x170007A7 RID: 1959
// (get) Token: 0x060027B1 RID: 10161 RVA: 0x0008252C File Offset: 0x0008072C
public LogicalCallContext LogicalCallContext
{
get
{
if (this._callContext == null)
{
this._callContext = new LogicalCallContext();
}
return this._callContext;
}
}
/// Gets the of the called method.
/// The of the called method.
///
///
///
// Token: 0x170007A8 RID: 1960
// (get) Token: 0x060027B2 RID: 10162 RVA: 0x0008254C File Offset: 0x0008074C
public MethodBase MethodBase
{
get
{
if (this._methodBase == null)
{
if (this._callMsg != null)
{
this._methodBase = this._callMsg.MethodBase;
}
else if (this.MethodName != null && this.TypeName != null)
{
this._methodBase = RemotingServices.GetMethodBaseFromMethodMessage(this);
}
}
return this._methodBase;
}
}
/// Gets the name of the invoked method.
/// A that contains the name of the invoked method.
///
///
///
// Token: 0x170007A9 RID: 1961
// (get) Token: 0x060027B3 RID: 10163 RVA: 0x000825B0 File Offset: 0x000807B0
public string MethodName
{
get
{
if (this._methodName == null && this._callMsg != null)
{
this._methodName = this._callMsg.MethodName;
}
return this._methodName;
}
}
/// Gets an object that contains the method signature.
/// A that contains the method signature.
///
///
///
// Token: 0x170007AA RID: 1962
// (get) Token: 0x060027B4 RID: 10164 RVA: 0x000825E0 File Offset: 0x000807E0
public object MethodSignature
{
get
{
if (this._methodSignature == null && this._callMsg != null)
{
this._methodSignature = (Type[])this._callMsg.MethodSignature;
}
return this._methodSignature;
}
}
/// Gets the number of arguments in the method call marked as ref or out parameters.
/// A that represents the number of arguments in the method call marked as ref or out parameters.
///
///
///
// Token: 0x170007AB RID: 1963
// (get) Token: 0x060027B5 RID: 10165 RVA: 0x00082620 File Offset: 0x00080820
public int OutArgCount
{
get
{
if (this._args == null || this._args.Length == 0)
{
return 0;
}
if (this._inArgInfo == null)
{
this._inArgInfo = new ArgInfo(this.MethodBase, ArgInfoType.Out);
}
return this._inArgInfo.GetInOutArgCount();
}
}
/// Gets an array of arguments in the method call that are marked as ref or out parameters.
/// An array of type that represents the arguments in the method call that are marked as ref or out parameters.
///
///
///
// Token: 0x170007AC RID: 1964
// (get) Token: 0x060027B6 RID: 10166 RVA: 0x00082670 File Offset: 0x00080870
public object[] OutArgs
{
get
{
if (this._outArgs == null && this._args != null)
{
if (this._inArgInfo == null)
{
this._inArgInfo = new ArgInfo(this.MethodBase, ArgInfoType.Out);
}
this._outArgs = this._inArgInfo.GetInOutArgs(this._args);
}
return this._outArgs;
}
}
/// Gets an interface that represents a collection of the remoting message's properties.
/// An interface that represents a collection of the remoting message's properties.
///
///
///
// Token: 0x170007AD RID: 1965
// (get) Token: 0x060027B7 RID: 10167 RVA: 0x000826D0 File Offset: 0x000808D0
public virtual IDictionary Properties
{
get
{
if (this.ExternalProperties == null)
{
MethodReturnDictionary methodReturnDictionary = new MethodReturnDictionary(this);
this.ExternalProperties = methodReturnDictionary;
this.InternalProperties = methodReturnDictionary.GetInternalProperties();
}
return this.ExternalProperties;
}
}
/// Gets the return value of the method call.
/// A that represents the return value of the method call.
///
///
///
// Token: 0x170007AE RID: 1966
// (get) Token: 0x060027B8 RID: 10168 RVA: 0x00082708 File Offset: 0x00080908
public object ReturnValue
{
get
{
return this._returnValue;
}
}
/// Gets the full type name of the remote object on which the method call is being made.
/// A that contains the full type name of the remote object on which the method call is being made.
///
///
///
// Token: 0x170007AF RID: 1967
// (get) Token: 0x060027B9 RID: 10169 RVA: 0x00082710 File Offset: 0x00080910
public string TypeName
{
get
{
if (this._typeName == null && this._callMsg != null)
{
this._typeName = this._callMsg.TypeName;
}
return this._typeName;
}
}
/// Gets the Uniform Resource Identifier (URI) of the remote object on which the method call is being made.
/// The URI of a remote object.
///
///
///
// Token: 0x170007B0 RID: 1968
// (get) Token: 0x060027BA RID: 10170 RVA: 0x00082740 File Offset: 0x00080940
// (set) Token: 0x060027BB RID: 10171 RVA: 0x00082770 File Offset: 0x00080970
public string Uri
{
get
{
if (this._uri == null && this._callMsg != null)
{
this._uri = this._callMsg.Uri;
}
return this._uri;
}
set
{
this._uri = value;
}
}
/// Gets a method argument, as an object, at a specified index.
/// The method argument as an object.
/// The index of the requested argument.
///
///
///
// Token: 0x060027BC RID: 10172 RVA: 0x0008277C File Offset: 0x0008097C
public object GetArg(int argNum)
{
if (this._args == null)
{
return null;
}
return this._args[argNum];
}
/// Gets the name of a method argument at a specified index.
/// The name of the method argument.
/// The index of the requested argument.
///
///
///
// Token: 0x060027BD RID: 10173 RVA: 0x00082794 File Offset: 0x00080994
public string GetArgName(int index)
{
return this.MethodBase.GetParameters()[index].Name;
}
/// The method is not implemented.
/// Data for serializing or deserializing the remote object.
/// Context of a certain serialized stream.
///
///
///
// Token: 0x060027BE RID: 10174 RVA: 0x000827A8 File Offset: 0x000809A8
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (this._exception == null)
{
info.AddValue("__TypeName", this._typeName);
info.AddValue("__MethodName", this._methodName);
info.AddValue("__MethodSignature", this._methodSignature);
info.AddValue("__Uri", this._uri);
info.AddValue("__Return", this._returnValue);
info.AddValue("__OutArgs", this._args);
}
else
{
info.AddValue("__fault", this._exception);
}
info.AddValue("__CallContext", this._callContext);
if (this.InternalProperties != null)
{
foreach (object obj in this.InternalProperties)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
info.AddValue((string)dictionaryEntry.Key, dictionaryEntry.Value);
}
}
}
/// Returns the specified argument marked as a ref parameter or an out parameter.
/// The specified argument marked as a ref parameter or an out parameter.
/// The index of the requested argument.
///
///
///
// Token: 0x060027BF RID: 10175 RVA: 0x000828CC File Offset: 0x00080ACC
public object GetOutArg(int argNum)
{
if (this._args == null)
{
return null;
}
if (this._inArgInfo == null)
{
this._inArgInfo = new ArgInfo(this.MethodBase, ArgInfoType.Out);
}
return this._args[this._inArgInfo.GetInOutArgIndex(argNum)];
}
/// Returns the name of the specified argument marked as a ref parameter or an out parameter.
/// The argument name, or null if the current method is not implemented.
/// The index of the requested argument.
///
///
///
// Token: 0x060027C0 RID: 10176 RVA: 0x0008290C File Offset: 0x00080B0C
public string GetOutArgName(int index)
{
if (this._methodBase == null)
{
return "__method_" + index;
}
if (this._inArgInfo == null)
{
this._inArgInfo = new ArgInfo(this.MethodBase, ArgInfoType.Out);
}
return this._inArgInfo.GetInOutArgName(index);
}
/// Initializes an internal serialization handler from an array of remoting headers that are applied to a method.
/// An internal serialization handler.
/// An array of remoting headers that contain key/value pairs. This array is used to initialize fields for headers that belong to the namespace "http://schemas.microsoft.com/clr/soap/messageProperties".
///
///
///
// Token: 0x060027C1 RID: 10177 RVA: 0x00082960 File Offset: 0x00080B60
[MonoTODO]
public virtual object HeaderHandler(Header[] h)
{
throw new NotImplementedException();
}
/// Sets method information from serialization settings.
/// The data for serializing or deserializing the remote object.
/// The context of a certain serialized stream.
///
///
///
///
// Token: 0x060027C2 RID: 10178 RVA: 0x00082968 File Offset: 0x00080B68
[MonoTODO]
public void RootSetObjectData(SerializationInfo info, StreamingContext ctx)
{
throw new NotImplementedException();
}
// Token: 0x04000F62 RID: 3938
private string _methodName;
// Token: 0x04000F63 RID: 3939
private string _uri;
// Token: 0x04000F64 RID: 3940
private string _typeName;
// Token: 0x04000F65 RID: 3941
private MethodBase _methodBase;
// Token: 0x04000F66 RID: 3942
private object _returnValue;
// Token: 0x04000F67 RID: 3943
private Exception _exception;
// Token: 0x04000F68 RID: 3944
private Type[] _methodSignature;
// Token: 0x04000F69 RID: 3945
private ArgInfo _inArgInfo;
// Token: 0x04000F6A RID: 3946
private object[] _args;
// Token: 0x04000F6B RID: 3947
private object[] _outArgs;
// Token: 0x04000F6C RID: 3948
private IMethodCallMessage _callMsg;
// Token: 0x04000F6D RID: 3949
private LogicalCallContext _callContext;
// Token: 0x04000F6E RID: 3950
private Identity _targetIdentity;
/// Specifies an interface that represents a collection of the remoting message's properties.
// Token: 0x04000F6F RID: 3951
protected IDictionary ExternalProperties;
/// Specifies an interface that represents a collection of the remoting message's properties.
// Token: 0x04000F70 RID: 3952
protected IDictionary InternalProperties;
}
}