1 // ==++==
2 //
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 //
5 // ==--==
6 #if FEATURE_REMOTING
7 namespace System.Runtime.Serialization.Formatters.Binary
8 {
9     using System;
10     using System.Collections;
11     using System.Runtime.Remoting.Messaging;
12     using System.Reflection;
13 
14 
15     [Serializable]
16     internal sealed class BinaryMethodCallMessage
17     {
18 #pragma warning disable 414
19         Object[] _inargs = null;
20 #pragma warning restore
21         String _methodName = null;
22         String _typeName = null;
23         Object _methodSignature = null;
24 
25         Type[] _instArgs = null;
26         Object[] _args = null;
27         [System.Security.SecurityCritical] // auto-generated
28         LogicalCallContext _logicalCallContext = null;
29 
30         Object[] _properties = null;
31 
32         [System.Security.SecurityCritical]  // auto-generated
BinaryMethodCallMessage(String uri, String methodName, String typeName, Type[] instArgs, Object[] args, Object methodSignature, LogicalCallContext callContext, Object[] properties)33         internal BinaryMethodCallMessage(String uri, String methodName, String typeName, Type[] instArgs, Object[] args, Object methodSignature, LogicalCallContext callContext, Object[] properties)
34         {
35             _methodName = methodName;
36             _typeName = typeName;
37             //_uri = uri;
38             if (args == null)
39                 args = new Object[0];
40 
41             _inargs = args;
42             _args = args;
43             _instArgs = instArgs;
44             _methodSignature = methodSignature;
45             if (callContext == null)
46                 _logicalCallContext = new LogicalCallContext();
47             else
48                 _logicalCallContext = callContext;
49 
50             _properties = properties;
51 
52         }
53 
54         public String MethodName
55         {
56             get {return _methodName;}
57         }
58 
59         public String TypeName
60         {
61             get {return _typeName;}
62         }
63 
64 
65         public Type[] InstantiationArgs
66         {
67             get {return _instArgs;}
68         }
69 
70         public Object MethodSignature
71         {
72             get {return _methodSignature;}
73         }
74 
75         public Object[] Args
76         {
77             get {return _args;}
78         }
79 
80         public LogicalCallContext LogicalCallContext
81         {
82             [System.Security.SecurityCritical]  // auto-generated
83             get {return _logicalCallContext;}
84         }
85 
86         public bool HasProperties
87         {
88             get {return (_properties != null);}
89         }
90 
PopulateMessageProperties(IDictionary dict)91         internal void PopulateMessageProperties(IDictionary dict)
92         {
93             foreach (DictionaryEntry de in _properties)
94             {
95                 dict[de.Key] = de.Value;
96             }
97         }
98 
99     }
100 
101 
102     [Serializable]
103     internal class BinaryMethodReturnMessage
104     {
105 #pragma warning disable 414
106         Object[] _outargs = null;
107 #pragma warning restore
108         Exception _exception = null;
109         Object _returnValue = null;
110 
111         Object[] _args = null;
112         [System.Security.SecurityCritical] // auto-generated
113         LogicalCallContext _logicalCallContext = null;
114 
115         Object[] _properties = null;
116 
117         [System.Security.SecurityCritical]  // auto-generated
BinaryMethodReturnMessage(Object returnValue, Object[] args, Exception e, LogicalCallContext callContext, Object[] properties)118         internal BinaryMethodReturnMessage(Object returnValue, Object[] args, Exception e, LogicalCallContext callContext, Object[] properties)
119         {
120             _returnValue = returnValue;
121             if (args == null)
122                 args = new Object[0];
123 
124             _outargs = args;
125             _args= args;
126             _exception = e;
127 
128             if (callContext == null)
129                 _logicalCallContext = new LogicalCallContext();
130             else
131                 _logicalCallContext = callContext;
132 
133             _properties = properties;
134         }
135 
136         public Exception Exception
137         {
138             get {return _exception;}
139         }
140 
141         public Object  ReturnValue
142         {
143             get {return _returnValue;}
144         }
145 
146         public Object[] Args
147         {
148             get {return _args;}
149         }
150 
151         public LogicalCallContext LogicalCallContext
152         {
153             [System.Security.SecurityCritical]  // auto-generated
154             get {return _logicalCallContext;}
155         }
156 
157         public bool HasProperties
158         {
159             get {return (_properties != null);}
160         }
161 
PopulateMessageProperties(IDictionary dict)162         internal void PopulateMessageProperties(IDictionary dict)
163         {
164             foreach (DictionaryEntry de in _properties)
165             {
166                 dict[de.Key] = de.Value;
167             }
168         }
169     }
170 }
171 #endif //  FEATURE_REMOTING
172 
173