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

◆ EnsureSafeToRead()

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

Definition at line 557 of file UnmanagedMemoryAccessor.cs.

558 {
559 if (!_isOpen)
560 {
561 throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
562 }
563 if (!_canRead)
564 {
565 throw new NotSupportedException(SR.NotSupported_Reading);
566 }
567 if (position < 0)
568 {
569 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_NeedNonNegNum);
570 }
571 if (position > _capacity - sizeOfType)
572 {
573 if (position >= _capacity)
574 {
575 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
576 }
577 throw new ArgumentException(SR.Argument_NotEnoughBytesToRead, "position");
578 }
579 }

References System.IO.UnmanagedMemoryAccessor._canRead, System.IO.UnmanagedMemoryAccessor._capacity, System.IO.UnmanagedMemoryAccessor._isOpen, System.SR.Argument_NotEnoughBytesToRead, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_PositionLessThanCapacityRequired, System.SR.NotSupported_Reading, and System.SR.ObjectDisposed_ViewAccessorClosed.

Referenced by System.IO.UnmanagedMemoryAccessor.ReadByte(), System.IO.UnmanagedMemoryAccessor.ReadDecimal(), System.IO.UnmanagedMemoryAccessor.ReadInt16(), System.IO.UnmanagedMemoryAccessor.ReadInt32(), and System.IO.UnmanagedMemoryAccessor.ReadInt64().