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

◆ Read< T >()

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

Definition at line 275 of file UnmanagedMemoryAccessor.cs.

275 : struct
276 {
277 if (position < 0)
278 {
279 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_NeedNonNegNum);
280 }
281 if (!_isOpen)
282 {
283 throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
284 }
285 if (!_canRead)
286 {
287 throw new NotSupportedException(SR.NotSupported_Reading);
288 }
289 uint num = SafeBuffer.SizeOf<T>();
290 if (position > _capacity - num)
291 {
292 if (position >= _capacity)
293 {
294 throw new ArgumentOutOfRangeException("position", SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
295 }
296 throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToRead, typeof(T)), "position");
297 }
298 structure = _buffer.Read<T>((ulong)(_offset + position));
299 }

References System.IO.UnmanagedMemoryAccessor._buffer, System.IO.UnmanagedMemoryAccessor._canRead, System.IO.UnmanagedMemoryAccessor._capacity, System.IO.UnmanagedMemoryAccessor._isOpen, System.IO.UnmanagedMemoryAccessor._offset, System.SR.Argument_NotEnoughBytesToRead, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_PositionLessThanCapacityRequired, System.SR.Format(), System.SR.NotSupported_Reading, and System.SR.ObjectDisposed_ViewAccessorClosed.