// Token: 0x0600076F RID: 1903 RVA: 0x0001BD68 File Offset: 0x00019F68 public TPackageInfo Filter(BufferList data, out int rest) { rest = 0; ArraySegment <byte> last = data.Last; byte[] array = last.Array; int num = last.Offset; int num2 = last.Count; while (this.m_SpliterFoundCount < this.m_SpliterCount) { int num3; if (array.SearchMark(num, num2, this.m_SpliterSearchState, out num3) < 0) { return(default(TPackageInfo)); } this.m_SpliterFoundCount++; num += num3; num2 -= num3; } data.SetLastItemLength(num - last.Offset); this.Reset(); rest = num2; return(this.ResolvePackage(this.GetBufferStream(data))); }
public TPackageInfo Filter(BufferList data, out int rest) { rest = 0; ArraySegment <byte> last = data.Last; int matched = m_SearchState.Matched; if (last.Array.SearchMark(last.Offset, last.Count, m_SearchState, out int parsedLength) < 0) { return(NullPackageInfo); } rest = last.Count - parsedLength; if (rest > 0) { data.SetLastItemLength(parsedLength); } return(ResolvePackage(this.GetBufferStream(data))); }
// Token: 0x0600079C RID: 1948 RVA: 0x0001C1E0 File Offset: 0x0001A3E0 public TPackageInfo Filter(BufferList data, out int rest) { rest = 0; ArraySegment <byte> last = data.Last; int matched = this.m_SearchState.Matched; int num; if (last.Array.SearchMark(last.Offset, last.Count, this.m_SearchState, out num) < 0) { return(TerminatorReceiveFilter <TPackageInfo> .NullPackageInfo); } rest = last.Count - num; if (rest > 0) { data.SetLastItemLength(num); } return(this.ResolvePackage(this.GetBufferStream(data))); }
// Token: 0x0600077E RID: 1918 RVA: 0x0001BE58 File Offset: 0x0001A058 public virtual TPackageInfo Filter(BufferList data, out int rest) { rest = 0; int total = data.Total; if (total < this.m_Size) { return(default(TPackageInfo)); } if (total > this.m_Size) { rest = total - this.m_Size; data.SetLastItemLength(data.Last.Count - rest); } BufferStream bufferStream = this.GetBufferStream(data); if (!this.CanResolvePackage(bufferStream)) { return(default(TPackageInfo)); } return(this.ResolvePackage(bufferStream)); }
public virtual TPackageInfo Filter(BufferList data, out int rest) { rest = 0; ArraySegment <byte> last = data.Last; byte[] array = last.Array; int offset = last.Offset; int count = last.Count; int parsedLength = 0; int num2; int length; if (!m_FoundBegin) { int num = array.SearchMark(offset, count, m_BeginSearchState, out parsedLength); if (num < 0) { if (m_BeginSearchState.Matched > 0 && data.Total == m_BeginSearchState.Matched) { return(default(TPackageInfo)); } State = FilterState.Error; return(default(TPackageInfo)); } if (num != offset) { State = FilterState.Error; return(default(TPackageInfo)); } m_FoundBegin = true; num2 = offset + parsedLength; if (offset + count <= num2) { return(default(TPackageInfo)); } length = offset + count - num2; } else { num2 = offset; length = count; } while (true) { int parsedLength2; int num3 = array.SearchMark(num2, length, m_EndSearchState, out parsedLength2); if (num3 < 0) { return(default(TPackageInfo)); } parsedLength += parsedLength2; rest = count - parsedLength; if (rest > 0) { data.SetLastItemLength(parsedLength); } TPackageInfo val = ResolvePackage(this.GetBufferStream(data)); if ((object)val != (object)default(TPackageInfo)) { Reset(); return(val); } if (rest <= 0) { break; } num2 = num3 + m_EndSearchState.Mark.Length; length = rest; } return(default(TPackageInfo)); }
// Token: 0x06000768 RID: 1896 RVA: 0x0001BBF4 File Offset: 0x00019DF4 public virtual TPackageInfo Filter(BufferList data, out int rest) { rest = 0; ArraySegment <byte> last = data.Last; byte[] array = last.Array; int offset = last.Offset; int count = last.Count; int num = 0; int num3; int length; if (!this.m_FoundBegin) { int num2 = array.SearchMark(offset, count, this.m_BeginSearchState, out num); if (num2 < 0) { if (this.m_BeginSearchState.Matched > 0 && data.Total == this.m_BeginSearchState.Matched) { return(default(TPackageInfo)); } this.State = FilterState.Error; return(default(TPackageInfo)); } else { if (num2 != offset) { this.State = FilterState.Error; return(default(TPackageInfo)); } this.m_FoundBegin = true; num3 = offset + num; if (offset + count <= num3) { return(default(TPackageInfo)); } length = offset + count - num3; } } else { num3 = offset; length = count; } TPackageInfo tpackageInfo; for (;;) { int num5; int num4 = array.SearchMark(num3, length, this.m_EndSearchState, out num5); if (num4 < 0) { break; } num += num5; rest = count - num; if (rest > 0) { data.SetLastItemLength(num); } tpackageInfo = this.ResolvePackage(this.GetBufferStream(data)); if (tpackageInfo != default(TPackageInfo)) { goto Block_9; } if (rest <= 0) { goto IL_15C; } num3 = num4 + this.m_EndSearchState.Mark.Length; length = rest; } return(default(TPackageInfo)); Block_9: this.Reset(); return(tpackageInfo); IL_15C: return(default(TPackageInfo)); }