コード例 #1
0
        private MemoryStream DoOutput(string functionName, object[] arguments, bool byRef, bool simple, HproseClientContext context)
        {
            MemoryStream outData = new MemoryStream();

#if !dotNETMF
            HproseWriter writer = new HproseWriter(outData, mode, simple);
#else
            HproseWriter writer = new HproseWriter(outData, simple);
#endif
            outData.WriteByte(HproseTags.TagCall);
            writer.WriteString(functionName);
            if ((arguments != null) && (arguments.Length > 0 || byRef))
            {
                writer.Reset();
                writer.WriteArray(arguments);
                if (byRef)
                {
                    writer.WriteBoolean(true);
                }
            }
            outData.WriteByte(HproseTags.TagEnd);
            outData.Position = 0;
            for (int i = 0, n = filters.Count; i < n; ++i)
            {
#if (dotNET10 || dotNET11 || dotNETCF10 || dotNETMF)
                IHproseFilter filter = (IHproseFilter)filters[i];
                outData = filter.OutputFilter(outData, context);
#else
                outData = filters[i].OutputFilter(outData, context);
#endif
                outData.Position = 0;
            }
            return(outData);
        }
コード例 #2
0
        protected void SendError(string error)
        {
            if (OnSendError != null)
            {
                OnSendError(error);
            }
            Stream       ostream = OutputStream;
            HproseWriter writer  = new HproseWriter(ostream, mode);

            ostream.WriteByte(HproseTags.TagError);
            writer.WriteString(error, false);
            ostream.WriteByte(HproseTags.TagEnd);
            ostream.Flush();
        }
コード例 #3
0
        protected MemoryStream SendError(Exception e, object context)
        {
            if (OnSendError != null)
            {
                OnSendError(e, context);
            }
            string       error  = debugEnabled ? e.ToString(): e.Message;
            MemoryStream data   = new MemoryStream(4096);
            HproseWriter writer = new HproseWriter(data, mode, true);

            data.WriteByte(HproseTags.TagError);
            writer.WriteString(error);
            data.WriteByte(HproseTags.TagEnd);
            return(ResponseEnd(data, context));
        }
コード例 #4
0
        private void DoOutput(string functionName, object[] arguments, bool byRef, Stream ostream)
        {
            HproseWriter hproseWriter = new HproseWriter(ostream, mode);

            ostream.WriteByte(HproseTags.TagCall);
            hproseWriter.WriteString(functionName, false);
            if ((arguments != null) && (arguments.Length > 0 || byRef))
            {
                hproseWriter.Reset();
                hproseWriter.WriteArray(arguments, false);
                if (byRef)
                {
                    hproseWriter.WriteBoolean(true);
                }
            }
            ostream.WriteByte(HproseTags.TagEnd);
        }