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()); } } }
/// <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(); }
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)); }
/// <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); }
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); }
/// <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(); } }
/// <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 } }
/// <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(); } }
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(); }