示例#1
0
        /// <summary>
        /// Processes whole Channel in reverse order.
        /// First the byte[] data is processed passing by ALL IInternalSink objects (with reverse order) and finally is converted
        /// to string using IEndPointSink::DecodifyData
        /// Note that ProcessChannel (ProcessChannel(str)) DOES NOT have to return str (because the Channel does NOT have
        /// to be symmetric).
        /// </summary>
        /// <param name="data">Data to process</param>
        /// <returns>Data after processed by whole channel.</returns>
        public string Process(byte[] data)
        {
            byte[] pdata = data;
            // Step 1: Apply all InternalSinks in reverse order
            int count = _sinks.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                IInternalSink internalSink = (IInternalSink)_sinks[i];
                byte []       idata        = internalSink.ProcessData(pdata, InternalSinkProcessOrder.reverse);
                pdata = idata != null ? idata : pdata;
            }
            // Step 2: Apply the EndPointSink
            string sdata = _endPointSink.DecodifyData(pdata);

            return(sdata);
        }
示例#2
0
 public void AddSink(IInternalSink sink)
 {
     _sinks.Add(sink);
 }