Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SetLength()

override void System.IO.MemoryStream.SetLength ( long value)
inlineinherited

Definition at line 513 of file MemoryStream.cs.

514 {
515 if (value < 0 || value > int.MaxValue)
516 {
517 throw new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_StreamLength);
518 }
520 if (value > int.MaxValue - _origin)
521 {
522 throw new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_StreamLength);
523 }
524 int num = _origin + (int)value;
525 if (!EnsureCapacity(num) && num > _length)
526 {
527 Array.Clear(_buffer, _length, num - _length);
528 }
529 _length = num;
530 if (_position > num)
531 {
532 _position = num;
533 }
534 }
bool EnsureCapacity(int value)

References System.IO.MemoryStream._buffer, System.IO.MemoryStream._length, System.IO.MemoryStream._origin, System.IO.MemoryStream._position, System.SR.ArgumentOutOfRange_StreamLength, System.Array.Clear(), System.IO.MemoryStream.EnsureCapacity(), System.IO.MemoryStream.EnsureWriteable(), and System.value.