/// <summary>
        /// 根据 数据终止标记 对数据模式分析的适配器 抽象类
        /// <para>数据模式:{ [数据主体] + (数据终止标记) }、{ [数据主体=[数据起始标记 + [其它信息 +]]数据主体大小] + (数据终止标记) }、...</para>
        /// </summary>
        /// <param name="terminator">终止字节数据</param>
        /// <exception cref="ArgumentNullException">参数错误,参数 terminator 不能为空</exception>
        protected TerminatorDataAnalysePattern(IReadOnlyList <byte> terminator)
        {
            if (terminator == null || terminator.Count == 0)
            {
                throw new ArgumentNullException(nameof(terminator), "参数不能为空,长度不能为 0");
            }

            this.BoyerMoore = new BoyerMoore(terminator);
        }
예제 #2
0
        /// <summary>
        /// 根据 数据起始标记 和 数据终止标记 对数据模式分析的适配器 抽象类
        /// <para>数据模式:{ (数据起始标记) + [动态数据主体] + (数据终止标记) }</para>
        /// </summary>
        /// <param name="startBytes">数据起始字节</param>
        /// <param name="endBytes">数据终止字节</param>
        protected BetweenAndDataAnalysePattern(IReadOnlyList <byte> startBytes, IReadOnlyList <byte> endBytes)
        {
            if (endBytes == null || endBytes.Count == 0)
            {
                throw new ArgumentNullException(nameof(endBytes), "参数不能为空,长度不能为 0");
            }
            if (startBytes == null || startBytes.Count == 0)
            {
                throw new ArgumentNullException(nameof(startBytes), "参数不能为空,长度不能为 0");
            }

            EndBoyerMoore   = new BoyerMoore(endBytes);
            StartBoyerMoore = new BoyerMoore(startBytes);
        }