private int FinishRead(int bytesRead) { MaxMessageSizeStream maxMessageSizeStream = this; maxMessageSizeStream.totalBytesRead = maxMessageSizeStream.totalBytesRead + (long)bytesRead; return(bytesRead); }
private void PrepareWrite(int bytesToWrite) { if (this.bytesWritten + (long)bytesToWrite > this.maxMessageSize) { throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(MaxMessageSizeStream.CreateMaxSentMessageSizeExceededException(this.maxMessageSize)); } MaxMessageSizeStream maxMessageSizeStream = this; maxMessageSizeStream.bytesWritten = maxMessageSizeStream.bytesWritten + (long)bytesToWrite; }
private int PrepareRead(int bytesToRead) { if (this.totalBytesRead >= this.maxMessageSize) { throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(MaxMessageSizeStream.CreateMaxReceivedMessageSizeExceededException(this.maxMessageSize)); } if (this.maxMessageSize - this.totalBytesRead > (long)2147483647) { return(bytesToRead); } return(Math.Min(bytesToRead, (int)(this.maxMessageSize - this.totalBytesRead))); }