Inheritance: CADMessageBase
Exemple #1
0
        internal MethodCall(CADMethodCallMessage msg)
        {
            this._uri = string.Copy(msg.Uri);
            ArrayList arguments = msg.GetArguments();

            this._args        = msg.GetArgs(arguments);
            this._callContext = msg.GetLogicalCallContext(arguments);
            if (this._callContext == null)
            {
                this._callContext = new LogicalCallContext();
            }
            this._methodBase = msg.GetMethod();
            this.Init();
            if (msg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(this.Properties, msg.PropertiesCount, arguments);
            }
        }
Exemple #2
0
		internal MethodCall (CADMethodCallMessage msg) 
		{
			_uri = string.Copy (msg.Uri);
			
			// Get unmarshalled arguments
			ArrayList args = msg.GetArguments ();

			_args = msg.GetArgs (args);
			_callContext = msg.GetLogicalCallContext (args);
			if (_callContext == null)
				_callContext = new LogicalCallContext ();
	
			_methodBase = msg.GetMethod ();
			
			Init();

			if (msg.PropertiesCount > 0)
				CADMessageBase.UnmarshalProperties (Properties, msg.PropertiesCount, args);
		}
Exemple #3
0
        internal MethodCall(CADMethodCallMessage msg)
        {
            _uri = string.Copy(msg.Uri);

            // Get unmarshalled arguments
            ArrayList args = msg.GetArguments();

            _args        = msg.GetArgs(args);
            _callContext = msg.GetLogicalCallContext(args);
            if (_callContext == null)
            {
                _callContext = new LogicalCallContext();
            }

            _methodBase = msg.GetMethod();

            Init();

            if (msg.PropertiesCount > 0)
            {
                CADMessageBase.UnmarshalProperties(Properties, msg.PropertiesCount, args);
            }
        }
Exemple #4
0
#pragma warning disable 169
		private static ProcessMessageRes ProcessMessageInDomain (
			byte[] arrRequest,
			CADMethodCallMessage cadMsg)
	    {
			ProcessMessageRes res = new ProcessMessageRes ();

			try 
			{
				AppDomain.CurrentDomain.ProcessMessageInDomain (arrRequest, cadMsg, out res.arrResponse, out res.cadMrm);
			}
			catch (Exception e) 
			{
				IMessage errorMsg = new MethodResponse (e, new ErrorMessage());
				res.arrResponse = CADSerializer.SerializeMessage (errorMsg).GetBuffer(); 
			}
			return res;
		}
Exemple #5
0
		internal void ProcessMessageInDomain (byte[] arrRequest, CADMethodCallMessage cadMsg,
		                                      out byte[] arrResponse, out CADMethodReturnMessage cadMrm)
		{
			IMessage reqDomMsg;

			if (null != arrRequest)
				reqDomMsg = CADSerializer.DeserializeMessage (new MemoryStream(arrRequest), null);
			else
				reqDomMsg = new MethodCall (cadMsg);

			IMessage retDomMsg = ChannelServices.SyncDispatchMessage (reqDomMsg);

			cadMrm = CADMethodReturnMessage.Create (retDomMsg);
			if (null == cadMrm) {
				arrResponse = CADSerializer.SerializeMessage (retDomMsg).GetBuffer();
			} 
			else
				arrResponse = null;
		}
Exemple #6
0
        internal MethodBase GetMethod()
        {
            Type       type = Type.GetType(this.FullTypeName);
            MethodBase methodBase;

            if (type.IsGenericType || type.IsGenericTypeDefinition)
            {
                methodBase = MethodBase.GetMethodFromHandleNoGenericCheck(this.MethodHandle);
            }
            else
            {
                methodBase = MethodBase.GetMethodFromHandle(this.MethodHandle);
            }
            if (type == methodBase.DeclaringType)
            {
                return(methodBase);
            }
            Type[] signature = CADMethodCallMessage.GetSignature(methodBase, true);
            if (methodBase.IsGenericMethod)
            {
                MethodBase[] methods          = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                Type[]       genericArguments = methodBase.GetGenericArguments();
                foreach (MethodBase methodBase2 in methods)
                {
                    if (methodBase2.IsGenericMethod && !(methodBase2.Name != methodBase.Name))
                    {
                        Type[] genericArguments2 = methodBase2.GetGenericArguments();
                        if (genericArguments.Length == genericArguments2.Length)
                        {
                            MethodInfo methodInfo = ((MethodInfo)methodBase2).MakeGenericMethod(genericArguments);
                            Type[]     signature2 = CADMethodCallMessage.GetSignature(methodInfo, false);
                            if (signature2.Length == signature.Length)
                            {
                                bool flag = false;
                                for (int j = signature2.Length - 1; j >= 0; j--)
                                {
                                    if (signature2[j] != signature[j])
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    return(methodInfo);
                                }
                            }
                        }
                    }
                }
                return(methodBase);
            }
            MethodBase method = type.GetMethod(methodBase.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, signature, null);

            if (method == null)
            {
                throw new RemotingException(string.Concat(new object[]
                {
                    "Method '",
                    methodBase.Name,
                    "' not found in type '",
                    type,
                    "'"
                }));
            }
            return(method);
        }