2 // System.Runtime.Remoting.Messaging.MonoMethodMessage.cs
5 // Dietmar Maurer (dietmar@ximian.com)
7 // (C) Ximian, Inc. http://www.ximian.com
11 using System.Collections;
12 using System.Reflection;
13 using System.Runtime.CompilerServices;
15 namespace System.Runtime.Remoting.Messaging {
17 public class MonoMethodMessage : IMethodCallMessage, IMethodReturnMessage {
25 byte [] arg_types; /* 1 == IN; 2 == OUT ; 3 = INOUT */
27 public LogicalCallContext ctx;
33 [MethodImplAttribute(MethodImplOptions.InternalCall)]
34 internal extern void InitMessage (MonoMethod method, object [] out_args);
36 public MonoMethodMessage (MethodBase method, object [] out_args)
38 InitMessage ((MonoMethod)method, out_args);
41 public MonoMethodMessage (Type type, string method_name, object [] in_args)
43 // fixme: consider arg types
44 MethodInfo minfo = type.GetMethod (method_name);
46 InitMessage ((MonoMethod)minfo, null);
48 int len = in_args.Length;
49 for (int i = 0; i < len; i++) {
50 args [i] = in_args [i];
54 public IDictionary Properties {
66 public object [] Args {
72 public bool HasVarArgs {
78 public LogicalCallContext LogicalCallContext {
84 public MethodBase MethodBase {
90 public string MethodName {
96 public object MethodSignature {
102 public string TypeName {
117 public object GetArg (int arg_num)
119 return args [arg_num];
122 public string GetArgName (int arg_num)
124 return names [arg_num];
127 public int InArgCount {
131 foreach (byte t in arg_types) {
132 if ((t & 1) != 0) count++;
139 public object [] InArgs {
141 int i, j, count = InArgCount;
142 object [] inargs = new object [count];
145 foreach (byte t in arg_types) {
147 inargs [j++] = args [i];
155 public object GetInArg (int arg_num)
158 foreach (byte t in arg_types) {
168 public string GetInArgName (int arg_num)
171 foreach (byte t in arg_types) {
181 public Exception Exception {
187 public int OutArgCount {
191 foreach (byte t in arg_types) {
192 if ((t & 2) != 0) count++;
199 public object [] OutArgs {
201 int i, j, count = OutArgCount;
202 object [] outargs = new object [count];
205 foreach (byte t in arg_types) {
207 outargs [j++] = args [i];
215 public object ReturnValue {
221 public object GetOutArg (int arg_num)
224 foreach (byte t in arg_types) {
234 public string GetOutArgName (int arg_num)
237 foreach (byte t in arg_types) {