/// <summary> /// Searches the mark from source. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">The source.</param> /// <param name="offset">The offset.</param> /// <param name="length">The length.</param> /// <param name="searchState">State of the search.</param> /// <param name="parsedLength">Length of the parsed.</param> /// <returns></returns> public static int SearchMark <T>(this IList <T> source, int offset, int length, SearchMarkState <T> searchState, out int parsedLength) where T : IEquatable <T> { int?result = source.SearchMark(offset, length, searchState.Mark, searchState.Matched, out parsedLength); if (!result.HasValue) { searchState.Matched = 0; return(-1); } if (result.Value < 0) { searchState.Matched = 0 - result.Value; return(-1); } searchState.Matched = 0; return(result.Value); }
/// <summary> /// Initializes a new instance of the <see cref="TerminatorReceiveFilter{TPackageInfo}"/> class. /// </summary> /// <param name="terminator">The terminator.</param> protected TerminatorReceiveFilter(byte[] terminator) { m_SearchState = new SearchMarkState <byte>(terminator); }