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

◆ EnsureSafeToWrite()

void System.IO.UnmanagedMemoryAccessor.EnsureSafeToWrite ( long position,
int sizeOfType )
inlineprivateinherited

Definition at line 581 of file UnmanagedMemoryAccessor.cs.

582 {
583 if (!_isOpen)
584 {
585 throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
586 }
587 if (!_canWrite)
588 {
589 throw new NotSupportedException(SR.NotSupported_Writing);
590 }
591 if (position < 0)
592 {
593 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_NeedNonNegNum);
594 }
595 if (position > _capacity - sizeOfType)
596 {
597 if (position >= _capacity)
598 {
599 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
600 }
601 throw new ArgumentException(SR.Argument_NotEnoughBytesToWrite, "position");
602 }
603 }

References System.IO.UnmanagedMemoryAccessor._canWrite, System.IO.UnmanagedMemoryAccessor._capacity, System.IO.UnmanagedMemoryAccessor._isOpen, System.SR.Argument_NotEnoughBytesToWrite, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_PositionLessThanCapacityRequired, System.SR.NotSupported_Writing, and System.SR.ObjectDisposed_ViewAccessorClosed.

Referenced by System.IO.UnmanagedMemoryAccessor.Write(), System.IO.UnmanagedMemoryAccessor.Write(), System.IO.UnmanagedMemoryAccessor.Write(), System.IO.UnmanagedMemoryAccessor.Write(), and System.IO.UnmanagedMemoryAccessor.Write().