private void BackpatchSize() { int size = buffer.Position - context.StartPosition; if (size > settings.MaxDocumentSize) { throw new FileFormatException("Size is larger than MaxDocumentSize"); } buffer.Backpatch(context.StartPosition, size); }
private void BackpatchSize() { int size = buffer.Position - context.StartPosition; if (size > settings.MaxDocumentSize) { var message = string.Format("Size {0} is larger than MaxDocumentSize {1}.", size, settings.MaxDocumentSize); throw new FileFormatException(message); } buffer.Backpatch(context.StartPosition, size); }
// private methods private void BackpatchSize() { int size = _buffer.Position - _context.StartPosition; if (size > _maxDocumentSizeStack.Peek()) { var message = string.Format("Size {0} is larger than MaxDocumentSize {1}.", size, _maxDocumentSizeStack.Peek()); throw new Exception(message); } _buffer.Backpatch(_context.StartPosition, size); }
// protected methods protected void BackpatchMessageLength(BsonBuffer buffer) { MessageLength = buffer.Position - _messageStartPosition; buffer.Backpatch(_messageStartPosition, MessageLength); }