コード例 #1
0
        /// <summary>
        /// Tells the AMFProcessor to immediately begin processing the AMF request on the input
        /// stream and to format the response on the output stream.  During this method execution, the
        /// AMFProcessor will raise the Command event and give your code a chance to set the Response
        /// property for the request(s).  If you do not send the outputStream to this call, you can
        /// have the results rendered later by calling RenderResponse.
        ///
        /// If you are using the AMFProcessor for Http processing, you should call ProcessHttpRequest
        /// instead of this method and let the processor take care of the stream handling for you.
        /// </summary>
        /// <param name="inputStream"></param>
        /// <param name="outputStream"></param>
        public void ProcessRequest(Stream inputStream, Stream outputStream)
        {
            //read the incoming
            AMFReader reader = new AMFReader(inputStream);

            _envelope = reader.ReadRequest();

            //for each body that we have, prepare a response
            for (int i = 0; i < _envelope.Bodies.Count; i++)
            {
                AMFBody          body        = _envelope.Bodies[i];
                AMFClientRequest flexRequest = new AMFClientRequest();
                flexRequest.Command    = body.Target;
                flexRequest.Id         = body.ResponseId;
                flexRequest.Parameters = body.Value;
                flexRequest.Headers    = _envelope.Headers;

                if (Command != null)
                {
                    Command(flexRequest);
                }

                _clientRequests.Add(flexRequest);
            }

            //now render the result
            if (outputStream != null)
            {
                RenderResponse(outputStream);
            }
        }
コード例 #2
0
        public AMFEnvelope ReadRequest()
        {
            _envelope = new AMFEnvelope();

            ProcessRequest();

            return(_envelope);
        }
コード例 #3
0
 public AMFWriter(Stream output, AMFEnvelope envelope)
     : base(output)
 {
     _envelope = envelope;
 }