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

◆ Write< T >()

void System.IO.UnmanagedMemoryAccessor.Write< T > ( long position,
ref T structure )
inlineinherited
Type Constraints
T :struct 

Definition at line 494 of file UnmanagedMemoryAccessor.cs.

494 : struct
495 {
496 if (position < 0)
497 {
498 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_NeedNonNegNum);
499 }
500 if (!_isOpen)
501 {
502 throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
503 }
504 if (!_canWrite)
505 {
506 throw new NotSupportedException(SR.NotSupported_Writing);
507 }
508 uint num = SafeBuffer.SizeOf<T>();
509 if (position > _capacity - num)
510 {
511 if (position >= _capacity)
512 {
513 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
514 }
515 throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToWrite, typeof(T)), "position");
516 }
517 _buffer.Write((ulong)(_offset + position), structure);
518 }

References System.IO.UnmanagedMemoryAccessor._buffer, System.IO.UnmanagedMemoryAccessor._canWrite, System.IO.UnmanagedMemoryAccessor._capacity, System.IO.UnmanagedMemoryAccessor._isOpen, System.IO.UnmanagedMemoryAccessor._offset, System.SR.Argument_NotEnoughBytesToWrite, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_PositionLessThanCapacityRequired, System.SR.Format(), System.SR.NotSupported_Writing, and System.SR.ObjectDisposed_ViewAccessorClosed.