/// <summary> /// Stores specified message header + specified lines of body to the specified stream. /// </summary> /// <param name="sequenceNumber">Message 1 based sequence number.</param> /// <param name="stream">Stream where to store data.</param> /// <param name="lineCount">Number of lines of message body to get.</param> internal void GetTopOfMessage(int sequenceNumber, Stream stream, int lineCount) { TcpStream.WriteLine("TOP " + sequenceNumber + " " + lineCount); // Read first line of reply, check if it's ok. string line = ReadLine(); if (line.StartsWith("+OK")) { SmartStream.ReadPeriodTerminatedAsyncOP readTermOP = new SmartStream.ReadPeriodTerminatedAsyncOP(stream, 999999999, SizeExceededAction.ThrowException); TcpStream.ReadPeriodTerminated(readTermOP, false); if (readTermOP.Error != null) { throw readTermOP.Error; } LogAddWrite(readTermOP.BytesStored, readTermOP.BytesStored + " bytes read."); } else { throw new POP3_ClientException(line); } }