コード例 #1
0
 public async ValueTask <OutputStream> DispatchAsync(Ice.InputStream istr, Current current)
 {
     if (current.Operation.Equals("opOneway"))
     {
         if (!current.IsOneway)
         {
             // If called two-way, return exception to caller.
             throw new Test.MyException();
         }
         return(OutgoingResponseFrame.Empty(current));
     }
     else if (current.Operation.Equals("opString"))
     {
         string s             = istr.ReadString();
         var    responseFrame = new OutgoingResponseFrame(current);
         responseFrame.StartReturnValue();
         responseFrame.WriteString(s);
         responseFrame.WriteString(s);
         responseFrame.EndReturnValue();
         return(responseFrame);
     }
     else if (current.Operation.Equals("opException"))
     {
         if (current.Context.ContainsKey("raise"))
         {
             throw new Test.MyException();
         }
         var ex = new Test.MyException();
         return(new OutgoingResponseFrame(current, ex));
     }
     else if (current.Operation.Equals("shutdown"))
     {
         current.Adapter.Communicator.Shutdown();
         return(OutgoingResponseFrame.Empty(current));
     }
     else if (current.Operation.Equals("ice_isA"))
     {
         string s             = istr.ReadString();
         var    responseFrame = new OutgoingResponseFrame(current);
         responseFrame.StartReturnValue();
         if (s.Equals("::Test::MyClass"))
         {
             responseFrame.WriteBool(true);
         }
         else
         {
             responseFrame.WriteBool(false);
         }
         responseFrame.EndReturnValue();
         return(responseFrame);
     }
     else
     {
         throw new OperationNotExistException(current.Id, current.Facet, current.Operation);
     }
 }
コード例 #2
0
        public ValueTask <OutputStream> DispatchAsync(InputStream istr, Current current)
        {
            var ae            = new Test.AlsoEmpty();
            var responseFrame = new OutgoingResponseFrame(current);

            responseFrame.StartReturnValue();
            responseFrame.WriteClass(ae);
            responseFrame.EndReturnValue();
            return(new ValueTask <OutputStream>(responseFrame));
        }