Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="protocol">JTT协议</param>
        public JTTPipelineFilter(IJTTProtocol protocol)
        {
            var handler = protocol.GetHandler();

            _beginMark = handler.GetHeadFlagValue();
            _endMark   = handler.GetEndFlagValue();
            Decoder    = protocol.Decoder;
        }
Example #2
0
        public JTTDecoder(IJTTProtocol _protocol)
        {
            protocol = _protocol;

            handler = protocol.GetHandler();

            zhcnencoding = handler.GetZHCNEncoding();

            expressionContext = new ExpressionContext();
            expressionContext.Imports.AddType(typeof(Math));
        }
        /// <summary>
        /// 获取JTT协议流数据拦截器
        /// </summary>
        /// <param name="protocol">JTT协议</param>
        /// <returns></returns>
        public static IPipelineFilter <IJTTPackageInfo> GetFilter(this IJTTProtocol protocol)
        {
            var handler   = protocol.GetHandler();
            var beginMark = handler.GetHeadFlagValue();
            var endMark   = handler.GetEndFlagValue();
            var filter    = new JTTPipelineFilter(beginMark, endMark)
            {
                Decoder = protocol.Decoder
            };

            return(filter);
        }