示例#1
0
        private Exception ReadException()
        {
            switch (ReplyStatus)
            {
            case ReplyStatus.UserException:
            {
                var istr = new InputStream(_communicator, Payload, 1);
                istr.StartEncapsulation();
                RemoteException ex = istr.ReadException();
                istr.EndEncapsulation();
                return(ex);
            }

            case ReplyStatus.ObjectNotExistException:
            case ReplyStatus.FacetNotExistException:
            case ReplyStatus.OperationNotExistException:
            {
                return(ReadDispatchException());
            }

            default:
            {
                Debug.Assert(ReplyStatus == ReplyStatus.UnknownException ||
                             ReplyStatus == ReplyStatus.UnknownLocalException ||
                             ReplyStatus == ReplyStatus.UnknownUserException);
                return(ReadUnhandledException());
            }
            }
        }
示例#2
0
        /// <summary>Reads the empty parameter list, calling this methods ensure that the frame payload
        /// correspond to the empty parameter list.</summary>
        public void ReadEmptyParamList()
        {
            var istr = new InputStream(_communicator, Payload);

            istr.StartEncapsulation();
            istr.EndEncapsulation();
        }
示例#3
0
        internal static Ice.Current CreateCurrent(int requestId, Ice.InputStream requestFrame,
                                                  Ice.ObjectAdapter adapter, Ice.Connection?connection = null)
        {
            var identity = new Ice.Identity(requestFrame);

            // For compatibility with the old FacetPath.
            string[] facetPath = requestFrame.ReadStringArray();
            if (facetPath.Length > 1)
            {
                throw new Ice.MarshalException();
            }
            string facet     = facetPath.Length == 0 ? "" : facetPath[0];
            string operation = requestFrame.ReadString();
            var    mode      = requestFrame.ReadByte();

            if (mode > 2)
            {
                throw new Ice.MarshalException(
                          $"received invalid operation mode `{mode}' with operation `{operation}'");
            }
            bool idempotent = mode > 0;
            var  context    = requestFrame.ReadContext();

            Ice.EncodingVersion encoding = requestFrame.StartEncapsulation();

            return(new Ice.Current(adapter, identity, facet, operation, idempotent, context,
                                   requestId, connection, encoding));
        }
示例#4
0
        /// <summary>Reads the request frame parameter list.</summary>
        /// <param name="reader">An InputStreamReader delegate used to read the request frame
        /// parameters.</param>
        /// <returns>The request parameters, when the frame parameter list contains multiple parameters
        /// they must be return as a tuple.</returns>
        public T ReadParamList <T>(InputStreamReader <T> reader)
        {
            var istr = new InputStream(_communicator, Payload);

            istr.StartEncapsulation();
            T paramList = reader(istr);

            istr.EndEncapsulation();
            return(paramList);
        }
示例#5
0
    public IceInternal.EndpointI read(Ice.InputStream s)
    {
        short type = s.ReadShort();

        Debug.Assert(type == _factory.type());

        s.StartEncapsulation();
        IceInternal.EndpointI endpoint = new EndpointI(_factory.read(s));
        s.EndEncapsulation();
        return(endpoint);
    }
示例#6
0
 /// <summary>Reads an empty return value from the response frame. If the response frame carries
 /// a failure, reads and throws this exception.</summary>
 public void ReadVoidReturnValue()
 {
     if (ReplyStatus == ReplyStatus.OK)
     {
         var istr = new InputStream(_communicator, Payload, 1);
         istr.StartEncapsulation();
         istr.EndEncapsulation();
     }
     else
     {
         throw ReadException();
     }
 }
示例#7
0
        /// <summary>Starts reading the result carried by this response frame.</summary>
        /// <returns>The type of the result, either Success or Failure, and an InputStream iterator over this result.
        /// </returns>
        public (ResultType ResultType, InputStream InputStream) ReadResult()
        {
            InputStream.StartEncapsulation();
            switch (ReplyStatus)
            {
            case ReplyStatus.OK:
                return(ResultType.Success, InputStream);

            case ReplyStatus.UserException:
                return(ResultType.Failure, InputStream);

            default:
                throw new InvalidOperationException();     // TODO: better exception and message
            }
        }
示例#8
0
 /// <summary>Reads the return value carried by this response frame. If the response frame carries
 /// a failure, reads and throws this exception.</summary>
 /// <param name="reader">An input stream reader used to read the frame return value, when the frame
 /// return value contain multiple values the reader must use a tuple to return the values.</param>
 /// <returns>The frame return value.</returns>
 public T ReadReturnValue <T>(InputStreamReader <T> reader)
 {
     if (ReplyStatus == ReplyStatus.OK)
     {
         var istr = new InputStream(_communicator, Payload, 1);
         istr.StartEncapsulation();
         T ret = reader(istr);
         istr.EndEncapsulation();
         return(ret);
     }
     else
     {
         throw ReadException();
     }
 }
示例#9
0
文件: Current.cs 项目: yssource/ice
        internal Current(int requestId, InputStream request, ObjectAdapter adapter, Ice.Connection?connection = null)
        {
            Adapter = adapter;
            Id      = new Identity(request);

            // For compatibility with the old FacetPath.
            string[] facetPath = request.ReadStringArray();
            if (facetPath.Length > 1)
            {
                throw new MarshalException();
            }
            Facet        = facetPath.Length == 0 ? "" : facetPath[0];
            Operation    = request.ReadString();
            IsIdempotent = request.ReadOperationMode() != OperationMode.Normal;
            Context      = request.ReadContext();
            RequestId    = requestId;
            Connection   = connection;
            Encoding     = request.StartEncapsulation();
        }