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

◆ Initialize() [1/2]

unsafe void System.IO.UnmanagedMemoryStream.Initialize ( byte * pointer,
long length,
long capacity,
FileAccess access )
inlineprotectedinherited

Definition at line 209 of file UnmanagedMemoryStream.cs.

210 {
211 if (pointer == null)
212 {
213 throw new ArgumentNullException("pointer");
214 }
215 if (length < 0 || capacity < 0)
216 {
217 throw new ArgumentOutOfRangeException((length < 0) ? "length" : "capacity", SR.ArgumentOutOfRange_NeedNonNegNum);
218 }
219 if (length > capacity)
220 {
221 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_LengthGreaterThanCapacity);
222 }
223 if ((nuint)((long)pointer + capacity) < (nuint)pointer)
224 {
225 throw new ArgumentOutOfRangeException("capacity", SR.ArgumentOutOfRange_UnmanagedMemStreamWrapAround);
226 }
227 if (access < FileAccess.Read || access > FileAccess.ReadWrite)
228 {
229 throw new ArgumentOutOfRangeException("access", SR.ArgumentOutOfRange_Enum);
230 }
231 if (_isOpen)
232 {
233 throw new InvalidOperationException(SR.InvalidOperation_CalledTwice);
234 }
235 _mem = pointer;
236 _offset = 0L;
237 _length = length;
239 _access = access;
240 _isOpen = true;
241 }

References System.IO.UnmanagedMemoryStream._access, System.IO.UnmanagedMemoryStream._capacity, System.IO.UnmanagedMemoryStream._isOpen, System.IO.UnmanagedMemoryStream._length, System.IO.UnmanagedMemoryStream._mem, System.IO.UnmanagedMemoryStream._offset, System.SR.ArgumentOutOfRange_Enum, System.SR.ArgumentOutOfRange_LengthGreaterThanCapacity, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_UnmanagedMemStreamWrapAround, System.capacity, System.SR.InvalidOperation_CalledTwice, System.L, System.length, and System.pointer.