Example #1
0
        internal void QueueWrite(byte[] data, int offset, int count)
        {
            this.bytesWritten   += count;
            this.lineTermination = MimeCommon.AdvanceLineTerminationState(this.lineTermination, data, offset, count);
            int num = (this.writeCount == 1) ? (this.currentWrite.Length - this.currentWrite.Count) : ((this.writeCount == 0) ? MimeWriter.QueuedWrite.QueuedWriteSize : 0);

            if (num >= count)
            {
                if (this.writeCount == 0)
                {
                    MimeWriter.QueuedWrite queuedWrite = default(MimeWriter.QueuedWrite);
                    this.PushWrite(ref queuedWrite);
                }
                this.currentWrite.Append(data, offset, count);
                return;
            }
            MimeWriter.QueuedWrite queuedWrite2 = default(MimeWriter.QueuedWrite);
            if (count < MimeWriter.QueuedWrite.QueuedWriteSize && this.writeCount > 0)
            {
                queuedWrite2 = this.currentWrite;
            }
            this.FlushWriteQueue();
            if (count < MimeWriter.QueuedWrite.QueuedWriteSize && queuedWrite2.Length > 0)
            {
                queuedWrite2.Reset();
                queuedWrite2.Append(data, offset, count);
                this.PushWrite(ref queuedWrite2);
                return;
            }
            this.data.Write(data, offset, count);
        }