/// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="currentResult"></param>
        /// <returns></returns>
        protected override MatchTerminatorStatus Validate(TSource item, MatchTerminatorResult currentResult)
        {
            bool result = item.Equals(CurrentTerminator.Current);

            if (!result)
            {
                return(MatchTerminatorStatus.Fail);
            }

            return(CurrentTerminator.MoveNext() ?
                   MatchTerminatorStatus.SuccessPartial : MatchTerminatorStatus.Success);
        }
            /// <summary>
            ///
            /// </summary>
            /// <param name="item"></param>
            /// <param name="currentResult"></param>
            /// <returns></returns>
            protected override MatchTerminatorStatus Validate(byte item, MatchTerminatorResult currentResult)
            {
                bool result = item.Equals(CurrentTerminator.Current);

                if (!result)
                {
                    return(MatchTerminatorStatus.Fail);
                }

                try
                {
                    return(CurrentTerminator.MoveNext() ?
                           MatchTerminatorStatus.SuccessPartial :
                           (currentResult.Length == 1 ? MatchTerminatorStatus.SuccessReset : MatchTerminatorStatus.Success));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
Exemple #3
0
 /// <summary>
 /// This method resets the terminator to the beginning.
 /// </summary>
 public virtual void Reset()
 {
     CurrentTerminator.Reset();
     CurrentTerminator.MoveNext();
 }